当前位置: 首页>>代码示例>>C#>>正文


C# ConfigurableBootstrapper类代码示例

本文整理汇总了C#中ConfigurableBootstrapper的典型用法代码示例。如果您正苦于以下问题:C# ConfigurableBootstrapper类的具体用法?C# ConfigurableBootstrapper怎么用?C# ConfigurableBootstrapper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ConfigurableBootstrapper类属于命名空间,在下文中一共展示了ConfigurableBootstrapper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SerializerTests

        public SerializerTests()
        {
            this.bootstrapper = new ConfigurableBootstrapper(
                configuration => configuration.Modules(new Type[] { typeof(SerializerTestModule) }));

            this.browser = new Browser(bootstrapper);
        }
开发者ID:afwilliams,项目名称:Nancy,代码行数:7,代码来源:SerializerTests.cs

示例2: GET_Given_An_Url_Shortened_Should_Return_Data_Of_The_Url

        public void GET_Given_An_Url_Shortened_Should_Return_Data_Of_The_Url()
        {
            //Arrange
            var url = new Model.Url("http://www.2dsolucoes.net");
            var repository = new StubUrlStorage(url);
            var bootstrapper = new ConfigurableBootstrapper(with =>
            {
                with.Dependency<IUrlStorage>(repository);
            });
            var browser = new Browser(bootstrapper);

            //Act
            var urlAPI = string.Format("/urls/{0}", url.Short);
            var response = browser.Get(urlAPI, ctx =>
            {
                ctx.HttpRequest();
            });

            dynamic result = response.Body.ToDynamic();

            //Assert
            Assert.That(response.StatusCode, Is.EqualTo(HttpStatusCode.OK));
            Assert.That((string)result.Source, Is.EqualTo(url.Source));
            Assert.That((string)result.Short, Is.EqualTo(url.Short));
        }
开发者ID:diegodfsd,项目名称:UrlShortener,代码行数:25,代码来源:ShortenerModuleTests.cs

示例3: BrowserFixture

        public BrowserFixture()
        {
            var bootstrapper =
                new ConfigurableBootstrapper();

            this.browser = new Browser(bootstrapper);
        }
开发者ID:nathanpalmer,项目名称:Nancy,代码行数:7,代码来源:BrowserFixture.cs

示例4: Should_return_main_page_with_valid_auth_cookie

        public void Should_return_main_page_with_valid_auth_cookie()
        {
            // Given
            var bootstrapper = new ConfigurableBootstrapper(with =>
            {
                with.Configure(env =>
                {
                    env.Diagnostics(
                        password: "password",
                        cryptographyConfiguration: this.cryptoConfig);
                });

                with.EnableAutoRegistration();
                with.Diagnostics<FakeDiagnostics>();
            });

            var browser = new Browser(bootstrapper);

            // When
            var result = browser.Get(DiagnosticsConfiguration.Default.Path + "/interactive/providers/", with =>
                {
                    with.Cookie(DiagsCookieName, this.GetSessionCookieValue("password"));
                });

            // Then should see our fake provider and not the default testing provider
            result.Body.AsString().ShouldContain("Fake testing provider");
            result.Body.AsString().ShouldNotContain("Testing Diagnostic Provider");
        }
开发者ID:rahulchrty,项目名称:Nancy,代码行数:28,代码来源:CustomInteractiveDiagnosticsFixture.cs

示例5: Should_return_info_page_if_password_empty

        public async Task Should_return_info_page_if_password_empty()
        {
            // Given
            var bootstrapper = new ConfigurableBootstrapper(with =>
            {
                with.Configure(env =>
                {
                    env.Diagnostics(
                        enabled: true,
                        password: string.Empty,
                        cryptographyConfiguration: this.cryptoConfig);
                });

                with.EnableAutoRegistration();
                with.Diagnostics<DefaultDiagnostics>();
            });

            var browser = new Browser(bootstrapper);

            // When
            var result = await browser.Get(DiagnosticsConfiguration.Default.Path);

            // Then
            Assert.True(result.Body.AsString().Contains("Diagnostics Disabled"));
        }
