예제 #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 ApiPostLinkRequestModel();

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

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

            ApiPostLinkResponseModel getResponse = await client.PostLinkGetAsync(2);

            getResponse.Should().NotBeNull();

            ActionResponse deleteResult = await client.PostLinkDeleteAsync(2);

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

            ApiPostLinkResponseModel verifyResponse = await client.PostLinkGetAsync(2);

            verifyResponse.Should().BeNull();
        }
예제 #2
0
        private async Task <ApiPostLinkResponseModel> CreateRecord(ApiClient client)
        {
            var model = new ApiPostLinkRequestModel();

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

            result.Success.Should().BeTrue();
            return(result.Record);
        }
예제 #3
0
        public void MapModelToBO()
        {
            var mapper = new BOLPostLinkMapper();
            ApiPostLinkRequestModel model = new ApiPostLinkRequestModel();

            model.SetProperties(DateTime.Parse("1/1/1987 12:00:00 AM"), 1, 1, 1);
            BOPostLink response = mapper.MapModelToBO(1, 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);
        }
예제 #4
0
        public void CreatePatch()
        {
            var mapper = new ApiPostLinkModelMapper();
            var model  = new ApiPostLinkRequestModel();

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

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

            patch.ApplyTo(response);
            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);
        }