Exemple #1
0
        public void MapResponseToRequest()
        {
            var mapper = new ApiAddressTypeModelMapper();
            var model  = new ApiAddressTypeResponseModel();

            model.SetProperties(1, DateTime.Parse("1/1/1987 12:00:00 AM"), "A", Guid.Parse("8420cdcf-d595-ef65-66e7-dff9f98764da"));
            ApiAddressTypeRequestModel response = mapper.MapResponseToRequest(model);

            response.ModifiedDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.Name.Should().Be("A");
            response.Rowguid.Should().Be(Guid.Parse("8420cdcf-d595-ef65-66e7-dff9f98764da"));
        }
Exemple #2
0
        public async void TestUpdate()
        {
            var model = await this.CreateRecord();

            ApiAddressTypeModelMapper mapper = new ApiAddressTypeModelMapper();

            UpdateResponse <ApiAddressTypeResponseModel> updateResponse = await this.Client.AddressTypeUpdateAsync(model.AddressTypeID, mapper.MapResponseToRequest(model));

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

            await this.Cleanup();
        }
Exemple #3
0
        public void CreatePatch()
        {
            var mapper = new ApiAddressTypeModelMapper();
            var model  = new ApiAddressTypeRequestModel();

            model.SetProperties(DateTime.Parse("1/1/1987 12:00:00 AM"), "A", Guid.Parse("8420cdcf-d595-ef65-66e7-dff9f98764da"));

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

            patch.ApplyTo(response);
            response.ModifiedDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.Name.Should().Be("A");
            response.Rowguid.Should().Be(Guid.Parse("8420cdcf-d595-ef65-66e7-dff9f98764da"));
        }
        public async void TestUpdate()
        {
            var builder = new WebHostBuilder()
                          .UseEnvironment("Production")
                          .UseStartup <TestStartup>();
            TestServer testServer = new TestServer(builder);

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

            ApiAddressTypeResponseModel model = await client.AddressTypeGetAsync(1);

            ApiAddressTypeModelMapper mapper = new ApiAddressTypeModelMapper();

            UpdateResponse <ApiAddressTypeResponseModel> updateResponse = await client.AddressTypeUpdateAsync(model.AddressTypeID, mapper.MapResponseToRequest(model));

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