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

            createModel.SetProperties(1, "B", 2);
            CreateResponse <ApiDestinationResponseModel> createResult = await client.DestinationCreateAsync(createModel);

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

            ApiDestinationResponseModel getResponse = await client.DestinationGetAsync(2);

            getResponse.Should().NotBeNull();

            ActionResponse deleteResult = await client.DestinationDeleteAsync(2);

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

            ApiDestinationResponseModel verifyResponse = await client.DestinationGetAsync(2);

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

            model.SetProperties(1, "B", 2);
            CreateResponse <ApiDestinationResponseModel> result = await client.DestinationCreateAsync(model);

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

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

            response.CountryId.Should().Be(1);
            response.Name.Should().Be("A");
            response.Order.Should().Be(1);
        }
예제 #4
0
        public void MapRequestToResponse()
        {
            var mapper = new ApiDestinationModelMapper();
            var model  = new ApiDestinationRequestModel();

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

            response.CountryId.Should().Be(1);
            response.Id.Should().Be(1);
            response.Name.Should().Be("A");
            response.Order.Should().Be(1);
        }
예제 #5
0
        public void CreatePatch()
        {
            var mapper = new ApiDestinationModelMapper();
            var model  = new ApiDestinationRequestModel();

            model.SetProperties(1, "A", 1);

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

            patch.ApplyTo(response);
            response.CountryId.Should().Be(1);
            response.Name.Should().Be("A");
            response.Order.Should().Be(1);
        }