예제 #1
0
        public void MapClientResponseToRequest()
        {
            var mapper = new ApiSaleModelMapper();
            var model  = new ApiSaleClientResponseModel();

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

            response.Should().NotBeNull();
            response.CustomerId.Should().Be(1);
            response.Date.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
        }
예제 #2
0
        public async void TestUpdate()
        {
            var model = await this.CreateRecord();

            ApiSaleModelMapper mapper = new ApiSaleModelMapper();

            UpdateResponse <ApiSaleResponseModel> updateResponse = await this.Client.SaleUpdateAsync(model.Id, mapper.MapResponseToRequest(model));

            updateResponse.Record.Should().NotBeNull();
            updateResponse.Success.Should().BeTrue();

            await this.Cleanup();
        }
예제 #3
0
        public void MapResponseToRequest()
        {
            var mapper = new ApiSaleModelMapper();
            var model  = new ApiSaleResponseModel();

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

            response.IpAddress.Should().Be("A");
            response.Note.Should().Be("A");
            response.SaleDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.TransactionId.Should().Be(1);
        }
예제 #4
0
        public void MapResponseToRequest()
        {
            var mapper = new ApiSaleModelMapper();
            var model  = new ApiSaleResponseModel();

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

            response.Amount.Should().Be(1m);
            response.ClientId.Should().Be(1);
            response.Note.Should().Be("A");
            response.PetId.Should().Be(1);
            response.SaleDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.SalesPersonId.Should().Be(1);
        }
예제 #5
0
        public void MapResponseToRequest()
        {
            var mapper = new ApiSaleModelMapper();
            var model  = new ApiSaleResponseModel();

            model.SetProperties(1, 1m, "A", "A", 1, 1, "A");
            ApiSaleRequestModel response = mapper.MapResponseToRequest(model);

            response.Amount.Should().Be(1m);
            response.FirstName.Should().Be("A");
            response.LastName.Should().Be("A");
            response.PaymentTypeId.Should().Be(1);
            response.PetId.Should().Be(1);
            response.Phone.Should().Be("A");
        }
예제 #6
0
        public void CreatePatch()
        {
            var mapper = new ApiSaleModelMapper();
            var model  = new ApiSaleRequestModel();

            model.SetProperties("A", "A", DateTime.Parse("1/1/1987 12:00:00 AM"), 1);

            JsonPatchDocument <ApiSaleRequestModel> patch = mapper.CreatePatch(model);
            var response = new ApiSaleRequestModel();

            patch.ApplyTo(response);
            response.IpAddress.Should().Be("A");
            response.Note.Should().Be("A");
            response.SaleDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.TransactionId.Should().Be(1);
        }
예제 #7
0
        public async void TestUpdate()
        {
            var builder = new WebHostBuilder()
                          .UseEnvironment("Production")
                          .UseStartup <TestStartup>();
            TestServer testServer = new TestServer(builder);

            var client = new ApiClient(testServer.CreateClient());

            ApiSaleResponseModel model = await client.SaleGetAsync(1);

            ApiSaleModelMapper mapper = new ApiSaleModelMapper();

            UpdateResponse <ApiSaleResponseModel> updateResponse = await client.SaleUpdateAsync(model.Id, mapper.MapResponseToRequest(model));

            updateResponse.Record.Should().NotBeNull();
            updateResponse.Success.Should().BeTrue();
        }
예제 #8
0
        public void CreatePatch()
        {
            var mapper = new ApiSaleModelMapper();
            var model  = new ApiSaleRequestModel();

            model.SetProperties(1m, 1, "A", 1, DateTime.Parse("1/1/1987 12:00:00 AM"), 1);

            JsonPatchDocument <ApiSaleRequestModel> patch = mapper.CreatePatch(model);
            var response = new ApiSaleRequestModel();

            patch.ApplyTo(response);
            response.Amount.Should().Be(1m);
            response.ClientId.Should().Be(1);
            response.Note.Should().Be("A");
            response.PetId.Should().Be(1);
            response.SaleDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.SalesPersonId.Should().Be(1);
        }
예제 #9
0
        public void CreatePatch()
        {
            var mapper = new ApiSaleModelMapper();
            var model  = new ApiSaleRequestModel();

            model.SetProperties(1m, "A", "A", 1, 1, "A");

            JsonPatchDocument <ApiSaleRequestModel> patch = mapper.CreatePatch(model);
            var response = new ApiSaleRequestModel();

            patch.ApplyTo(response);
            response.Amount.Should().Be(1m);
            response.FirstName.Should().Be("A");
            response.LastName.Should().Be("A");
            response.PaymentTypeId.Should().Be(1);
            response.PetId.Should().Be(1);
            response.Phone.Should().Be("A");
        }