public void TestCaseDefaultConstructedAndStatic()
        {
            var parameterless = new StandardDialect();
            var iic           = new StandardDialect(CultureInfo.InvariantCulture, DialectCasing.IgnoreCase);
            var iuc           = new StandardDialect(CultureInfo.InvariantCulture, DialectCasing.UpperCase);

            Assert.AreEqual(iic, parameterless);
            Assert.AreEqual(iic.GetHashCode(), parameterless.GetHashCode());

            Assert.AreEqual(iuc, StandardDialect.Default);
            Assert.AreEqual(iuc.GetHashCode(), StandardDialect.Default.GetHashCode());

            Assert.AreEqual(iic, StandardDialect.DefaultIgnoreCase);
            Assert.AreEqual(iic.GetHashCode(), StandardDialect.DefaultIgnoreCase.GetHashCode());
        }
Ejemplo n.º 2
0
        public void TestCaseEquality()
        {
            /* Build dialects. */
            var iic = new CodeMonkeyDialect(DialectCasing.IgnoreCase);
            var iuc = new CodeMonkeyDialect(DialectCasing.UpperCase);
            var ilc = new CodeMonkeyDialect(DialectCasing.LowerCase);

            /* 1 */
            Assert.AreEqual(iic, iic);
            Assert.AreNotEqual(iic, iuc);
            Assert.AreNotEqual(iic.GetHashCode(), iuc.GetHashCode());
            Assert.AreNotEqual(iic, ilc);
            Assert.AreNotEqual(iic.GetHashCode(), ilc.GetHashCode());

            /* 2 */
            Assert.AreEqual(iuc, iuc);
            Assert.AreNotEqual(iuc, ilc);
            Assert.AreNotEqual(iuc.GetHashCode(), ilc.GetHashCode());

            /* 3 */
            Assert.AreEqual(ilc, ilc);

            /* 4 */
            var siic = new StandardDialect(CultureInfo.InvariantCulture, DialectCasing.IgnoreCase);
            var siuc = new StandardDialect(CultureInfo.InvariantCulture, DialectCasing.UpperCase);
            var silc = new StandardDialect(CultureInfo.InvariantCulture, DialectCasing.LowerCase);

            Assert.AreNotEqual(iic, siic);
            Assert.AreNotEqual(iuc, siuc);
            Assert.AreNotEqual(ilc, silc);
            Assert.AreNotEqual(iic.GetHashCode(), siic.GetHashCode());
            Assert.AreNotEqual(iuc.GetHashCode(), siuc.GetHashCode());
            Assert.AreNotEqual(ilc.GetHashCode(), silc.GetHashCode());

            /* Special */
            Assert.AreNotEqual(iic, this);
            Assert.AreNotEqual(iic, null);
        }