示例#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 ApiTenantRequestModel();

            createModel.SetProperties("B");
            CreateResponse <ApiTenantResponseModel> createResult = await client.TenantCreateAsync(createModel);

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

            ApiTenantResponseModel getResponse = await client.TenantGetAsync(2);

            getResponse.Should().NotBeNull();

            ActionResponse deleteResult = await client.TenantDeleteAsync(2);

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

            ApiTenantResponseModel verifyResponse = await client.TenantGetAsync(2);

            verifyResponse.Should().BeNull();
        }
        private async Task <ApiTenantResponseModel> CreateRecord()
        {
            var model = new ApiTenantRequestModel();

            model.SetProperties(BitConverter.GetBytes(2), "B", "B", "B", "B");
            CreateResponse <ApiTenantResponseModel> result = await this.Client.TenantCreateAsync(model);

            result.Success.Should().BeTrue();
            return(result.Record);
        }
示例#3
0
        public void MapModelToBO()
        {
            var mapper = new BOLTenantMapper();
            ApiTenantRequestModel model = new ApiTenantRequestModel();

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

            response.Name.Should().Be("A");
        }
示例#4
0
        private async Task <ApiTenantResponseModel> CreateRecord(ApiClient client)
        {
            var model = new ApiTenantRequestModel();

            model.SetProperties("B");
            CreateResponse <ApiTenantResponseModel> result = await client.TenantCreateAsync(model);

            result.Success.Should().BeTrue();
            return(result.Record);
        }
        public void MapRequestToResponse()
        {
            var mapper = new ApiTenantModelMapper();
            var model  = new ApiTenantRequestModel();

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

            response.Id.Should().Be(1);
            response.Name.Should().Be("A");
        }
        public void CreatePatch()
        {
            var mapper = new ApiTenantModelMapper();
            var model  = new ApiTenantRequestModel();

            model.SetProperties("A");

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

            patch.ApplyTo(response);
            response.Name.Should().Be("A");
        }
示例#7
0
        public void MapModelToBO()
        {
            var mapper = new BOLTenantMapper();
            ApiTenantRequestModel model = new ApiTenantRequestModel();

            model.SetProperties(BitConverter.GetBytes(1), "A", "A", "A", "A");
            BOTenant response = mapper.MapModelToBO("A", model);

            response.DataVersion.Should().BeEquivalentTo(BitConverter.GetBytes(1));
            response.JSON.Should().Be("A");
            response.Name.Should().Be("A");
            response.ProjectIds.Should().Be("A");
            response.TenantTags.Should().Be("A");
        }
        public void CreatePatch()
        {
            var mapper = new ApiTenantModelMapper();
            var model  = new ApiTenantRequestModel();

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

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

            patch.ApplyTo(response);
            response.DataVersion.Should().BeEquivalentTo(BitConverter.GetBytes(1));
            response.JSON.Should().Be("A");
            response.Name.Should().Be("A");
            response.ProjectIds.Should().Be("A");
            response.TenantTags.Should().Be("A");
        }