예제 #1
0
        public async Task Handle_GetAllTableSortedUsersWithDefaultRequest_WithBadCase_ReturnsAllEntitiesSortedByDefault()
        {
            await SeedSortEntities();

            var request = new GetAllTableSortedUsers
            {
                PrimaryColumn = "BadProperty"
            };

            var response = await Mediator.HandleAsync(request);

            Assert.IsFalse(response.HasErrors);
            Assert.IsNotNull(response.Result);
            Assert.AreEqual(6, response.Result.Items.Count);
            Assert.AreEqual("AUser", response.Result.Items[0].Name);
            Assert.AreEqual("BUser", response.Result.Items[1].Name);
            Assert.AreEqual("CUser", response.Result.Items[2].Name);
            Assert.AreEqual("DUser", response.Result.Items[3].Name);
            Assert.AreEqual("EUser", response.Result.Items[4].Name);
            Assert.AreEqual("FUser", response.Result.Items[5].Name);
        }
예제 #2
0
        public async Task Handle_GetAllTableSortedUsersRequest_ByNameThenByIsDeleted_ReturnsAllEntitiesSorted()
        {
            await SeedSortEntities();

            var request = new GetAllTableSortedUsers
            {
                PrimaryColumn      = UsersSortColumn.Name,
                SecondaryColumn    = UsersSortColumn.IsDeleted,
                SecondaryDirection = 1
            };

            var response = await Mediator.HandleAsync(request);

            Assert.IsFalse(response.HasErrors);
            Assert.IsNotNull(response.Result);
            Assert.AreEqual(6, response.Result.Items.Count);
            Assert.AreEqual("AUser", response.Result.Items[0].Name);
            Assert.AreEqual("BUser", response.Result.Items[1].Name);
            Assert.AreEqual("CUser", response.Result.Items[2].Name);
            Assert.AreEqual("DUser", response.Result.Items[3].Name);
            Assert.AreEqual("EUser", response.Result.Items[4].Name);
            Assert.AreEqual("FUser", response.Result.Items[5].Name);
        }