AddThenByRequest() 공개 메소드

public AddThenByRequest ( string propertyName, OrderByDirection direction ) : void
propertyName string
direction OrderByDirection
리턴 void
        public void iquerable_should_be_sorted_correctly()
        {
            var now = DateTime.Now;

            var source = new[]
            {
                new DummyDocument
                {
                    Name = "Middle-2",
                    CreatedAt = now,
                    Count = 1,
                    ComplexType = new DummyPropertyDocument
                    {
                        DummyString = "b"
                    } 
                },
                new DummyDocument
                {
                    Name = "Middle",
                    CreatedAt = now,
                    Count = 10,
                    ComplexType = new DummyPropertyDocument
                    {
                        DummyString = "d"
                    } 
                },
                new DummyDocument
                {
                    Name = "Last",
                    CreatedAt = now.AddHours(1),
                    Count = 20,
                    ComplexType = new DummyPropertyDocument
                    {
                        DummyString = "a"
                    } 
                },
                new DummyDocument
                {
                    Name = "First",
                    CreatedAt = now.AddHours(-1),
                    Count= 0,
                    ComplexType = new DummyPropertyDocument
                    {
                        DummyString = "f"
                    } 
                }
            }
            .AsQueryable();

            var orderByRequest = new OrderByRequest("ComplexType.dummyString", OrderByDirection.Descending);
            orderByRequest.AddThenByRequest("count", OrderByDirection.Descending);

            var sortedData = source.DynamicOrderBy(
                orderByRequest);
            var expectedSortedData = source.OrderByDescending(document => document.ComplexType.DummyString).ThenByDescending(document => document.Count);

            sortedData.SequenceEqual(expectedSortedData).Should().BeTrue();
        }
        public void iquerable_should_be_sorted_correctly()
        {
            var now = DateTime.Now;

            var source = new[]
            {
                new DummyDocument
                {
                    Name = "Middle",
                    CreatedAt = now,
                    Count = 2
                },
                 new DummyDocument
                {
                    Name = "Middle",
                    CreatedAt = now,
                    Count = 0
                },
                new DummyDocument
                {
                    Name = "Middle-2",
                    CreatedAt = now,
                    Count = 10
                },
                new DummyDocument
                {
                    Name = "Middle",
                    CreatedAt = now,
                    Count = 1
                },
                new DummyDocument
                {
                    Name = "Last",
                    CreatedAt = now.AddHours(1),
                    Count = 20
                },
                new DummyDocument
                {
                    Name = "First",
                    CreatedAt = now.AddHours(-1),
                    Count= 0
                }
            }
            .AsQueryable();

            var orderByRequest = new OrderByRequest(
                propertyName: "createdAt",
                direction: OrderByDirection.Ascending);
            orderByRequest.AddThenByRequest("count", OrderByDirection.Ascending);

            var sortedData = source.DynamicOrderBy(orderByRequest);
            var expectedSortedData = source
                .OrderBy(document => document.CreatedAt)
                .ThenBy(document => document.Count);

            sortedData.SequenceEqual(expectedSortedData).Should().BeTrue();
        }