Beispiel #1
0
        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 ApiFollowingRequestModel();

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

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

            ApiFollowingResponseModel getResponse = await client.FollowingGetAsync("B");

            getResponse.Should().NotBeNull();

            ActionResponse deleteResult = await client.FollowingDeleteAsync("B");

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

            ApiFollowingResponseModel verifyResponse = await client.FollowingGetAsync("B");

            verifyResponse.Should().BeNull();
        }
Beispiel #2
0
        private async Task <ApiFollowingResponseModel> CreateRecord(ApiClient client)
        {
            var model = new ApiFollowingRequestModel();

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

            result.Success.Should().BeTrue();
            return(result.Record);
        }
Beispiel #3
0
        public void MapModelToBO()
        {
            var mapper = new BOLFollowingMapper();
            ApiFollowingRequestModel model = new ApiFollowingRequestModel();

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

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

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

            response.DateFollowed.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.Muted.Should().Be("A");
            response.UserId.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");
        }