开发者ID:VPashkov,项目名称:Nancy,代码行数:25,代码来源:DiagnosticsHookFixture.cs

示例6: Should_fail_to_resolve_route_because_it_does_have_an_invalid_condition

        public void Should_fail_to_resolve_route_because_it_does_have_an_invalid_condition()
        {
            // Given
            var cache = new FakeRouteCache(with => {
                with.AddGetRoute("/invalidcondition", "modulekey", ctx => false);
            });

            var bootstrapper = new ConfigurableBootstrapper(with =>{
                with.RouteCache(cache);
            });

            var browser = new Browser(bootstrapper);

            // When
            var timer = new Stopwatch();
            timer.Start();

            for (var i = 0; i < numberOfTimesToResolveRoute; i++)
            {
                var result = browser.Get("/invalidcondition");
                result.StatusCode.ShouldEqual(HttpStatusCode.NotFound);
            }

            timer.Stop();

            // Then
            Debug.WriteLine(" took {0} to execute {1} times", timer.Elapsed, numberOfTimesToResolveRoute);
        }
开发者ID:felbus,项目名称:Nancy,代码行数:28,代码来源:DefaultRouteResolverPerformanceFixture.cs

示例7: SetUp

		public void SetUp()
		{
			_fakeShortener = new FakeShortener();

			_bootstrapper = new ConfigurableBootstrapper(with => with.Dependency(_fakeShortener));
			_browser = new Browser(_bootstrapper);
		}
开发者ID:Dotnetwill,项目名称:vfy.be,代码行数:7,代码来源:SiteTests.cs

示例8: SetUpBase

        public void SetUpBase()
        {
            this.ContentRepository = MockRepository.GenerateMock<IContentRepository>();
            this.ComponentLibrary = MockRepository.GenerateMock<IComponentSpecificationLibrary>();
            this.KolaConfigurationRegistry = MockRepository.GenerateMock<IKolaConfigurationRegistry>();
            this.DynamicSourceProvider = MockRepository.GenerateMock<IDynamicSourceProvider>();

            var bootstrapper = new ConfigurableBootstrapper(
                with =>
                    {
                        with.Dependency(this.ContentRepository);
                        with.Dependency(this.ComponentLibrary);
                        with.Dependency(this.KolaConfigurationRegistry);
                        with.Dependency(this.DynamicSourceProvider);
                        with.Dependency<TemplateResourceBuilder>();
                        with.Dependency<AmendmentDetailsResourceBuilder>();
                        with.Dependency<PathInstanceBuilder>();
                        with.Dependency<AmendmentsDetailsResourceBuilder>();
                        with.Dependency<UndoAmendmentDetailsResourceBuilder>();
                        with.Dependency<ComponentDetailsResourceBuilder>();
                        with.ResponseProcessor<TemplateJsonResultProcessor>();
                        with.ResponseProcessor<AmendmentDetailsJsonResultProcessor>();
                        with.ResponseProcessor<AmendmentsDetailsJsonResultProcessor>();
                        with.ResponseProcessor<UndoAmendmentDetailsJsonResultProcessor>();
                        with.ResponseProcessor<ComponentDetailsJsonResultProcessor>();
                        with.Dependency<TemplateService>();
                        with.Module<TemplateModule>();
                    });

            this.Browser = new Browser(bootstrapper);
        }
开发者ID:mr-sandy,项目名称:kola,代码行数:31,代码来源:ContextBase.cs

示例9: FixtureSetup

 public void FixtureSetup()
 {
     var formsAuthenticationConfiguration = new FormsAuthenticationConfiguration()
         {
             RedirectUrl = "~/login",
             UserMapper = new FakeUserMapper(new UserService())
         };
     var configuration = A.Fake<IRazorConfiguration>();
     var bootstrapper = new ConfigurableBootstrapper(config =>
         {
             config.Module<UsersModule>();
             config.Module<LoginModule>();
             config.ViewEngine(new RazorViewEngine(configuration));
         });
     var bootstrapper2 = new ConfigurableBootstrapper(config =>
         {
             config.Module<UsersModule>();
             config.Module<LoginModule>();
             config.ViewEngine(new RazorViewEngine(configuration));
             config.RequestStartup((x, pipelines, z) => FormsAuthentication.Enable(pipelines, formsAuthenticationConfiguration));
         });
     _notLoggedInBrowser = new Browser(bootstrapper);
     _loggedInBrowserResponse = new Browser(bootstrapper2).Post("/login", x =>
         {
             x.HttpRequest();
             x.FormValue("Username", "Chris1");
             x.FormValue("Password", "123");
         });
 }
