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

            //Act
            var spec       = new ListPoemsByNameSpec();
            var testResult = queryable.OrderBy(spec.OrderBy);

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

            poems[0].Name = "A " + poems[0].Name;
            poems[1].Name = "B " + poems[1].Name;;
            poems[2].Name = "C " + poems[2].Name;;
            var queryable    = poems.AsQueryable();
            var expectResult = poems;

            //Act
            var spec       = new ListPoemsByNameSpec();
            var testResult = queryable.OrderBy(spec.OrderBy);

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