Exemple #1
0
        public async void TestUpdate()
        {
            var model = await this.CreateRecord();

            ApiCommentsModelMapper mapper = new ApiCommentsModelMapper();

            UpdateResponse <ApiCommentsResponseModel> updateResponse = await this.Client.CommentsUpdateAsync(model.Id, mapper.MapResponseToRequest(model));

            updateResponse.Record.Should().NotBeNull();
            updateResponse.Success.Should().BeTrue();

            await this.Cleanup();
        }
Exemple #2
0
        public void MapResponseToRequest()
        {
            var mapper = new ApiCommentsModelMapper();
            var model  = new ApiCommentsResponseModel();

            model.SetProperties(1, DateTime.Parse("1/1/1987 12:00:00 AM"), 1, 1, "A", 1);
            ApiCommentsRequestModel response = mapper.MapResponseToRequest(model);

            response.CreationDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.PostId.Should().Be(1);
            response.Score.Should().Be(1);
            response.Text.Should().Be("A");
            response.UserId.Should().Be(1);
        }
Exemple #3
0
        public void CreatePatch()
        {
            var mapper = new ApiCommentsModelMapper();
            var model  = new ApiCommentsRequestModel();

            model.SetProperties(DateTime.Parse("1/1/1987 12:00:00 AM"), 1, 1, "A", 1);

            JsonPatchDocument <ApiCommentsRequestModel> patch = mapper.CreatePatch(model);
            var response = new ApiCommentsRequestModel();

            patch.ApplyTo(response);
            response.CreationDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.PostId.Should().Be(1);
            response.Score.Should().Be(1);
            response.Text.Should().Be("A");
            response.UserId.Should().Be(1);
        }