예제 #1
0
        public void MapResponseToRequest()
        {
            var mapper = new ApiSalesReasonModelMapper();
            var model  = new ApiSalesReasonResponseModel();

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

            response.ModifiedDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.Name.Should().Be("A");
            response.ReasonType.Should().Be("A");
        }
        public async void TestUpdate()
        {
            var model = await this.CreateRecord();

            ApiSalesReasonModelMapper mapper = new ApiSalesReasonModelMapper();

            UpdateResponse <ApiSalesReasonResponseModel> updateResponse = await this.Client.SalesReasonUpdateAsync(model.SalesReasonID, mapper.MapResponseToRequest(model));

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

            await this.Cleanup();
        }
예제 #3
0
        public void CreatePatch()
        {
            var mapper = new ApiSalesReasonModelMapper();
            var model  = new ApiSalesReasonRequestModel();

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

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

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

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

            ApiSalesReasonResponseModel model = await client.SalesReasonGetAsync(1);

            ApiSalesReasonModelMapper mapper = new ApiSalesReasonModelMapper();

            UpdateResponse <ApiSalesReasonResponseModel> updateResponse = await client.SalesReasonUpdateAsync(model.SalesReasonID, mapper.MapResponseToRequest(model));

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