예제 #1
0
        public async void TestUpdate()
        {
            var model = await this.CreateRecord();

            ApiWorkerTaskLeaseModelMapper mapper = new ApiWorkerTaskLeaseModelMapper();

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

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

            await this.Cleanup();
        }
        public void MapResponseToRequest()
        {
            var mapper = new ApiWorkerTaskLeaseModelMapper();
            var model  = new ApiWorkerTaskLeaseResponseModel();

            model.SetProperties("A", true, "A", "A", "A", "A");
            ApiWorkerTaskLeaseRequestModel response = mapper.MapResponseToRequest(model);

            response.Exclusive.Should().Be(true);
            response.JSON.Should().Be("A");
            response.Name.Should().Be("A");
            response.TaskId.Should().Be("A");
            response.WorkerId.Should().Be("A");
        }
        public void CreatePatch()
        {
            var mapper = new ApiWorkerTaskLeaseModelMapper();
            var model  = new ApiWorkerTaskLeaseRequestModel();

            model.SetProperties(true, "A", "A", "A", "A");

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

            patch.ApplyTo(response);
            response.Exclusive.Should().Be(true);
            response.JSON.Should().Be("A");
            response.Name.Should().Be("A");
            response.TaskId.Should().Be("A");
            response.WorkerId.Should().Be("A");
        }