コード例 #1
0
        public void ClientControllerTestStart()
        {
            IUnityContainer container = TestBootstrapper.Initialise();

            this.ProjectService = container.Resolve <IProjectService>();
            this.controller     = new ProjectController(this.ProjectService);
        }
 public void GetEngine_ReturnsEngine()
 {
     var bootstrapper = new TestBootstrapper();
     bootstrapper.Initialise();
     var engine = bootstrapper.GetEngine();
     Assert.NotNull(engine);
 }
 public void GetAllModules_ReturnsModules()
 {
     var bootstrapper = new TestBootstrapper();
     bootstrapper.Initialise();
     bootstrapper.GetEngine();
     var modules = bootstrapper.GetAllModules(new NancyContext());
     Assert.True(modules.Any());
 }
 public void GetModule_ReturnsModule()
 {
     var bootstrapper = new TestBootstrapper();            
     bootstrapper.Initialise();
     bootstrapper.GetEngine();
     INancyModule module = bootstrapper.GetModule(typeof(SampleModule), new NancyContext());
     Assert.IsType(typeof(SampleModule), module);
 }
コード例 #5
0
        public void ClientControllerTestStart()
        {
            IUnityContainer container = TestBootstrapper.Initialise();

            this.ClientProfileVMService = container.Resolve <IClientProfileVMServices>();
            this.MembershipService      = container.Resolve <IMembership>();
            this.UserModelService       = container.Resolve <IUserModelService>();
            controller = new ClientController(this.ClientProfileVMService, this.MembershipService, this.UserModelService);
        }
 public void GetModule_PerRequestDependency_ReturnsModule()
 {
     var bootstrapper = new TestBootstrapper();
     bootstrapper.Initialise();
     bootstrapper.GetEngine();
     var module = (SampleModuleWithPerRequestDependency)bootstrapper.GetModule(
         typeof(SampleModuleWithPerRequestDependency),
         new NancyContext());
     Assert.IsType(typeof(PerRequest), module.PerRequest);
 }
 public void GetModule_DisposableTransientDependency_ReturnsModule()
 {
     var bootstrapper = new TestBootstrapper();
     bootstrapper.Initialise();
     bootstrapper.GetEngine();
     var module = (SampleModuleWithDisposableTransientDependency)bootstrapper.GetModule(
         typeof(SampleModuleWithDisposableTransientDependency),
         new NancyContext());
     Assert.IsType(typeof(DisposableTransient), module.Transient);
 }
コード例 #8
0
        public DatabaseFixture()
        {
            var bootstrapper = new TestBootstrapper();

            bootstrapper.Initialise();

            Shell      = (TestShell)SimpleIoc.Default.GetInstance <IShell>();
            Navigation = (TestNavigationService)SimpleIoc.Default.GetInstance <INavigationService>();
            Dialog     = (TestDialogService)SimpleIoc.Default.GetInstance <IDialogService>();

            _contextFunc = SimpleIoc.Default.GetInstance <IDatabaseContextService>().GetContext();
            _contextFunc.Invoke().Database.EnsureDeleted();
            _contextFunc.Invoke().Database.EnsureCreated();
        }
 public void GetEngine_RegistersRequestStartup()
 {
     var bootstrapper = new TestBootstrapper();
     bootstrapper.Initialise();
     var engine = bootstrapper.GetEngine();
     engine.HandleRequest(new Request("Post", "Sample", "http"));
 }
コード例 #10
0
 private static TestBootstrapper CreateBootstrapper()
 {
     var bootstrapper = new TestBootstrapper();
     bootstrapper.Initialise();
     bootstrapper.GetEngine();
     return bootstrapper;
 }