public void MapResponseToRequest() { var mapper = new ApiProductSubcategoryModelMapper(); var model = new ApiProductSubcategoryResponseModel(); model.SetProperties(1, DateTime.Parse("1/1/1987 12:00:00 AM"), "A", 1, Guid.Parse("8420cdcf-d595-ef65-66e7-dff9f98764da")); ApiProductSubcategoryRequestModel response = mapper.MapResponseToRequest(model); response.ModifiedDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM")); response.Name.Should().Be("A"); response.ProductCategoryID.Should().Be(1); response.Rowguid.Should().Be(Guid.Parse("8420cdcf-d595-ef65-66e7-dff9f98764da")); }
public async void TestUpdate() { var model = await this.CreateRecord(); ApiProductSubcategoryModelMapper mapper = new ApiProductSubcategoryModelMapper(); UpdateResponse <ApiProductSubcategoryResponseModel> updateResponse = await this.Client.ProductSubcategoryUpdateAsync(model.ProductSubcategoryID, mapper.MapResponseToRequest(model)); updateResponse.Record.Should().NotBeNull(); updateResponse.Success.Should().BeTrue(); await this.Cleanup(); }
public void CreatePatch() { var mapper = new ApiProductSubcategoryModelMapper(); var model = new ApiProductSubcategoryRequestModel(); model.SetProperties(DateTime.Parse("1/1/1987 12:00:00 AM"), "A", 1, Guid.Parse("8420cdcf-d595-ef65-66e7-dff9f98764da")); JsonPatchDocument <ApiProductSubcategoryRequestModel> patch = mapper.CreatePatch(model); var response = new ApiProductSubcategoryRequestModel(); patch.ApplyTo(response); response.ModifiedDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM")); response.Name.Should().Be("A"); response.ProductCategoryID.Should().Be(1); 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()); ApiProductSubcategoryResponseModel model = await client.ProductSubcategoryGetAsync(1); ApiProductSubcategoryModelMapper mapper = new ApiProductSubcategoryModelMapper(); UpdateResponse <ApiProductSubcategoryResponseModel> updateResponse = await client.ProductSubcategoryUpdateAsync(model.ProductSubcategoryID, mapper.MapResponseToRequest(model)); updateResponse.Record.Should().NotBeNull(); updateResponse.Success.Should().BeTrue(); }