Example #1
0
        public async Task WhenGet_ThenSuccess()
        {
            var headers = await _defaultRequestHeadersService.GetAsync();

            var type = await _create.TaskType.BuildAsync();

            var status = await _create.TaskStatus.BuildAsync();

            var taskId = (
                await _create.Task
                .WithTypeId(type.Id)
                .WithStatusId(status.Id)
                .BuildAsync())
                         .Id;

            var task = await _tasksClient.GetAsync(taskId, headers);

            Assert.NotNull(task);
            Assert.Equal(taskId, task.Id);
        }
Example #2
0
        public async Task <CrmTask> BuildAsync()
        {
            var headers = await _defaultRequestHeadersService.GetAsync();

            if (_task.TypeId.IsEmpty())
            {
                throw new InvalidOperationException(nameof(_task.TypeId));
            }

            if (_task.StatusId.IsEmpty())
            {
                throw new InvalidOperationException(nameof(_task.StatusId));
            }

            var id = await _tasksClient.CreateAsync(_task, headers);

            return(await _tasksClient.GetAsync(id, headers));
        }