public async void TestUpdate()
        {
            var model = await this.CreateRecord();

            ApiPostHistoryModelMapper mapper = new ApiPostHistoryModelMapper();

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

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

            await this.Cleanup();
        }
        public void MapResponseToRequest()
        {
            var mapper = new ApiPostHistoryModelMapper();
            var model  = new ApiPostHistoryResponseModel();

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

            response.Comment.Should().Be("A");
            response.CreationDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.PostHistoryTypeId.Should().Be(1);
            response.PostId.Should().Be(1);
            response.RevisionGUID.Should().Be("A");
            response.Text.Should().Be("A");
            response.UserDisplayName.Should().Be("A");
            response.UserId.Should().Be(1);
        }
Exemple #3
0
        public async void TestUpdate()
        {
            var builder = new WebHostBuilder()
                          .UseEnvironment("Production")
                          .UseStartup <TestStartup>();
            TestServer testServer = new TestServer(builder);

            var client = new ApiClient(testServer.CreateClient());

            ApiPostHistoryResponseModel model = await client.PostHistoryGetAsync(1);

            ApiPostHistoryModelMapper mapper = new ApiPostHistoryModelMapper();

            UpdateResponse <ApiPostHistoryResponseModel> updateResponse = await client.PostHistoryUpdateAsync(model.Id, mapper.MapResponseToRequest(model));

            updateResponse.Record.Should().NotBeNull();
            updateResponse.Success.Should().BeTrue();
        }
        public void CreatePatch()
        {
            var mapper = new ApiPostHistoryModelMapper();
            var model  = new ApiPostHistoryRequestModel();

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

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

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