Example #1
0
        public void SinglePoem_ExpectReturnedListWithSamePoem()
        {
            //Arrange
            var poems        = new PoemBuilder().Default().BuildCollection(size: 1).ToList();
            var queryable    = poems.AsQueryable();
            var expectResult = poems;

            //Act
            var spec       = new ListPoemsByConceivedDateSpec();
            var testResult = queryable.OrderByDescending(spec.OrderByDesc);

            //Assert
            Assert.Null(spec.Criteria);
            Assert.Null(spec.OrderBy);
            Assert.Equal(expectResult, testResult);
        }
Example #2
0
        public void ListWithConceivedDateInDescOrder_ExpectReturnedListInDescOrder()
        {
            //Arrange
            var poems = new PoemBuilder().Default().BuildCollection(size: 3).ToList();

            poems[0].ConceivedDateUTC = DateTime.UtcNow.AddDays(-1);
            poems[1].ConceivedDateUTC = DateTime.UtcNow.AddDays(-2);
            poems[2].ConceivedDateUTC = DateTime.UtcNow.AddDays(-3);
            var queryable    = poems.AsQueryable();
            var expectResult = poems;

            //Act
            var spec       = new ListPoemsByConceivedDateSpec();
            var testResult = queryable.OrderByDescending(spec.OrderByDesc);

            //Assert
            Assert.Equal(expectResult, testResult);
        }