public async Task WhenGetPagedList_ThenSuccess() { var headers = await _defaultRequestHeadersService.GetAsync(); var type = await _create.TaskType.BuildAsync(); type.Name = "Test".WithGuid(); type.IsDeleted = true; await _taskTypesClient.UpdateAsync(type, headers); var request = new TaskTypeChangeGetPagedListRequest { TypeId = type.Id, SortBy = "CreateDateTime", OrderBy = "asc" }; var response = await _typeChangesClient.GetPagedListAsync(request, headers); Assert.NotEmpty(response.Changes); Assert.True(response.Changes.All(x => !x.ChangerUserId.IsEmpty())); Assert.True(response.Changes.All(x => x.TypeId == type.Id)); Assert.True(response.Changes.All(x => x.CreateDateTime.IsMoreThanMinValue())); Assert.True(response.Changes.First().OldValueJson.IsEmpty()); Assert.True(!response.Changes.First().NewValueJson.IsEmpty()); Assert.NotNull(response.Changes.First().NewValueJson.FromJsonString <TaskType>()); Assert.True(!response.Changes.Last().OldValueJson.IsEmpty()); Assert.True(!response.Changes.Last().NewValueJson.IsEmpty()); Assert.False(response.Changes.Last().OldValueJson.FromJsonString <TaskType>().IsDeleted); Assert.True(response.Changes.Last().NewValueJson.FromJsonString <TaskType>().IsDeleted); Assert.Equal(response.Changes.Last().NewValueJson.FromJsonString <TaskType>().Name, type.Name); }
public async Task WhenUpdate_ThenSuccess() { var headers = await _defaultRequestHeadersService.GetAsync(); var type = await _create.TaskType.WithName("Test".WithGuid()).BuildAsync(); type.Name = "Test".WithGuid(); type.IsDeleted = true; await _taskTypesClient.UpdateAsync(type, headers); var updatedType = await _taskTypesClient.GetAsync(type.Id, headers); Assert.Equal(type.Name, updatedType.Name); Assert.Equal(type.IsDeleted, updatedType.IsDeleted); }