public void MapClientRequestToResponse()
        {
            var mapper = new ApiCallPersonModelMapper();
            var model  = new ApiCallPersonClientRequestModel();

            model.SetProperties("A", 1, 1);
            ApiCallPersonClientResponseModel response = mapper.MapClientRequestToResponse(1, model);

            response.Should().NotBeNull();
            response.Note.Should().Be("A");
            response.PersonId.Should().Be(1);
            response.PersonTypeId.Should().Be(1);
        }
Example #2
0
        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());
            ApiCallPersonClientResponseModel response = await client.CallPersonGetAsync(default(int));

            response.Should().BeNull();
        }
Example #3
0
        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;

            ApiCallPersonClientResponseModel response = await client.CallPersonGetAsync(1);

            response.Should().NotBeNull();
            response.Id.Should().Be(1);
            response.Note.Should().Be("A");
            response.PersonId.Should().Be(1);
            response.PersonTypeId.Should().Be(1);
        }