예제 #1
0
        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();
        }
예제 #2
0
        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);
        }
예제 #3
0
        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);
        }