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