public async void TestUpdate() { var model = await this.CreateRecord(); ApiVotesModelMapper mapper = new ApiVotesModelMapper(); UpdateResponse <ApiVotesResponseModel> updateResponse = await this.Client.VotesUpdateAsync(model.Id, mapper.MapResponseToRequest(model)); updateResponse.Record.Should().NotBeNull(); updateResponse.Success.Should().BeTrue(); await this.Cleanup(); }
public void MapResponseToRequest() { var mapper = new ApiVotesModelMapper(); var model = new ApiVotesResponseModel(); model.SetProperties(1, 1, DateTime.Parse("1/1/1987 12:00:00 AM"), 1, 1, 1); ApiVotesRequestModel response = mapper.MapResponseToRequest(model); response.BountyAmount.Should().Be(1); response.CreationDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM")); response.PostId.Should().Be(1); response.UserId.Should().Be(1); response.VoteTypeId.Should().Be(1); }
public void CreatePatch() { var mapper = new ApiVotesModelMapper(); var model = new ApiVotesRequestModel(); model.SetProperties(1, DateTime.Parse("1/1/1987 12:00:00 AM"), 1, 1, 1); JsonPatchDocument <ApiVotesRequestModel> patch = mapper.CreatePatch(model); var response = new ApiVotesRequestModel(); patch.ApplyTo(response); response.BountyAmount.Should().Be(1); response.CreationDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM")); response.PostId.Should().Be(1); response.UserId.Should().Be(1); response.VoteTypeId.Should().Be(1); }