ninject:IKernel ninjectKernel = new StandardKernel();ninjectKernel.Bind().To();//绑定数据IValueProducts calc = ninjectKernel.Get();//创建对象//必须写全命名空间 System.Web.Mvc.DependencyResolver.SetResolver(new SportsStroe.WebUI. Infrastructure.NinjectDependencyResolver(kernel));--作用域InTransientScope(): 与未指定作用域效果相同,为每1个被解析的依赖项创建一个新的对象(每依赖项1实例)InSingletonScope() ToConstant(object): 创建一个单一实例,使其共享于整个应用程序。InThreadScope():创建一个单一实例,将其用于解析1个线程中各个对象的依赖项(每个线程1实例)InRequestScope():每个请求1实例kernel.Bind().To().InRequestScope();PM> Install-Package NinjectPM> Install-Packpage Ninject.Web.CommonPM> Install-Package Ninject.MVCInstall-Package Ninject -version 3.0.1.10Install-Package Ninject.Web.Common -version 3.0.0.7Install-Package Ninject.MVC3 -Version 3.0.0.6测试框架:A/A/A 准备/动作/断言Moq:模仿库Mockmock = new Mock();//It.IsAny()调用的类型 Returns定义结果返回值类型mock.Setup(m => m.ApplyDiscount(It.IsAny())).Returns(total => total);var target = new LinqValueCalculator(mock.Object);//动作var result = target.ValueProducts(products);//断言//Assert.AreEqual(goTotal, result);Assert.AreEqual(products.Sum(e => e.Price), result);RouteDebugger tfs
lucene.NET
Nginx (engine x) 是一个高性能的HTTP和反向代理服务器,也是一个IMAP/POP3/SMTP服务器
网友评论