public async Task WhenGetPagedList_ThenSuccess() { var headers = await _defaultRequestHeadersService.GetAsync(); var status = await _create.OrderStatus.BuildAsync(); status.Name = "Test".WithGuid(); status.IsDeleted = true; await _orderStatusesClient.UpdateAsync(status, headers); var request = new OrderStatusChangeGetPagedListRequest { StatusId = status.Id, SortBy = "CreateDateTime", OrderBy = "asc" }; var response = await _statusChangesClient.GetPagedListAsync(request, headers); Assert.NotEmpty(response.Changes); Assert.True(response.Changes.All(x => !x.ChangerUserId.IsEmpty())); Assert.True(response.Changes.All(x => x.StatusId == status.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 <OrderStatus>()); Assert.True(!response.Changes.Last().OldValueJson.IsEmpty()); Assert.True(!response.Changes.Last().NewValueJson.IsEmpty()); Assert.False(response.Changes.Last().OldValueJson.FromJsonString <OrderStatus>().IsDeleted); Assert.True(response.Changes.Last().NewValueJson.FromJsonString <OrderStatus>().IsDeleted); Assert.Equal(response.Changes.Last().NewValueJson.FromJsonString <OrderStatus>().Name, status.Name); }
public async Task WhenUpdate_ThenSuccess() { var headers = await _defaultRequestHeadersService.GetAsync(); var status = await _create.OrderStatus .WithName("Test".WithGuid()) .BuildAsync(); status.Name = "Test".WithGuid(); status.IsDeleted = true; await _orderStatusesClient.UpdateAsync(status, headers); var updatedStatus = await _orderStatusesClient.GetAsync(status.Id, headers); Assert.Equal(status.Name, updatedStatus.Name); Assert.Equal(status.IsDeleted, updatedStatus.IsDeleted); }