コード例 #1
0
        public void MapResponseToRequest()
        {
            var mapper = new ApiFollowerModelMapper();
            var model  = new ApiFollowerResponseModel();

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

            response.Blocked.Should().Be("A");
            response.DateFollowed.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.FollowRequestStatu.Should().Be("A");
            response.FollowedUserId.Should().Be(1);
            response.FollowingUserId.Should().Be(1);
            response.Muted.Should().Be("A");
        }
コード例 #2
0
        public void CreatePatch()
        {
            var mapper = new ApiFollowerModelMapper();
            var model  = new ApiFollowerRequestModel();

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

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

            patch.ApplyTo(response);
            response.Blocked.Should().Be("A");
            response.DateFollowed.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.FollowRequestStatu.Should().Be("A");
            response.FollowedUserId.Should().Be(1);
            response.FollowingUserId.Should().Be(1);
            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());

            ApiFollowerResponseModel model = await client.FollowerGetAsync(1);

            ApiFollowerModelMapper mapper = new ApiFollowerModelMapper();

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

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