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

            createModel.SetProperties(2, 2);
            CreateResponse <ApiPersonRefResponseModel> createResult = await client.PersonRefCreateAsync(createModel);

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

            ApiPersonRefResponseModel getResponse = await client.PersonRefGetAsync(2);

            getResponse.Should().NotBeNull();

            ActionResponse deleteResult = await client.PersonRefDeleteAsync(2);

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

            ApiPersonRefResponseModel verifyResponse = await client.PersonRefGetAsync(2);

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

            model.SetProperties(2, 2);
            CreateResponse <ApiPersonRefResponseModel> result = await client.PersonRefCreateAsync(model);

            result.Success.Should().BeTrue();
            return(result.Record);
        }
Example #3
0
        public void MapModelToBO()
        {
            var mapper = new BOLPersonRefMapper();
            ApiPersonRefRequestModel model = new ApiPersonRefRequestModel();

            model.SetProperties(1, 1);
            BOPersonRef response = mapper.MapModelToBO(1, model);

            response.PersonAId.Should().Be(1);
            response.PersonBId.Should().Be(1);
        }
        public void MapRequestToResponse()
        {
            var mapper = new ApiPersonRefModelMapper();
            var model  = new ApiPersonRefRequestModel();

            model.SetProperties(1, 1);
            ApiPersonRefResponseModel response = mapper.MapRequestToResponse(1, model);

            response.Id.Should().Be(1);
            response.PersonAId.Should().Be(1);
            response.PersonBId.Should().Be(1);
        }
        public void CreatePatch()
        {
            var mapper = new ApiPersonRefModelMapper();
            var model  = new ApiPersonRefRequestModel();

            model.SetProperties(1, 1);

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

            patch.ApplyTo(response);
            response.PersonAId.Should().Be(1);
            response.PersonBId.Should().Be(1);
        }