當前位置: 首頁>>代碼示例>>C#>>正文


C# Testing.BrowserResponse類代碼示例

本文整理匯總了C#中Nancy.Testing.BrowserResponse的典型用法代碼示例。如果您正苦於以下問題:C# BrowserResponse類的具體用法?C# BrowserResponse怎麽用?C# BrowserResponse使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


BrowserResponse類屬於Nancy.Testing命名空間,在下文中一共展示了BrowserResponse類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: 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

示例2: App

 public App(BrowserResponse response, FakeCommandSender commandSender = null)
 {
     if (commandSender != null)
     {
         Dispatched = new List<object>(commandSender.SentCommands).AsReadOnly();
     }
     Response = response;
 }
開發者ID:haf,項目名稱:derp.inventory,代碼行數:8,代碼來源:App.cs

示例3: Observe

        public override void Observe()
        {
            base.RefreshDb();

            Container.Install(new BusInstaller(), new RepositoryInstaller(), new CommandInstaller());

            var state = StateMother.Draft;
            SaveAndFlush(state, StateMother.Published);



            var id = GetFromDb(state).Id;
            _browser = new Browser(with =>
            {
                with.Module(new StateModule(Container.Resolve<IPublishStorableCommands>(), Container.Resolve<IRepository<State>>()));
            });

            Session.FlushMode = FlushMode.Never;

            //Transaction(x =>
            //{
            _response = _browser.Post("/State/Edit", with =>
            {
                with.HttpRequest();
                with.Body("{ 'id': '" + id + "', 'name': 'Draft', 'alias': 'Test Draft'}");
                with.Header("content-type", "application/json");
                //with.Header("Authorization", "ApiKey 4E7106BA-16B6-44F2-AF4C-D1C411440F8E");
            });
            //});

            Session.Flush();
            // Session.Close();
        }
開發者ID:rjonker1,項目名稱:lightstone-data-platform,代碼行數:33,代碼來源:when_invoking_state_edit_route.cs

示例4: HomeModule

 public void HomeModule()
 {
     browser = new Browser (with => with.Module (new HomeModule ()));
     result = browser.Get ("/", with => {
         with.HttpRequest ();
     });
 }
開發者ID:chrlapointe,項目名稱:yosethegame-dotnet-nancy,代碼行數:7,代碼來源:HomeTest.cs

示例5: SetUp

        public void SetUp()
        {
            _server = new Browser(new ServerBootstrapper());

            sampleConfig = TestHelper.GetSampleConfig();
            environmentConfig = TestHelper.GetEnvironmentOverrideConfig();

            setConfigResponse = _server.Post("application/new", context =>
            {
                context.HttpRequest();
                context.JsonBody(sampleConfig as object);
            });

            setEnvironmentConfigResponse = _server.Post("application/new", context =>
            {
                context.HttpRequest();
                context.JsonBody(environmentConfig as object);
                context.Query(TestHelper.Environment, "test");
            });

            getCreatedEnvironmentConfigResponse = _server.Get("application/new", context =>
            {
                context.Query(TestHelper.Environment, "test");
            });

            getEnvironmentConfigResult = getCreatedEnvironmentConfigResponse.Body.AsJson();
        }
開發者ID:cimdalli,項目名稱:DynamicConfigurator,代碼行數:27,代碼來源:with_environment_data.cs

示例6: GetRootTests

 public GetRootTests()
 {
     _response = _browser.Get("/", with =>
     {
         with.HttpRequest();
     });
 }
開發者ID:nchabelengmc,項目名稱:silverpop-dotnet-api,代碼行數:7,代碼來源:HomeModuleTests.cs

示例7: SetUp

        public void SetUp()
        {
            var bootstrapper = new AppBootstrapper();
            var browser = new Browser(bootstrapper);
            bootstrapper.Initialise();

            _result = browser.Get("/", with => with.HttpRequest());
        }
開發者ID:hauptmann,項目名稱:GestUAB,代碼行數:8,代碼來源:When_requesting_root_page.cs

示例8: When_an_error_message_is_present

 public When_an_error_message_is_present()
 {
     _Browser = Testing.CreateBrowser<PagesModule>(with =>
     {
         with.Session(SessionKeys.FLASH_ERROR, "There was an error!");
     });
     _Response = _Browser.Get("/");
 }
開發者ID:nterry,項目名稱:Apphbify,代碼行數:8,代碼來源:When_an_error_message_is_present.cs

示例9: When_user_is_logged_on

 public When_user_is_logged_on()
 {
     _Browser = Testing.CreateBrowser<PagesModule>(with =>
     {
         with.LoggedInUser();
     });
     _Response = _Browser.Get("/");
 }
開發者ID:nterry,項目名稱:Apphbify,代碼行數:8,代碼來源:When_user_is_logged_on.cs

示例10: When_no_payload_is_sent

 public When_no_payload_is_sent()
 {
     _Browser = Testing.CreateBrowser<HookModule>();
     _Response = _Browser.Post("/Sites/foofoo/NotifyByEmail", with =>
     {
         with.Query("email", "[email protected]");
     });
 }
開發者ID:nterry,項目名稱:Apphbify,代碼行數:8,代碼來源:When_no_payload_is_sent.cs

示例11: When_deploying_an_app_that_doesnt_exist

 public When_deploying_an_app_that_doesnt_exist()
 {
     _Browser = Testing.CreateBrowser<SecuredPagesModule>(with =>
     {
         with.LoggedInUser();
     });
     _Response = _Browser.Post("/Deploy/foofoo");
 }
開發者ID:nterry,項目名稱:Apphbify,代碼行數:8,代碼來源:When_deploying_an_app_that_doesnt_exist.cs

示例12: When_displaying_the_deploy_page

 public When_displaying_the_deploy_page()
 {
     _Browser = Testing.CreateBrowser<SecuredPagesModule>(with =>
     {
         with.LoggedInUser();
     });
     _Response = _Browser.Get("/Deploy/jabbr");
 }
開發者ID:nterry,項目名稱:Apphbify,代碼行數:8,代碼來源:When_displaying_the_deploy_page.cs

示例13: When_user_signs_out

 public When_user_signs_out()
 {
     _Browser = Testing.CreateBrowser<OAuthModule>(with =>
     {
         with.LoggedInUser();
     });
     _Response = _Browser.Get("/SignOut");
 }
開發者ID:nterry,項目名稱:Apphbify,代碼行數:8,代碼來源:When_user_signs_out.cs

示例14: When_a_success_message_is_present

 public When_a_success_message_is_present()
 {
     _Browser = Testing.CreateBrowser<PagesModule>(with =>
     {
         with.Session(SessionKeys.FLASH_SUCCESS, "All done!");
     });
     _Response = _Browser.Get("/");
 }
開發者ID:nterry,項目名稱:Apphbify,代碼行數:8,代碼來源:When_a_success_message_is_present.cs

示例15: when_posting_a_new_idea

 public when_posting_a_new_idea()
 {
     mockUsersRepo.Setup(d => d.GetUserFromIdentifier(user.Id)).Returns(user);
     response = browser.Post("/api/ideas", with => {
         with.JsonBody(new { title = "Test" });
         with.LoggedInUser(user);
     });
 }
開發者ID:vkoppaka,項目名稱:Ideastrike,代碼行數:8,代碼來源:when_posting_a_new_idea.cs


注:本文中的Nancy.Testing.BrowserResponse類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。