public virtual async void TestGetNotFound()
        {
            var builder = new WebHostBuilder()
                          .UseEnvironment("Production")
                          .UseStartup <TestStartup>();
            TestServer testServer = new TestServer(builder);

            var client = new ApiClient(testServer.CreateClient());

            client.SetBearerToken(JWTTestHelper.GenerateBearerToken());
            ApiOfficerClientResponseModel response = await client.OfficerGetAsync(default(int));

            response.Should().BeNull();
        }
示例#2
0
        public void MapClientResponseToRequest()
        {
            var mapper = new ApiOfficerModelMapper();
            var model  = new ApiOfficerClientResponseModel();

            model.SetProperties(1, "A", "A", "A", "A", "A");
            ApiOfficerClientRequestModel response = mapper.MapClientResponseToRequest(model);

            response.Should().NotBeNull();
            response.Badge.Should().Be("A");
            response.Email.Should().Be("A");
            response.FirstName.Should().Be("A");
            response.LastName.Should().Be("A");
            response.Password.Should().Be("A");
        }
        public virtual async void TestGetFound()
        {
            var builder = new WebHostBuilder()
                          .UseEnvironment("Production")
                          .UseStartup <TestStartup>();
            TestServer testServer = new TestServer(builder);

            var client = new ApiClient(testServer.CreateClient());

            client.SetBearerToken(JWTTestHelper.GenerateBearerToken());
            ApplicationDbContext context = testServer.Host.Services.GetService(typeof(ApplicationDbContext)) as ApplicationDbContext;

            ApiOfficerClientResponseModel response = await client.OfficerGetAsync(1);

            response.Should().NotBeNull();
            response.Badge.Should().Be("A");
            response.Email.Should().Be("A");
            response.FirstName.Should().Be("A");
            response.Id.Should().Be(1);
            response.LastName.Should().Be("A");
            response.Password.Should().Be("A");
        }