コード例 #1
0
        public void DefaultValues()
        {
            var sut = new ForEachLoop();

            Assert.AreEqual(new VariableDeclaration(), sut.Declaration);
            Assert.AreEqual(new VariableReference(), sut.LoopedReference);
            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 ForEachLoop();
            var b = new ForEachLoop();

            Assert.AreEqual(a, b);
            Assert.AreEqual(a.GetHashCode(), b.GetHashCode());
        }
コード例 #3
0
        public void Equality_DifferentBody()
        {
            var a = new ForEachLoop();

            a.Body.Add(new ReturnStatement());
            var b = new ForEachLoop();

            Assert.AreNotEqual(a, b);
            Assert.AreNotEqual(a.GetHashCode(), b.GetHashCode());
        }
コード例 #4
0
        public void Equality_DifferentDeclaration()
        {
            var a = new ForEachLoop {
                Declaration = SomeDeclaration()
            };
            var b = new ForEachLoop();

            Assert.AreNotEqual(a, b);
            Assert.AreNotEqual(a.GetHashCode(), b.GetHashCode());
        }
コード例 #5
0
        public void Equality_DifferentLoopedReference()
        {
            var a = new ForEachLoop {
                LoopedReference = SomeVarRef("a")
            };
            var b = new ForEachLoop();

            Assert.AreNotEqual(a, b);
            Assert.AreNotEqual(a.GetHashCode(), b.GetHashCode());
        }
コード例 #6
0
        public void Equality_ReallyTheSame()
        {
            var a = new ForEachLoop
            {
                LoopedReference = SomeVarRef("a"),
                Declaration     = SomeDeclaration(),
                Body            =
                {
                    new ReturnStatement()
                }
            };
            var b = new ForEachLoop
            {
                LoopedReference = SomeVarRef("a"),
                Declaration     = SomeDeclaration(),
                Body            =
                {
                    new ReturnStatement()
                }
            };

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