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

            createModel.SetProperties("B");
            CreateResponse <ApiLinkTypeResponseModel> createResult = await client.LinkTypeCreateAsync(createModel);

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

            ApiLinkTypeResponseModel getResponse = await client.LinkTypeGetAsync(2);

            getResponse.Should().NotBeNull();

            ActionResponse deleteResult = await client.LinkTypeDeleteAsync(2);

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

            ApiLinkTypeResponseModel verifyResponse = await client.LinkTypeGetAsync(2);

            verifyResponse.Should().BeNull();
        }
예제 #2
0
        public void MapModelToBO()
        {
            var mapper = new BOLLinkTypeMapper();
            ApiLinkTypeRequestModel model = new ApiLinkTypeRequestModel();

            model.SetProperties("A");
            BOLinkType response = mapper.MapModelToBO(1, model);

            response.Type.Should().Be("A");
        }
예제 #3
0
        private async Task <ApiLinkTypeResponseModel> CreateRecord(ApiClient client)
        {
            var model = new ApiLinkTypeRequestModel();

            model.SetProperties("B");
            CreateResponse <ApiLinkTypeResponseModel> result = await client.LinkTypeCreateAsync(model);

            result.Success.Should().BeTrue();
            return(result.Record);
        }
예제 #4
0
        public void MapRequestToResponse()
        {
            var mapper = new ApiLinkTypeModelMapper();
            var model  = new ApiLinkTypeRequestModel();

            model.SetProperties("A");
            ApiLinkTypeResponseModel response = mapper.MapRequestToResponse(1, model);

            response.Id.Should().Be(1);
            response.Type.Should().Be("A");
        }
예제 #5
0
        public void CreatePatch()
        {
            var mapper = new ApiLinkTypeModelMapper();
            var model  = new ApiLinkTypeRequestModel();

            model.SetProperties("A");

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

            patch.ApplyTo(response);
            response.Type.Should().Be("A");
        }