Exemplo n.º 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 ApiHandlerRequestModel();

            createModel.SetProperties(2, "B", "B", "B", "B");
            CreateResponse <ApiHandlerResponseModel> createResult = await client.HandlerCreateAsync(createModel);

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

            ApiHandlerResponseModel getResponse = await client.HandlerGetAsync(2);

            getResponse.Should().NotBeNull();

            ActionResponse deleteResult = await client.HandlerDeleteAsync(2);

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

            ApiHandlerResponseModel verifyResponse = await client.HandlerGetAsync(2);

            verifyResponse.Should().BeNull();
        }
Exemplo n.º 2
0
        private async Task <ApiHandlerResponseModel> CreateRecord(ApiClient client)
        {
            var model = new ApiHandlerRequestModel();

            model.SetProperties(2, "B", "B", "B", "B");
            CreateResponse <ApiHandlerResponseModel> result = await client.HandlerCreateAsync(model);

            result.Success.Should().BeTrue();
            return(result.Record);
        }
Exemplo n.º 3
0
        public void MapModelToBO()
        {
            var mapper = new BOLHandlerMapper();
            ApiHandlerRequestModel model = new ApiHandlerRequestModel();

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

            response.CountryId.Should().Be(1);
            response.Email.Should().Be("A");
            response.FirstName.Should().Be("A");
            response.LastName.Should().Be("A");
            response.Phone.Should().Be("A");
        }
Exemplo n.º 4
0
        public void MapRequestToResponse()
        {
            var mapper = new ApiHandlerModelMapper();
            var model  = new ApiHandlerRequestModel();

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

            response.CountryId.Should().Be(1);
            response.Email.Should().Be("A");
            response.FirstName.Should().Be("A");
            response.Id.Should().Be(1);
            response.LastName.Should().Be("A");
            response.Phone.Should().Be("A");
        }
Exemplo n.º 5
0
        public void CreatePatch()
        {
            var mapper = new ApiHandlerModelMapper();
            var model  = new ApiHandlerRequestModel();

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

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

            patch.ApplyTo(response);
            response.CountryId.Should().Be(1);
            response.Email.Should().Be("A");
            response.FirstName.Should().Be("A");
            response.LastName.Should().Be("A");
            response.Phone.Should().Be("A");
        }