public async Task Handle_GetAllUsersPagedRequest_NoPageSize_ReturnsAllEntities() { await SeedEntities(); var request = new GetAllUsersPaged { PageSize = 0 }; var response = await Mediator.HandleAsync(request); Assert.IsFalse(response.HasErrors); Assert.IsNotNull(response.Result); Assert.AreEqual(1, response.Result.PageNumber); Assert.AreEqual(6, response.Result.PageSize); Assert.AreEqual(1, response.Result.PageCount); Assert.AreEqual(6, response.Result.TotalItemCount); Assert.AreEqual(6, response.Result.Items.Count); Assert.AreEqual("FUser", response.Result.Items[0].Name); Assert.AreEqual("EUser", response.Result.Items[1].Name); Assert.AreEqual("DUser", response.Result.Items[2].Name); Assert.AreEqual("CUser", response.Result.Items[3].Name); Assert.AreEqual("BUser", response.Result.Items[4].Name); Assert.AreEqual("AUser", response.Result.Items[5].Name); }
public async Task Handle_GetAllUsersPagedRequest_WithPageNumber_ReturnsPagedEntities() { await SeedEntities(); var request = new GetAllUsersPaged { PageSize = 2, PageNumber = 2 }; var response = await Mediator.HandleAsync(request); Assert.IsFalse(response.HasErrors); Assert.IsNotNull(response.Result); Assert.AreEqual(2, response.Result.PageNumber); Assert.AreEqual(2, response.Result.PageSize); Assert.AreEqual(3, response.Result.PageCount); Assert.AreEqual(6, response.Result.TotalItemCount); Assert.AreEqual(2, response.Result.Items.Count); Assert.AreEqual("DUser", response.Result.Items[0].Name); Assert.AreEqual("CUser", response.Result.Items[1].Name); }