public void MapClientRequestToResponse()
        {
            var mapper = new ApiSaleTicketsModelMapper();
            var model  = new ApiSaleTicketsClientRequestModel();

            model.SetProperties(1, 1);
            ApiSaleTicketsClientResponseModel response = mapper.MapClientRequestToResponse(1, model);

            response.Should().NotBeNull();
            response.SaleId.Should().Be(1);
            response.TicketId.Should().Be(1);
        }
Beispiel #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());
            ApiSaleTicketsClientResponseModel response = await client.SaleTicketsGetAsync(default(int));

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

            ApiSaleTicketsClientResponseModel response = await client.SaleTicketsGetAsync(1);

            response.Should().NotBeNull();
            response.Id.Should().Be(1);
            response.SaleId.Should().Be(1);
            response.TicketId.Should().Be(1);
        }