コード例 #1
0
        public void GetHashCode_NoOrderings_ReturnsZero()
        {
            var queryPart = new OrderByQueryPart();

            var expected = 0;

            Assert.That(queryPart.GetHashCode(), Is.EqualTo(expected));
        }
コード例 #2
0
        public void GetHashCode_MultipleOrderings_ReturnsCorrectValue()
        {
            var queryPart = new OrderByQueryPart(new ODataOrdering("Hello", ODataOrderingDirection.Asc), new ODataOrdering("World", ODataOrderingDirection.Desc));

            var expected = String.Format("Orderings:Hello asc,World desc;");

            Assert.That(queryPart.GetHashCode(), Is.EqualTo(expected.GetHashCode()));
        }
コード例 #3
0
        public void Equals_ObjectSelf_ReturnsTrue()
        {
            var queryPart = new OrderByQueryPart();
            object other = queryPart;

            var actual = queryPart.Equals(other);

            Assert.That(actual, Is.True);
        }
コード例 #4
0
        public void Equals_Self_ReturnsTrue()
        {
            var queryPart = new OrderByQueryPart();
            var other     = queryPart;

            var actual = queryPart.Equals(other);

            Assert.That(actual, Is.True);
        }
コード例 #5
0
        public void Equals_ObjectOfDifferentType_ReturnsFalse()
        {
            var    queryPart = new OrderByQueryPart();
            object other     = String.Empty;

            var actual = queryPart.Equals(other);

            Assert.That(actual, Is.False);
        }
コード例 #6
0
        public void Equals_AnotherEquivalentOrderByQueryPart_ReturnsTrue()
        {
            var queryPart = new OrderByQueryPart();
            var other     = new OrderByQueryPart();

            var actual = queryPart.Equals(other);

            Assert.That(actual, Is.True);
        }
コード例 #7
0
        public void Equals_AnotherDifferentOrderByQueryPart_ReturnsFalse()
        {
            var queryPart = new OrderByQueryPart(new ODataOrdering("World", ODataOrderingDirection.Desc));
            var other     = new OrderByQueryPart(new ODataOrdering("Hello", ODataOrderingDirection.Asc));

            var actual = queryPart.Equals(other);

            Assert.That(actual, Is.False);
        }
コード例 #8
0
        public void Equals_OrderByQueryPartNull_ReturnsFalse()
        {
            var queryPart          = new OrderByQueryPart();
            OrderByQueryPart other = null;

            var actual = queryPart.Equals(other);

            Assert.That(actual, Is.False);
        }
コード例 #9
0
        public void ToString_TwoOrderings_ReturnsCommaSeperatedList()
        {
            var orderByQueryPart = new OrderByQueryPart();

            orderByQueryPart.AddOrdering(new ODataOrdering("Hello", ODataOrderingDirection.Asc));
            orderByQueryPart.AddOrdering(new ODataOrdering("World", ODataOrderingDirection.Desc));

            Assert.That(orderByQueryPart.ToString(), Is.EqualTo("$orderby=Hello asc, World desc"));
        }
コード例 #10
0
        public void Equals_ObjectOfDifferentType_ReturnsFalse()
        {
            var queryPart = new OrderByQueryPart();
            object other = String.Empty;

            var actual = queryPart.Equals(other);

            Assert.That(actual, Is.False);
        }
コード例 #11
0
        public void Equals_ObjectNull_ReturnsFalse()
        {
            var queryPart = new OrderByQueryPart();
            object other = null;

            var actual = queryPart.Equals(other);

            Assert.That(actual, Is.False);
        }
コード例 #12
0
        public void Equals_ObjectAnotherEquivalentOrderByQueryPart_ReturnsTrue()
        {
            var queryPart = new OrderByQueryPart();
            object other = new OrderByQueryPart();

            var actual = queryPart.Equals(other);

            Assert.That(actual, Is.True);
        }
コード例 #13
0
        public void Equals_AnotherDifferentOrderByQueryPart_ReturnsFalse()
        {
            var queryPart = new OrderByQueryPart(new ODataOrdering("World", ODataOrderingDirection.Desc));
            var other = new OrderByQueryPart(new ODataOrdering("Hello", ODataOrderingDirection.Asc));

            var actual = queryPart.Equals(other);

            Assert.That(actual, Is.False);
        }
コード例 #14
0
        public void OrderByQueryPart_InheritsFromIEquatable()
        {
            var actual = new OrderByQueryPart();

            Assert.That(actual, Is.InstanceOf <IEquatable <OrderByQueryPart> >());
        }
コード例 #15
0
        public void ToString_NoOrderings_ReturnsEmptyString()
        {
            var orderByQueryPart = new OrderByQueryPart();

            Assert.That(orderByQueryPart.ToString(), Is.EqualTo(String.Empty));
        }
コード例 #16
0
        public void OrderByQueryPart_InheritsFromIEquatable()
        {
            var actual = new OrderByQueryPart();

            Assert.That(actual, Is.InstanceOf<IEquatable<OrderByQueryPart>>());
        }
コード例 #17
0
        public void ToString_NoOrderings_ReturnsEmptyString()
        {
            var orderByQueryPart = new OrderByQueryPart();

            Assert.That(orderByQueryPart.ToString(), Is.EqualTo(String.Empty));
        }
コード例 #18
0
        public void GetHashCode_NoOrderings_ReturnsZero()
        {
            var queryPart = new OrderByQueryPart();

            var expected = 0;

            Assert.That(queryPart.GetHashCode(), Is.EqualTo(expected));
        }
コード例 #19
0
        public void ToString_TwoOrderings_ReturnsCommaSeperatedList()
        {
            var orderByQueryPart = new OrderByQueryPart();

            orderByQueryPart.AddOrdering(new ODataOrdering("Hello", ODataOrderingDirection.Asc));
            orderByQueryPart.AddOrdering(new ODataOrdering("World", ODataOrderingDirection.Desc));

            Assert.That(orderByQueryPart.ToString(), Is.EqualTo("$orderby=Hello asc, World desc"));
        }
コード例 #20
0
        protected virtual OrderByQueryPart VisitOrderBy(OrderByQueryPart orderBy)
        {
            foreach (var ordering in orderBy.Orderings)
            {
                Visit(ordering);
            }

            return orderBy;
        }
コード例 #21
0
        public void GetHashCode_MultipleOrderings_ReturnsCorrectValue()
        {
            var queryPart = new OrderByQueryPart(new ODataOrdering("Hello", ODataOrderingDirection.Asc), new ODataOrdering("World", ODataOrderingDirection.Desc));

            var expected = String.Format("Orderings:Hello asc,World desc;");

            Assert.That(queryPart.GetHashCode(), Is.EqualTo(expected.GetHashCode()));
        }