Пример #1
0
        public void DefaultValues()
        {
            var sut = new ForLoop();

            Assert.AreEqual(Lists.NewList <IStatement>(), sut.Init);
            Assert.AreEqual(new UnknownExpression(), sut.Condition);
            Assert.AreEqual(Lists.NewList <IStatement>(), sut.Step);
            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 ForLoop();
            var b = new ForLoop();

            Assert.AreEqual(a, b);
            Assert.AreEqual(a.GetHashCode(), b.GetHashCode());
        }
Пример #3
0
        public void Equality_DifferentBody()
        {
            var a = new ForLoop();

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

            Assert.AreNotEqual(a, b);
            Assert.AreNotEqual(a.GetHashCode(), b.GetHashCode());
        }
Пример #4
0
        public void Equality_DifferentStep()
        {
            var a = new ForLoop();

            a.Step.Add(new BreakStatement());
            var b = new ForLoop();

            Assert.AreNotEqual(a, b);
            Assert.AreNotEqual(a.GetHashCode(), b.GetHashCode());
        }
Пример #5
0
        public void Equality_DifferentInit()
        {
            var a = new ForLoop();

            a.Init.Add(new GotoStatement());
            var b = new ForLoop();

            Assert.AreNotEqual(a, b);
            Assert.AreNotEqual(a.GetHashCode(), b.GetHashCode());
        }
Пример #6
0
        public void Equality_DifferentCondition()
        {
            var a = new ForLoop {
                Condition = new ConstantValueExpression()
            };
            var b = new ForLoop();

            Assert.AreNotEqual(a, b);
            Assert.AreNotEqual(a.GetHashCode(), b.GetHashCode());
        }
Пример #7
0
        public void Equality_ReallyTheSame()
        {
            var a = new ForLoop
            {
                Condition = new ConstantValueExpression(),
                Init      = { new GotoStatement() },
                Step      = { new BreakStatement() },
                Body      = { new ContinueStatement() }
            };
            var b = new ForLoop
            {
                Condition = new ConstantValueExpression(),
                Init      = { new GotoStatement() },
                Step      = { new BreakStatement() },
                Body      = { new ContinueStatement() }
            };

            Assert.AreEqual(a, b);
            Assert.AreEqual(a.GetHashCode(), b.GetHashCode());
        }