public void CreatePatch() { var mapper = new ApiPostsModelMapper(); var model = new ApiPostsRequestModel(); model.SetProperties(1, 1, "A", DateTime.Parse("1/1/1987 12:00:00 AM"), 1, DateTime.Parse("1/1/1987 12:00:00 AM"), DateTime.Parse("1/1/1987 12:00:00 AM"), 1, DateTime.Parse("1/1/1987 12:00:00 AM"), DateTime.Parse("1/1/1987 12:00:00 AM"), "A", 1, 1, 1, 1, 1, "A", "A", 1); JsonPatchDocument <ApiPostsRequestModel> patch = mapper.CreatePatch(model); var response = new ApiPostsRequestModel(); patch.ApplyTo(response); response.AcceptedAnswerId.Should().Be(1); response.AnswerCount.Should().Be(1); response.Body.Should().Be("A"); response.ClosedDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM")); response.CommentCount.Should().Be(1); response.CommunityOwnedDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM")); response.CreationDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM")); response.FavoriteCount.Should().Be(1); response.LastActivityDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM")); response.LastEditDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM")); response.LastEditorDisplayName.Should().Be("A"); response.LastEditorUserId.Should().Be(1); response.OwnerUserId.Should().Be(1); response.ParentId.Should().Be(1); response.PostTypeId.Should().Be(1); response.Score.Should().Be(1); response.Tags.Should().Be("A"); response.Title.Should().Be("A"); response.ViewCount.Should().Be(1); }
public async void TestUpdate() { var model = await this.CreateRecord(); ApiPostsModelMapper mapper = new ApiPostsModelMapper(); UpdateResponse <ApiPostsResponseModel> updateResponse = await this.Client.PostsUpdateAsync(model.Id, mapper.MapResponseToRequest(model)); updateResponse.Record.Should().NotBeNull(); updateResponse.Success.Should().BeTrue(); await this.Cleanup(); }