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 ApiCountryRequirementRequestModel();

            createModel.SetProperties(1, "B");
            CreateResponse <ApiCountryRequirementResponseModel> createResult = await client.CountryRequirementCreateAsync(createModel);

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

            ApiCountryRequirementResponseModel getResponse = await client.CountryRequirementGetAsync(2);

            getResponse.Should().NotBeNull();

            ActionResponse deleteResult = await client.CountryRequirementDeleteAsync(2);

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

            ApiCountryRequirementResponseModel verifyResponse = await client.CountryRequirementGetAsync(2);

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

            model.SetProperties(1, "B");
            CreateResponse <ApiCountryRequirementResponseModel> result = await client.CountryRequirementCreateAsync(model);

            result.Success.Should().BeTrue();
            return(result.Record);
        }
Exemple #3
0
        public void MapModelToBO()
        {
            var mapper = new BOLCountryRequirementMapper();
            ApiCountryRequirementRequestModel model = new ApiCountryRequirementRequestModel();

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

            response.CountryId.Should().Be(1);
            response.Detail.Should().Be("A");
        }
        public void MapRequestToResponse()
        {
            var mapper = new ApiCountryRequirementModelMapper();
            var model  = new ApiCountryRequirementRequestModel();

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

            response.CountryId.Should().Be(1);
            response.Details.Should().Be("A");
            response.Id.Should().Be(1);
        }
        public void CreatePatch()
        {
            var mapper = new ApiCountryRequirementModelMapper();
            var model  = new ApiCountryRequirementRequestModel();

            model.SetProperties(1, "A");

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

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