public void MapResponseToRequest()
        {
            var mapper = new ApiFollowingModelMapper();
            var model  = new ApiFollowingResponseModel();

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

            response.DateFollowed.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.Muted.Should().Be("A");
        }
        public void CreatePatch()
        {
            var mapper = new ApiFollowingModelMapper();
            var model  = new ApiFollowingRequestModel();

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

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

            patch.ApplyTo(response);
            response.DateFollowed.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.Muted.Should().Be("A");
        }
Пример #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());

            ApiFollowingResponseModel model = await client.FollowingGetAsync("A");

            ApiFollowingModelMapper mapper = new ApiFollowingModelMapper();

            UpdateResponse <ApiFollowingResponseModel> updateResponse = await client.FollowingUpdateAsync(model.UserId, mapper.MapResponseToRequest(model));

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