public async void TestDelete()
        {
            var builder = new WebHostBuilder()
                          .UseEnvironment("Production")
                          .UseStartup <TestStartup>();
            TestServer testServer = new TestServer(builder);

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

            var createModel = new ApiFollowerRequestModel();

            createModel.SetProperties("B", DateTime.Parse("1/1/1988 12:00:00 AM"), "B", 1, 1, "B");
            CreateResponse <ApiFollowerResponseModel> createResult = await client.FollowerCreateAsync(createModel);

            createResult.Success.Should().BeTrue();

            ApiFollowerResponseModel getResponse = await client.FollowerGetAsync(2);

            getResponse.Should().NotBeNull();

            ActionResponse deleteResult = await client.FollowerDeleteAsync(2);

            deleteResult.Success.Should().BeTrue();

            ApiFollowerResponseModel verifyResponse = await client.FollowerGetAsync(2);

            verifyResponse.Should().BeNull();
        }
        private async Task <ApiFollowerResponseModel> CreateRecord(ApiClient client)
        {
            var model = new ApiFollowerRequestModel();

            model.SetProperties("B", DateTime.Parse("1/1/1988 12:00:00 AM"), "B", 1, 1, "B");
            CreateResponse <ApiFollowerResponseModel> result = await client.FollowerCreateAsync(model);

            result.Success.Should().BeTrue();
            return(result.Record);
        }
Esempio n. 3
0
        public void MapModelToBO()
        {
            var mapper = new BOLFollowerMapper();
            ApiFollowerRequestModel model = new ApiFollowerRequestModel();

            model.SetProperties("A", DateTime.Parse("1/1/1987 12:00:00 AM"), "A", 1, 1, "A");
            BOFollower response = mapper.MapModelToBO(1, 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");
        }
        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");
        }