public void MapResponseToRequest()
        {
            var mapper = new ApiChainStatusModelMapper();
            var model  = new ApiChainStatusResponseModel();

            model.SetProperties(1, "A");
            ApiChainStatusRequestModel response = mapper.MapResponseToRequest(model);

            response.Name.Should().Be("A");
        }
Exemplo n.º 2
0
        public void MapClientRequestToResponse()
        {
            var mapper = new ApiChainStatusModelMapper();
            var model  = new ApiChainStatusClientRequestModel();

            model.SetProperties("A");
            ApiChainStatusClientResponseModel response = mapper.MapClientRequestToResponse(1, model);

            response.Should().NotBeNull();
            response.Name.Should().Be("A");
        }
        public async void TestUpdate()
        {
            var model = await this.CreateRecord();

            ApiChainStatusModelMapper mapper = new ApiChainStatusModelMapper();

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

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

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

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

            ApiChainStatusResponseModel model = await client.ChainStatusGetAsync(1);

            ApiChainStatusModelMapper mapper = new ApiChainStatusModelMapper();

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

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