コード例 #1
0
        public void Parse_WithOrderSpecification_MultipleSpaces()
        {
            var sortExpression = "Product  desc";

            var result = _parser.Parse(sortExpression);

            var expected = new[] { SortExpressionDefinitionObjectMother.CreateSortedPropertyDescending(_productPropertyDefinition) };

            Assert.That(result.SortedProperties, Is.EqualTo(expected));
        }
コード例 #2
0
        public void Parse_Many_TrailingComma()
        {
            var sortExpression = "Product asc,Position,Order desc,";

            var result = _parser.Parse(sortExpression);

            var expected = new[]
            {
                SortExpressionDefinitionObjectMother.CreateSortedPropertyAscending(_productPropertyDefinition),
                SortExpressionDefinitionObjectMother.CreateSortedPropertyAscending(_positionPropertyDefinition),
                SortExpressionDefinitionObjectMother.CreateSortedPropertyDescending(_orderPropertyDefinition)
            };

            Assert.That(result.SortedProperties, Is.EqualTo(expected));
        }
コード例 #3
0
        public void Parse_RoundTrip()
        {
            var sortExpression = "Product asc, Position, Order desc";

            var result1 = _parser.Parse(sortExpression);
            var result2 = _parser.Parse(result1.ToString());

            var expected = new[]
            {
                SortExpressionDefinitionObjectMother.CreateSortedPropertyAscending(_productPropertyDefinition),
                SortExpressionDefinitionObjectMother.CreateSortedPropertyAscending(_positionPropertyDefinition),
                SortExpressionDefinitionObjectMother.CreateSortedPropertyDescending(_orderPropertyDefinition)
            };

            Assert.That(result2.SortedProperties, Is.EqualTo(expected));
        }
コード例 #4
0
        public new void ToString()
        {
            var sortExpressionDefinition =
                new SortExpressionDefinition(
                    new[]
            {
                SortExpressionDefinitionObjectMother.CreateSortedPropertyAscending(_productPropertyDefinition),
                SortExpressionDefinitionObjectMother.CreateSortedPropertyDescending(_positionPropertyDefinition)
            });

            var result = sortExpressionDefinition.ToString();

            var expected =
                "Remotion.Data.DomainObjects.UnitTests.TestDomain.OrderItem.Product ASC, "
                + "Remotion.Data.DomainObjects.UnitTests.TestDomain.OrderItem.Position DESC";

            Assert.That(result, Is.EqualTo(expected));
        }