Ejemplo n.º 1
0
        public void TestVariableReferenceEquals()
        {
            VariableReference first = new VariableReference()
            {
                Name = "test"
            };

            VariableReference firstClone = new VariableReference()
            {
                Name = "test"
            };

            VariableReference second = new VariableReference()
            {
                Name = "test2"
            };

            //Equals
            Assert.IsTrue(Equals(first, firstClone));
            Assert.IsFalse(Equals(first, null));
            Assert.IsFalse(Equals(first, second));
            Assert.IsFalse(Equals(first, "other type"));

            //Hash code
            Assert.AreEqual(first.GetHashCode(), firstClone.GetHashCode());
            Assert.AreNotEqual(first.GetHashCode(), second.GetHashCode());
        }
        public void DefaultValues()
        {
            var sut = new VariableReference();

            Assert.AreEqual("", sut.Identifier);
            Assert.True(sut.IsMissing);
            Assert.AreNotEqual(0, sut.GetHashCode());
            Assert.AreNotEqual(1, sut.GetHashCode());
        }
        public void Equality_Default()
        {
            var a = new VariableReference();
            var b = new VariableReference();

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