public void WhenFilterContainSortDescriptionWithoutDirectionThenCreatesMatchingAscendingSortDescription()
            {
                const string Orderstring = "IntValue";

                var descriptions = _factory.Create <FakeItem>(Orderstring);
                var filter       = new ModelFilter <FakeItem>(x => true, null, descriptions, 0, -1, false);

                var sortedItems = filter.Filter(_items)
                                  .ToArray();

                Assert.AreEqual(
                    1,
                    sortedItems.OfType <FakeItem>()
                    .ElementAt(0)
                    .IntValue);
                Assert.AreEqual(
                    2,
                    sortedItems.OfType <FakeItem>()
                    .ElementAt(1)
                    .IntValue);
                Assert.AreEqual(
                    3,
                    sortedItems.OfType <FakeItem>()
                    .ElementAt(2)
                    .IntValue);
            }
            public void WhenOrderingByChildPropertyThenUsesChildProperty()
            {
                const string Orderstring = "StringValue/Length desc";

                var descriptions = _factory.Create <FakeItem>(Orderstring);
                var filter       = new ModelFilter <FakeItem>(x => true, null, descriptions, 0, -1, false);
                var sortedItems  = filter.Filter(_items)
                                   .ToArray();

                Assert.AreEqual(
                    "aaa",
                    sortedItems.OfType <FakeItem>()
                    .ElementAt(0)
                    .StringValue);
                Assert.AreEqual(
                    "aa",
                    sortedItems.OfType <FakeItem>()
                    .ElementAt(1)
                    .StringValue);
                Assert.AreEqual(
                    "a",
                    sortedItems.OfType <FakeItem>()
                    .ElementAt(2)
                    .StringValue);
            }
            public void WhenFilterContainsSortMultipleDescriptionsWithSpaceBetweenThenSortsByAll()
            {
                const string Orderstring = "DoubleValue, IntValue desc";

                var descriptions = _factory.Create <FakeItem>(Orderstring);
                var filter       = new ModelFilter <FakeItem>(x => true, null, descriptions, 0, -1, false);

                var sortedItems = filter.Filter(_items)
                                  .ToArray();

                Assert.AreEqual(
                    3,
                    sortedItems.OfType <FakeItem>()
                    .ElementAt(0)
                    .IntValue);
                Assert.AreEqual(
                    1,
                    sortedItems.OfType <FakeItem>()
                    .ElementAt(1)
                    .IntValue);
                Assert.AreEqual(
                    2,
                    sortedItems.OfType <FakeItem>()
                    .ElementAt(2)
                    .IntValue);
            }
			public void WhenFilterContainSortDescriptionWithoutDirectionThenCreatesMatchingAscendingSortDescription()
			{
				const string Orderstring = "IntValue";

				var descriptions = _factory.Create<FakeItem>(Orderstring);
				var filter = new ModelFilter<FakeItem>(x => true, null, descriptions, 0, -1, false);

				var sortedItems = filter.Filter(_items)
					.ToArray();

				Assert.AreEqual(
					1,
					sortedItems.OfType<FakeItem>()
						.ElementAt(0)
						.IntValue);
				Assert.AreEqual(
					2,
					sortedItems.OfType<FakeItem>()
						.ElementAt(1)
						.IntValue);
				Assert.AreEqual(
					3,
					sortedItems.OfType<FakeItem>()
						.ElementAt(2)
						.IntValue);
			}
            public void WhenFilterIsEmptyThenDoesNotSort()
            {
                var descriptions = _factory.Create <AliasItem>(string.Empty);
                var filter       = new ModelFilter <AliasItem>(x => true, null, descriptions, 0, -1, false);

                var sortedItems = filter.Filter(_items)
                                  .ToArray();

                Assert.AreEqual(2, sortedItems.OfType <AliasItem>().ElementAt(0).AliasIntValue);
                Assert.AreEqual(1, sortedItems.OfType <AliasItem>().ElementAt(1).AliasIntValue);
                Assert.AreEqual(3, sortedItems.OfType <AliasItem>().ElementAt(2).AliasIntValue);
            }
			public void WhenOrderingByChildPropertyThenUsesChildProperty()
			{
				const string Orderstring = "StringValue/Length desc";

				var descriptions = _factory.Create<AliasItem>(Orderstring);
                var filter = new ModelFilter<AliasItem>(x => true, null, descriptions, 0, -1, false);
				var sortedItems = filter.Filter(_items)
					.ToArray();

				Assert.AreEqual("aaa", sortedItems.OfType<AliasItem>().ElementAt(0).StringValue);
				Assert.AreEqual("aa", sortedItems.OfType<AliasItem>().ElementAt(1).StringValue);
				Assert.AreEqual("a", sortedItems.OfType<AliasItem>().ElementAt(2).StringValue);
			}
			public void WhenFilterIsEmptyThenDoesNotSort()
			{
				var descriptions = _factory.Create<AliasItem>(string.Empty);
                var filter = new ModelFilter<AliasItem>(x => true, null, descriptions, 0, -1, false);

				var sortedItems = filter.Filter(_items)
					.ToArray();

				Assert.AreEqual(2, sortedItems.OfType<AliasItem>().ElementAt(0).AliasIntValue);
				Assert.AreEqual(1, sortedItems.OfType<AliasItem>().ElementAt(1).AliasIntValue);
				Assert.AreEqual(3, sortedItems.OfType<AliasItem>().ElementAt(2).AliasIntValue);
			}
			public void WhenFilterContainsSortMultipleDescriptionsWithSpaceBetweenThenSortsByAll()
			{
				const string Orderstring = "DoubleValue, IntValue desc";

				var descriptions = _factory.Create<AliasItem>(Orderstring);
                var filter = new ModelFilter<AliasItem>(x => true, null, descriptions, 0, -1, false);

				var sortedItems = filter.Filter(_items)
					.ToArray();

				Assert.AreEqual(3, sortedItems.OfType<AliasItem>().ElementAt(0).AliasIntValue);
				Assert.AreEqual(1, sortedItems.OfType<AliasItem>().ElementAt(1).AliasIntValue);
				Assert.AreEqual(2, sortedItems.OfType<AliasItem>().ElementAt(2).AliasIntValue);
			}