public void GetUsers_should_thow_UnauthorizedSecurityException() { // arrange NancyWebAppConfig.IdentityServerEnabled = true; var server = new TestServer(new WebHostBuilder().Configure(app => app.UseOwin().UseNancy())); var client = new BasicClient(server.CreateClient(), "client", "secret"); IEnumerable <User> result = null; this.Invoking((a) => { // act result = client.GetUsers().RunAsSynchronous(); }) // assert .ShouldThrow <SecurityException>(); }
public void GetUsers_should_be_Ok() { // arrange NancyWebAppConfig.IdentityServerEnabled = false; var server = new TestServer(new WebHostBuilder().UseStartup(typeof(Startup))); var client = new BasicClient(server.CreateClient(), "client", "secret"); IEnumerable <User> result = null; this.Invoking((a) => { // act result = client.GetUsers().RunAsSynchronous(); }) // assert .ShouldNotThrow(); result.Should().NotBeNull(); result.Count().Should().BeGreaterThan(0); }