Beispiel #1
0
        public void Equals_ObjectAnotherEquivalentTopQueryPart_ReturnsTrue()
        {
            var    queryPart = new TopQueryPart();
            object other     = new TopQueryPart();

            var actual = queryPart.Equals(other);

            Assert.That(actual, Is.True);
        }
Beispiel #2
0
        public void GetHashCode_NoParameterConstructorUsed_ReturnsZero()
        {
            var queryPart = new TopQueryPart();

            var expected = 0;
            var actual   = queryPart.GetHashCode();

            Assert.That(actual, Is.EqualTo(expected));
        }
Beispiel #3
0
        public void Equals_Self_ReturnsTrue()
        {
            var queryPart = new TopQueryPart();
            var other     = queryPart;

            var actual = queryPart.Equals(other);

            Assert.That(actual, Is.True);
        }
Beispiel #4
0
        public void Equals_AnotherDifferentTopQueryPart_ReturnsFalse()
        {
            var queryPart = new TopQueryPart();
            var other     = new TopQueryPart(3);

            var actual = queryPart.Equals(other);

            Assert.That(actual, Is.False);
        }
Beispiel #5
0
        public void Equals_TopQueryPartNull_ReturnsFalse()
        {
            var          queryPart = new TopQueryPart();
            TopQueryPart other     = null;

            var actual = queryPart.Equals(other);

            Assert.That(actual, Is.False);
        }
Beispiel #6
0
        public void Equals_ObjectOfDifferentType_ReturnsFalse()
        {
            var    queryPart = new TopQueryPart();
            object other     = String.Empty;

            var actual = queryPart.Equals(other);

            Assert.That(actual, Is.False);
        }
        public void Equals_ObjectNull_ReturnsFalse()
        {
            var queryPart = new TopQueryPart();
            object other = null;

            var actual = queryPart.Equals(other);

            Assert.That(actual, Is.False);
        }
        public void Equals_ObjectAnotherEquivalentTopQueryPart_ReturnsTrue()
        {
            var queryPart = new TopQueryPart();
            object other = new TopQueryPart();

            var actual = queryPart.Equals(other);

            Assert.That(actual, Is.True);
        }
        public void Equals_ObjectOfDifferentType_ReturnsFalse()
        {
            var queryPart = new TopQueryPart();
            object other = String.Empty;

            var actual = queryPart.Equals(other);

            Assert.That(actual, Is.False);
        }
Beispiel #10
0
        public void GetHashCode_NumberPassedIntoConstructor_ReturnsNumber()
        {
            var queryPart = new TopQueryPart(5);

            var expected = 5;
            var actual   = queryPart.GetHashCode();

            Assert.That(actual, Is.EqualTo(expected));
        }
Beispiel #11
0
        public void GetHashCode_NullPassedToConstructor_ReturnsZero()
        {
            var queryPart = new TopQueryPart(null);

            var expected = 0;
            var actual   = queryPart.GetHashCode();

            Assert.That(actual, Is.EqualTo(expected));
        }
        public void Equals_AnotherDifferentTopQueryPart_ReturnsFalse()
        {
            var queryPart = new TopQueryPart();
            var other = new TopQueryPart(3);

            var actual = queryPart.Equals(other);

            Assert.That(actual, Is.False);
        }
        public void Equals_ObjectSelf_ReturnsTrue()
        {
            var queryPart = new TopQueryPart();
            object other = queryPart;

            var actual = queryPart.Equals(other);

            Assert.That(actual, Is.True);
        }
        protected override TopQueryPart VisitTop(TopQueryPart top)
        {
            if (top.NumberToTake.HasValue)
            {
                var takeNumber = Expression.Constant(top.NumberToTake.Value, typeof(int));

                _expression = Expression.Call(typeof(Queryable), "Take", new[] { _itemType }, new[] { _expression, takeNumber });
            }

            return(base.VisitTop(top));
        }
 protected virtual TopQueryPart VisitTop(TopQueryPart top)
 {
     return top;
 }
Beispiel #16
0
        public void ToString_NullCount_ReturnsEmptyString()
        {
            var skipQueryPart = new TopQueryPart(null);

            Assert.That(skipQueryPart.ToString(), Is.EqualTo(String.Empty));
        }
Beispiel #17
0
        public void TopQueryPart_InheritsFromIEquatable()
        {
            var actual = new TopQueryPart();

            Assert.That(actual, Is.InstanceOf <IEquatable <TopQueryPart> >());
        }
        public void GetHashCode_NoParameterConstructorUsed_ReturnsZero()
        {
            var queryPart = new TopQueryPart();

            var expected = 0;
            var actual = queryPart.GetHashCode();

            Assert.That(actual, Is.EqualTo(expected));
        }
Beispiel #19
0
        public void ToString_ZeroTakeCount_ReturnsCorrectString()
        {
            var skipQueryPart = new TopQueryPart(0);

            Assert.That(skipQueryPart.ToString(), Is.EqualTo("$top=0"));
        }
        public void ToString_ZeroTakeCount_ReturnsCorrectString()
        {
            var skipQueryPart = new TopQueryPart(0);

            Assert.That(skipQueryPart.ToString(), Is.EqualTo("$top=0"));
        }
        public void ToString_NullCount_ReturnsEmptyString()
        {
            var skipQueryPart = new TopQueryPart(null);

            Assert.That(skipQueryPart.ToString(), Is.EqualTo(String.Empty));
        }
        public void TopQueryPart_InheritsFromIEquatable()
        {
            var actual = new TopQueryPart();

            Assert.That(actual, Is.InstanceOf<IEquatable<TopQueryPart>>());
        }
        public void GetHashCode_NumberPassedIntoConstructor_ReturnsNumber()
        {
            var queryPart = new TopQueryPart(5);

            var expected = 5;
            var actual = queryPart.GetHashCode();

            Assert.That(actual, Is.EqualTo(expected));
        }
        public void GetHashCode_NullPassedToConstructor_ReturnsZero()
        {
            var queryPart = new TopQueryPart(null);

            var expected = 0;
            var actual = queryPart.GetHashCode();

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