예제 #1
0
        public void DefaultValues()
        {
            var sut = new WhileLoop();

            Assert.AreEqual(new UnknownExpression(), sut.Condition);
            Assert.AreEqual(Lists.NewList <IStatement>(), sut.Body);
            Assert.AreNotEqual(0, sut.GetHashCode());
            Assert.AreNotEqual(1, sut.GetHashCode());
        }
예제 #2
0
        public void Equality_Default()
        {
            var a = new WhileLoop();
            var b = new WhileLoop();

            Assert.AreEqual(a, b);
            Assert.AreEqual(a.GetHashCode(), b.GetHashCode());
        }
예제 #3
0
        public void Equality_DifferentBody()
        {
            var a = new WhileLoop();

            a.Body.Add(new ContinueStatement());
            var b = new WhileLoop();

            b.Body.Add(new GotoStatement());
            Assert.AreNotEqual(a, b);
            Assert.AreNotEqual(a.GetHashCode(), b.GetHashCode());
        }
예제 #4
0
        public void Equality_DifferentCondition()
        {
            var a = new WhileLoop {
                Condition = new ConstantValueExpression()
            };
            var b = new WhileLoop {
                Condition = new ReferenceExpression()
            };

            Assert.AreNotEqual(a, b);
            Assert.AreNotEqual(a.GetHashCode(), b.GetHashCode());
        }
예제 #5
0
        public void Equality_ReallyTheSame()
        {
            var a = new WhileLoop {
                Condition = new ConstantValueExpression()
            };

            a.Body.Add(new ReturnStatement());
            var b = new WhileLoop {
                Condition = new ConstantValueExpression()
            };

            b.Body.Add(new ReturnStatement());
            Assert.AreEqual(a, b);
            Assert.AreEqual(a.GetHashCode(), b.GetHashCode());
        }