Ejemplo n.º 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());
            ApiEmailClientResponseModel response = await client.EmailGetAsync(default(int));

            response.Should().BeNull();
        }
Ejemplo n.º 2
0
        public void MapClientRequestToResponse()
        {
            var mapper = new ApiEmailModelMapper();
            var model  = new ApiEmailClientRequestModel();

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

            response.Should().NotBeNull();
            response.ArtistId.Should().Be(1);
            response.DateCreated.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.EmailValue.Should().Be("A");
        }
Ejemplo n.º 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());
            ApplicationDbContext context = testServer.Host.Services.GetService(typeof(ApplicationDbContext)) as ApplicationDbContext;

            ApiEmailClientResponseModel response = await client.EmailGetAsync(1);

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