예제 #1
0
        public void MapResponseToRequest()
        {
            var mapper = new ApiPostLinkModelMapper();
            var model  = new ApiPostLinkResponseModel();

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

            response.CreationDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.LinkTypeId.Should().Be(1);
            response.PostId.Should().Be(1);
            response.RelatedPostId.Should().Be(1);
        }
예제 #2
0
        public async void TestUpdate()
        {
            var builder = new WebHostBuilder()
                          .UseEnvironment("Production")
                          .UseStartup <TestStartup>();
            TestServer testServer = new TestServer(builder);

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

            ApiPostLinkResponseModel model = await client.PostLinkGetAsync(1);

            ApiPostLinkModelMapper mapper = new ApiPostLinkModelMapper();

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

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