Ejemplo n.º 1
0
        public void MapResponseToRequest()
        {
            var mapper = new ApiChainModelMapper();
            var model  = new ApiChainResponseModel();

            model.SetProperties(1, 1, Guid.Parse("8420cdcf-d595-ef65-66e7-dff9f98764da"), "A", 1);
            ApiChainRequestModel response = mapper.MapResponseToRequest(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);
        }
Ejemplo n.º 2
0
        public async void TestUpdate()
        {
            var model = await this.CreateRecord();

            ApiChainModelMapper mapper = new ApiChainModelMapper();

            UpdateResponse <ApiChainResponseModel> updateResponse = await this.Client.ChainUpdateAsync(model.Id, mapper.MapResponseToRequest(model));

            updateResponse.Record.Should().NotBeNull();
            updateResponse.Success.Should().BeTrue();

            await this.Cleanup();
        }
Ejemplo n.º 3
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);
        }
Ejemplo n.º 4
0
        public async void TestUpdate()
        {
            var builder = new WebHostBuilder()
                          .UseEnvironment("Production")
                          .UseStartup <TestStartup>();
            TestServer testServer = new TestServer(builder);

            var client = new ApiClient(testServer.CreateClient());

            ApiChainResponseModel model = await client.ChainGetAsync(1);

            ApiChainModelMapper mapper = new ApiChainModelMapper();

            UpdateResponse <ApiChainResponseModel> updateResponse = await client.ChainUpdateAsync(model.Id, mapper.MapResponseToRequest(model));

            updateResponse.Record.Should().NotBeNull();
            updateResponse.Success.Should().BeTrue();
        }