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

            createModel.SetProperties("B");
            CreateResponse <ApiChainStatusResponseModel> createResult = await client.ChainStatusCreateAsync(createModel);

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

            ApiChainStatusResponseModel getResponse = await client.ChainStatusGetAsync(2);

            getResponse.Should().NotBeNull();

            ActionResponse deleteResult = await client.ChainStatusDeleteAsync(2);

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

            ApiChainStatusResponseModel verifyResponse = await client.ChainStatusGetAsync(2);

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

            model.SetProperties("B");
            CreateResponse <ApiChainStatusResponseModel> result = await this.Client.ChainStatusCreateAsync(model);

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

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

            response.Name.Should().Be("A");
        }
        public void MapRequestToResponse()
        {
            var mapper = new ApiChainStatusModelMapper();
            var model  = new ApiChainStatusRequestModel();

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

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

            model.SetProperties("A");

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

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