Ejemplo 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 ApiClientRequestModel();

            createModel.SetProperties("B", "B", "B", "B", "B");
            CreateResponse <ApiClientResponseModel> createResult = await client.ClientCreateAsync(createModel);

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

            ApiClientResponseModel getResponse = await client.ClientGetAsync(2);

            getResponse.Should().NotBeNull();

            ActionResponse deleteResult = await client.ClientDeleteAsync(2);

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

            ApiClientResponseModel verifyResponse = await client.ClientGetAsync(2);

            verifyResponse.Should().BeNull();
        }
Ejemplo n.º 2
0
        private async Task <ApiClientResponseModel> CreateRecord()
        {
            var model = new ApiClientRequestModel();

            model.SetProperties("B", "B", "B", "B", "B");
            CreateResponse <ApiClientResponseModel> result = await this.Client.ClientCreateAsync(model);

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

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

            response.Email.Should().Be("A");
            response.FirstName.Should().Be("A");
            response.LastName.Should().Be("A");
            response.Note.Should().Be("A");
            response.Phone.Should().Be("A");
        }
Ejemplo n.º 4
0
        public void MapRequestToResponse()
        {
            var mapper = new ApiClientModelMapper();
            var model  = new ApiClientRequestModel();

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

            response.Email.Should().Be("A");
            response.FirstName.Should().Be("A");
            response.Id.Should().Be(1);
            response.LastName.Should().Be("A");
            response.Note.Should().Be("A");
            response.Phone.Should().Be("A");
        }
Ejemplo n.º 5
0
        public void CreatePatch()
        {
            var mapper = new ApiClientModelMapper();
            var model  = new ApiClientRequestModel();

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

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

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