本文整理汇总了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");
});
}
示例2: App
public App(BrowserResponse response, FakeCommandSender commandSender = null)
{
if (commandSender != null)
{
Dispatched = new List<object>(commandSender.SentCommands).AsReadOnly();
}
Response = response;
}
示例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();
}
示例4: HomeModule
public void HomeModule()
{
browser = new Browser (with => with.Module (new HomeModule ()));
result = browser.Get ("/", with => {
with.HttpRequest ();
});
}
示例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();
}
示例6: GetRootTests
public GetRootTests()
{
_response = _browser.Get("/", with =>
{
with.HttpRequest();
});
}
示例7: SetUp
public void SetUp()
{
var bootstrapper = new AppBootstrapper();
var browser = new Browser(bootstrapper);
bootstrapper.Initialise();
_result = browser.Get("/", with => with.HttpRequest());
}
示例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("/");
}
示例9: When_user_is_logged_on
public When_user_is_logged_on()
{
_Browser = Testing.CreateBrowser<PagesModule>(with =>
{
with.LoggedInUser();
});
_Response = _Browser.Get("/");
}
示例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]");
});
}
示例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");
}
示例12: When_displaying_the_deploy_page
public When_displaying_the_deploy_page()
{
_Browser = Testing.CreateBrowser<SecuredPagesModule>(with =>
{
with.LoggedInUser();
});
_Response = _Browser.Get("/Deploy/jabbr");
}
示例13: When_user_signs_out
public When_user_signs_out()
{
_Browser = Testing.CreateBrowser<OAuthModule>(with =>
{
with.LoggedInUser();
});
_Response = _Browser.Get("/SignOut");
}
示例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("/");
}
示例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);
});
}