コード例 #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 ApiColumnSameAsFKTableRequestModel();

            createModel.SetProperties(2, 2);
            CreateResponse <ApiColumnSameAsFKTableResponseModel> createResult = await client.ColumnSameAsFKTableCreateAsync(createModel);

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

            ApiColumnSameAsFKTableResponseModel getResponse = await client.ColumnSameAsFKTableGetAsync(2);

            getResponse.Should().NotBeNull();

            ActionResponse deleteResult = await client.ColumnSameAsFKTableDeleteAsync(2);

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

            ApiColumnSameAsFKTableResponseModel verifyResponse = await client.ColumnSameAsFKTableGetAsync(2);

            verifyResponse.Should().BeNull();
        }
コード例 #2
0
        private async Task <ApiColumnSameAsFKTableResponseModel> CreateRecord(ApiClient client)
        {
            var model = new ApiColumnSameAsFKTableRequestModel();

            model.SetProperties(2, 2);
            CreateResponse <ApiColumnSameAsFKTableResponseModel> result = await client.ColumnSameAsFKTableCreateAsync(model);

            result.Success.Should().BeTrue();
            return(result.Record);
        }
コード例 #3
0
        public void MapModelToBO()
        {
            var mapper = new BOLColumnSameAsFKTableMapper();
            ApiColumnSameAsFKTableRequestModel model = new ApiColumnSameAsFKTableRequestModel();

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

            response.Person.Should().Be(1);
            response.PersonId.Should().Be(1);
        }
コード例 #4
0
        public void MapRequestToResponse()
        {
            var mapper = new ApiColumnSameAsFKTableModelMapper();
            var model  = new ApiColumnSameAsFKTableRequestModel();

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

            response.Id.Should().Be(1);
            response.Person.Should().Be(1);
            response.PersonId.Should().Be(1);
        }
コード例 #5
0
        public void CreatePatch()
        {
            var mapper = new ApiColumnSameAsFKTableModelMapper();
            var model  = new ApiColumnSameAsFKTableRequestModel();

            model.SetProperties(1, 1);

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

            patch.ApplyTo(response);
            response.Person.Should().Be(1);
            response.PersonId.Should().Be(1);
        }