1
那麼我正在做單元測試。現在我是單元測試新手了。我正在使用mvc3框架的nunit和rhino mock。我應該單元測試ApplicationInstaller.cs嗎?請給我推薦一些推薦的nunit測試讀數。我們可以在c#中測試ApplicationInstaller嗎?
public void Install(Castle.Windsor.IWindsorContainer container, Castle.MicroKernel.SubSystems.Configuration.IConfigurationStore store)
{
container.Register(
AllTypes.FromAssemblyContaining<IEmployeeModelAssembler>()
.Where(x => x.Name.EndsWith("Assembler"))
.WithService.DefaultInterfaces());
container.AddFacility<LoggingFacility>(x => x.LogUsing(LoggerImplementation.Log4net).WithConfig("log4net.config"));
container.Register(
// All controllers
AllTypes.FromAssembly(Assembly.GetExecutingAssembly()).BasedOn<IController>().LifestyleTransient(),
//
Component.For<IControllerFactory>().ImplementedBy<IoCControllerFactory>(),
Component.For<ICookieManager>().ImplementedBy<CookieManager>().LifeStyle.Is(LifestyleType.Transient),
Component.For<IJsonSerializer>().ImplementedBy<JsonSerializer>(),
Component.For<ILoanActionsUtility>().ImplementedBy<LoanActionsUtility>(),
// Default D.I. container
Component.For<IWindsorContainer>().Instance(container));
// Register AES web services
container.Install(new AESServicesBootstrapper.ApplicationInstaller());
}
#endregion
/// <summary>
/// Creates a WCF client for web services passing the token of the authenticated user from the cookie.
/// This method only creates the client/channel, it does not configure the connection settings,
/// those have to be defined by named endpoints on the web.config
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="endPointConfiguration">name of the endpoint on the web.config</param>
/// <returns></returns>
}
你可以讓你的標題和問題同意嗎? 「我們可以......」和「我們應該......」這兩個問題是不同的(當然,如果第一個答案是「否」,第二個問題是沒有意義的) –