示例#1
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());
            ApiCustomerCommunicationClientResponseModel response = await client.CustomerCommunicationGetAsync(default(int));

            response.Should().BeNull();
        }
        public void MapClientResponseToRequest()
        {
            var mapper = new ApiCustomerCommunicationModelMapper();
            var model  = new ApiCustomerCommunicationClientResponseModel();

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

            response.Should().NotBeNull();
            response.CustomerId.Should().Be(1);
            response.DateCreated.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.EmployeeId.Should().Be(1);
            response.Notes.Should().Be("A");
        }
示例#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;

            ApiCustomerCommunicationClientResponseModel response = await client.CustomerCommunicationGetAsync(1);

            response.Should().NotBeNull();
            response.CustomerId.Should().Be(1);
            response.DateCreated.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.EmployeeId.Should().Be(1);
            response.Id.Should().Be(1);
            response.Notes.Should().Be("A");
        }