public void MapResponseToRequest()
        {
            var mapper = new ApiDepartmentModelMapper();
            var model  = new ApiDepartmentResponseModel();

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

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

            ApiDepartmentModelMapper mapper = new ApiDepartmentModelMapper();

            UpdateResponse <ApiDepartmentResponseModel> updateResponse = await this.Client.DepartmentUpdateAsync(model.DepartmentID, mapper.MapResponseToRequest(model));

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

            await this.Cleanup();
        }
예제 #3
0
        public async void TestUpdate()
        {
            var builder = new WebHostBuilder()
                          .UseEnvironment("Production")
                          .UseStartup <TestStartup>();
            TestServer testServer = new TestServer(builder);

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

            ApiDepartmentResponseModel model = await client.DepartmentGetAsync(1);

            ApiDepartmentModelMapper mapper = new ApiDepartmentModelMapper();

            UpdateResponse <ApiDepartmentResponseModel> updateResponse = await client.DepartmentUpdateAsync(model.DepartmentID, mapper.MapResponseToRequest(model));

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