public async void TestUpdate() { var model = await this.CreateRecord(); ApiProductReviewModelMapper mapper = new ApiProductReviewModelMapper(); UpdateResponse <ApiProductReviewResponseModel> updateResponse = await this.Client.ProductReviewUpdateAsync(model.ProductReviewID, mapper.MapResponseToRequest(model)); updateResponse.Record.Should().NotBeNull(); updateResponse.Success.Should().BeTrue(); await this.Cleanup(); }
public void MapResponseToRequest() { var mapper = new ApiProductReviewModelMapper(); var model = new ApiProductReviewResponseModel(); model.SetProperties(1, "A", "A", DateTime.Parse("1/1/1987 12:00:00 AM"), 1, 1, DateTime.Parse("1/1/1987 12:00:00 AM"), "A"); ApiProductReviewRequestModel response = mapper.MapResponseToRequest(model); response.Comment.Should().Be("A"); response.EmailAddress.Should().Be("A"); response.ModifiedDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM")); response.ProductID.Should().Be(1); response.Rating.Should().Be(1); response.ReviewDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM")); response.ReviewerName.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()); ApiProductReviewResponseModel model = await client.ProductReviewGetAsync(1); ApiProductReviewModelMapper mapper = new ApiProductReviewModelMapper(); UpdateResponse <ApiProductReviewResponseModel> updateResponse = await client.ProductReviewUpdateAsync(model.ProductReviewID, mapper.MapResponseToRequest(model)); updateResponse.Record.Should().NotBeNull(); updateResponse.Success.Should().BeTrue(); }
public void CreatePatch() { var mapper = new ApiProductReviewModelMapper(); var model = new ApiProductReviewRequestModel(); model.SetProperties("A", "A", DateTime.Parse("1/1/1987 12:00:00 AM"), 1, 1, DateTime.Parse("1/1/1987 12:00:00 AM"), "A"); JsonPatchDocument <ApiProductReviewRequestModel> patch = mapper.CreatePatch(model); var response = new ApiProductReviewRequestModel(); patch.ApplyTo(response); response.Comment.Should().Be("A"); response.EmailAddress.Should().Be("A"); response.ModifiedDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM")); response.ProductID.Should().Be(1); response.Rating.Should().Be(1); response.ReviewDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM")); response.ReviewerName.Should().Be("A"); }