Example #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 ApiChainRequestModel();

            createModel.SetProperties(1, Guid.Parse("3842cac4-b9a0-8223-0dcc-509a6f75849b"), "B", 1);
            CreateResponse <ApiChainResponseModel> createResult = await client.ChainCreateAsync(createModel);

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

            ApiChainResponseModel getResponse = await client.ChainGetAsync(2);

            getResponse.Should().NotBeNull();

            ActionResponse deleteResult = await client.ChainDeleteAsync(2);

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

            ApiChainResponseModel verifyResponse = await client.ChainGetAsync(2);

            verifyResponse.Should().BeNull();
        }
Example #2
0
        private async Task <ApiChainResponseModel> CreateRecord(ApiClient client)
        {
            var model = new ApiChainRequestModel();

            model.SetProperties(1, Guid.Parse("3842cac4-b9a0-8223-0dcc-509a6f75849b"), "B", 1);
            CreateResponse <ApiChainResponseModel> result = await client.ChainCreateAsync(model);

            result.Success.Should().BeTrue();
            return(result.Record);
        }
Example #3
0
        public void MapModelToBO()
        {
            var mapper = new BOLChainMapper();
            ApiChainRequestModel model = new ApiChainRequestModel();

            model.SetProperties(1, Guid.Parse("8420cdcf-d595-ef65-66e7-dff9f98764da"), "A", 1);
            BOChain response = mapper.MapModelToBO(1, model);

            response.ChainStatusId.Should().Be(1);
            response.ExternalId.Should().Be(Guid.Parse("8420cdcf-d595-ef65-66e7-dff9f98764da"));
            response.Name.Should().Be("A");
            response.TeamId.Should().Be(1);
        }
Example #4
0
        public void CreatePatch()
        {
            var mapper = new ApiChainModelMapper();
            var model  = new ApiChainRequestModel();

            model.SetProperties(1, Guid.Parse("8420cdcf-d595-ef65-66e7-dff9f98764da"), "A", 1);

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

            patch.ApplyTo(response);
            response.ChainStatusId.Should().Be(1);
            response.ExternalId.Should().Be(Guid.Parse("8420cdcf-d595-ef65-66e7-dff9f98764da"));
            response.Name.Should().Be("A");
            response.TeamId.Should().Be(1);
        }