示例#1
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;

            ApiCallClientResponseModel response = await client.CallGetAsync(1);

            response.Should().NotBeNull();
            response.AddressId.Should().Be(1);
            response.CallDispositionId.Should().Be(1);
            response.CallStatusId.Should().Be(1);
            response.CallString.Should().Be("A");
            response.CallTypeId.Should().Be(1);
            response.DateCleared.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.DateCreated.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.DateDispatched.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.Id.Should().Be(1);
            response.QuickCallNumber.Should().Be(1);
        }
示例#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());
            ApiCallClientResponseModel response = await client.CallGetAsync(default(int));

            response.Should().BeNull();
        }
        public void MapClientRequestToResponse()
        {
            var mapper = new ApiCallModelMapper();
            var model  = new ApiCallClientRequestModel();

            model.SetProperties(1, 1, 1, "A", 1, DateTime.Parse("1/1/1987 12:00:00 AM"), DateTime.Parse("1/1/1987 12:00:00 AM"), DateTime.Parse("1/1/1987 12:00:00 AM"), 1);
            ApiCallClientResponseModel response = mapper.MapClientRequestToResponse(1, model);

            response.Should().NotBeNull();
            response.AddressId.Should().Be(1);
            response.CallDispositionId.Should().Be(1);
            response.CallStatusId.Should().Be(1);
            response.CallString.Should().Be("A");
            response.CallTypeId.Should().Be(1);
            response.DateCleared.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.DateCreated.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.DateDispatched.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.QuickCallNumber.Should().Be(1);
        }