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

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

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

            ApiSpaceResponseModel getResponse = await client.SpaceGetAsync(2);

            getResponse.Should().NotBeNull();

            ActionResponse deleteResult = await client.SpaceDeleteAsync(2);

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

            ApiSpaceResponseModel verifyResponse = await client.SpaceGetAsync(2);

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

            model.SetProperties("B", "B", 1);
            CreateResponse <ApiSpaceResponseModel> result = await this.Client.SpaceCreateAsync(model);

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

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

            response.Description.Should().Be("A");
            response.Name.Should().Be("A");
        }
Ejemplo n.º 4
0
        public void MapRequestToResponse()
        {
            var mapper = new ApiSpaceModelMapper();
            var model  = new ApiSpaceRequestModel();

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

            response.Description.Should().Be("A");
            response.Id.Should().Be(1);
            response.Name.Should().Be("A");
        }
Ejemplo n.º 5
0
        public void CreatePatch()
        {
            var mapper = new ApiSpaceModelMapper();
            var model  = new ApiSpaceRequestModel();

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

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

            patch.ApplyTo(response);
            response.Description.Should().Be("A");
            response.Name.Should().Be("A");
        }