开发者ID:chrissie1,项目名称:NancyVB,代码行数:29,代码来源:TestUsersModule.cs

示例10: AbsoluteUrlTests

        public AbsoluteUrlTests()
        {
            this.bootstrapper = new ConfigurableBootstrapper(
                    configuration => configuration.Modules(new Type[] { typeof(AbsoluteUrlTestModule) }));

            this.browser = new Browser(bootstrapper);
        }
开发者ID:RadifMasud,项目名称:Nancy,代码行数:7,代码来源:AbsoluteUrlTests.cs

示例11: Should_find_usages_of_class

        public void Should_find_usages_of_class()
        {
            const string editorText = 
@"public class myclass
{
    public void method() { }

    public void method_calling_method()
    {
        method();        
    }
}
";
            var solution = new FakeSolution();
            var project = new FakeProject();
            project.AddFile(editorText);
            solution.Projects.Add(project);

            var bootstrapper = new ConfigurableBootstrapper(c => c.Dependency<ISolution>(solution));
            var browser = new Browser(bootstrapper);

            var result = browser.Post("/findusages", with =>
            {
                with.HttpRequest();
                with.FormValue("FileName", "myfile");
                with.FormValue("Line", "3");
                with.FormValue("Column", "21");
                with.FormValue("Buffer", editorText);
            });

            var usages = result.Body.DeserializeJson<FindUsagesResponse>().Usages.ToArray();
            usages.Count().ShouldEqual(2);
            usages[0].Text.Trim().ShouldEqual("public void method() { }");
            usages[1].Text.Trim().ShouldEqual("method();");
        }
开发者ID:dykim07,项目名称:vim-ide,代码行数:35,代码来源:IntegrationTest.cs

示例12: When_enabling_sessions

 public When_enabling_sessions()
 {
     _Bootstrapper = new ConfigurableBootstrapper(with =>
     {
         with.DisableAutoRegistration();
     });
     KeyValueStoreSessions.Enable(_Bootstrapper, A.Fake<IKeyValueStore>());
 }
开发者ID:csainty,项目名称:Nancy.Redis,代码行数:8,代码来源:When_enabling_sessions.cs

示例13: Nsub_WithBootstrapper_GetCalled

 public void Nsub_WithBootstrapper_GetCalled()
 {
     this.task.GetValue().Returns("i did not fail");
     var bs = new ConfigurableBootstrapper(
         with => { with.Dependency(this.task).Module<IndexModule>(); });
     var browser = new Browser(bs);
     var actual = browser.Get("/");
     Assert.That(actual.Body.AsString(), Is.EqualTo("i did not fail"));
 }
开发者ID:ehvattum,项目名称:nancytests,代码行数:9,代码来源:InjectionTests.cs

示例14: PartialRenderingFixture

        public PartialRenderingFixture()
        {
            var bootstrapper = new ConfigurableBootstrapper(with => {
                with.Module<PartialRenderingModule>();
            });

            this.browser =
                new Browser(bootstrapper);
        }
开发者ID:VPashkov,项目名称:Nancy,代码行数:9,代码来源:PartialRenderingFixture.cs

示例15: CaseSensitivityFixture

        public CaseSensitivityFixture()
        {
            var bootstrapper = new ConfigurableBootstrapper(with =>
            {
                with.Module<MainModule>();
            });

            this.browser = new Browser(bootstrapper);
        }
开发者ID:jeremymeng,项目名称:Nancy,代码行数:9,代码来源:CaseSensitivityFixture.cs


注:本文中的ConfigurableBootstrapper类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。