public async void TestUpdate() { var model = await this.CreateRecord(); ApiProductPhotoModelMapper mapper = new ApiProductPhotoModelMapper(); UpdateResponse <ApiProductPhotoResponseModel> updateResponse = await this.Client.ProductPhotoUpdateAsync(model.ProductPhotoID, mapper.MapResponseToRequest(model)); updateResponse.Record.Should().NotBeNull(); updateResponse.Success.Should().BeTrue(); await this.Cleanup(); }
public void MapResponseToRequest() { var mapper = new ApiProductPhotoModelMapper(); var model = new ApiProductPhotoResponseModel(); model.SetProperties(1, BitConverter.GetBytes(1), "A", DateTime.Parse("1/1/1987 12:00:00 AM"), BitConverter.GetBytes(1), "A"); ApiProductPhotoRequestModel response = mapper.MapResponseToRequest(model); response.LargePhoto.Should().BeEquivalentTo(BitConverter.GetBytes(1)); response.LargePhotoFileName.Should().Be("A"); response.ModifiedDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM")); response.ThumbNailPhoto.Should().BeEquivalentTo(BitConverter.GetBytes(1)); response.ThumbnailPhotoFileName.Should().Be("A"); }
public void CreatePatch() { var mapper = new ApiProductPhotoModelMapper(); var model = new ApiProductPhotoRequestModel(); model.SetProperties(BitConverter.GetBytes(1), "A", DateTime.Parse("1/1/1987 12:00:00 AM"), BitConverter.GetBytes(1), "A"); JsonPatchDocument <ApiProductPhotoRequestModel> patch = mapper.CreatePatch(model); var response = new ApiProductPhotoRequestModel(); patch.ApplyTo(response); response.LargePhoto.Should().BeEquivalentTo(BitConverter.GetBytes(1)); response.LargePhotoFileName.Should().Be("A"); response.ModifiedDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM")); response.ThumbNailPhoto.Should().BeEquivalentTo(BitConverter.GetBytes(1)); response.ThumbnailPhotoFileName.Should().Be("A"); }
public async void TestUpdate() { var builder = new WebHostBuilder() .UseEnvironment("Production") .UseStartup <TestStartup>(); TestServer testServer = new TestServer(builder); var client = new ApiClient(testServer.CreateClient()); ApiProductPhotoResponseModel model = await client.ProductPhotoGetAsync(1); ApiProductPhotoModelMapper mapper = new ApiProductPhotoModelMapper(); UpdateResponse <ApiProductPhotoResponseModel> updateResponse = await client.ProductPhotoUpdateAsync(model.ProductPhotoID, mapper.MapResponseToRequest(model)); updateResponse.Record.Should().NotBeNull(); updateResponse.Success.Should().BeTrue(); }