示例#1
0
        public void DefaultValues()
        {
            var sut = new TryBlock();

            Assert.AreEqual(Lists.NewList <IStatement>(), sut.Body);
            Assert.AreEqual(Lists.NewList <ICatchBlock>(), sut.CatchBlocks);
            Assert.AreEqual(Lists.NewList <IStatement>(), sut.Finally);
            Assert.AreNotEqual(0, sut.GetHashCode());
            Assert.AreNotEqual(1, sut.GetHashCode());
        }
示例#2
0
        public void Equality_Default()
        {
            var a = new TryBlock();
            var b = new TryBlock();

            Assert.AreEqual(a, b);
            Assert.AreEqual(a.GetHashCode(), b.GetHashCode());
        }
示例#3
0
        public void Equality_DifferentBody()
        {
            var a = new TryBlock();

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

            Assert.AreNotEqual(a, b);
            Assert.AreNotEqual(a.GetHashCode(), b.GetHashCode());
        }
示例#4
0
        public void Equality_DifferentFinally()
        {
            var a = new TryBlock();

            a.Finally.Add(new ReturnStatement());
            var b = new TryBlock();

            Assert.AreNotEqual(a, b);
            Assert.AreNotEqual(a.GetHashCode(), b.GetHashCode());
        }
示例#5
0
        public void Equality_DifferentCatchs()
        {
            var a = new TryBlock();

            a.CatchBlocks.Add(new CatchBlock());
            var b = new TryBlock();

            Assert.AreNotEqual(a, b);
            Assert.AreNotEqual(a.GetHashCode(), b.GetHashCode());
        }
示例#6
0
        public void Equality_ReallyTheSame()
        {
            var a = new TryBlock();

            a.Body.Add(new ContinueStatement());
            a.CatchBlocks.Add(new CatchBlock());
            a.Finally.Add(new ReturnStatement());

            var b = new TryBlock();

            b.Body.Add(new ContinueStatement());
            b.CatchBlocks.Add(new CatchBlock());
            b.Finally.Add(new ReturnStatement());

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