Esempio n. 1
0
        public void DefaultValues()
        {
            var sut = new CatchBlock();

            Assert.AreEqual(Names.UnknownParameter, sut.Parameter);
            Assert.AreEqual(Lists.NewList <IStatement>(), sut.Body);
            Assert.AreEqual(CatchBlockKind.Default, sut.Kind);
            Assert.AreNotEqual(0, sut.GetHashCode());
            Assert.AreNotEqual(1, sut.GetHashCode());
        }
Esempio n. 2
0
        public void Equality_Default()
        {
            var a = new CatchBlock();
            var b = new CatchBlock();

            Assert.AreEqual(a, b);
            Assert.AreEqual(a.GetHashCode(), b.GetHashCode());
        }
Esempio n. 3
0
        public void Equality_DifferentKind()
        {
            var a = new CatchBlock {
                Kind = CatchBlockKind.General
            };
            var b = new CatchBlock();

            Assert.AreNotEqual(a, b);
            Assert.AreNotEqual(a.GetHashCode(), b.GetHashCode());
        }
Esempio n. 4
0
        public void Equality_DifferentParameter()
        {
            var a = new CatchBlock {
                Parameter = SomeParameter()
            };
            var b = new CatchBlock();

            Assert.AreNotEqual(a, b);
            Assert.AreNotEqual(a.GetHashCode(), b.GetHashCode());
        }
Esempio n. 5
0
        public void Equality_DifferentBody()
        {
            var a = new CatchBlock
            {
                Body =
                {
                    new ReturnStatement()
                }
            };
            var b = new CatchBlock();

            Assert.AreNotEqual(a, b);
            Assert.AreNotEqual(a.GetHashCode(), b.GetHashCode());
        }
Esempio n. 6
0
        public void Equality_ReallyTheSame()
        {
            var a = new CatchBlock
            {
                Kind      = CatchBlockKind.General,
                Parameter = SomeParameter(),
                Body      =
                {
                    new ReturnStatement()
                }
            };
            var b = new CatchBlock
            {
                Kind      = CatchBlockKind.General,
                Parameter = SomeParameter(),
                Body      =
                {
                    new ReturnStatement()
                }
            };

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