Example #1
0
        public void BitwiseMethods()
        {
            short    MaxValue   = SqlInt16.MaxValue.Value;
            SqlInt16 TestInt    = new SqlInt16(0);
            SqlInt16 TestIntMax = new SqlInt16(MaxValue);
            SqlInt16 TestInt2   = new SqlInt16(10922);
            SqlInt16 TestInt3   = new SqlInt16(21845);

            // BitwiseAnd
            Assert.AreEqual((short)21845, SqlInt16.BitwiseAnd(TestInt3, TestIntMax).Value, "Test#1");
            Assert.AreEqual((short)0, SqlInt16.BitwiseAnd(TestInt2, TestInt3).Value, "Test#2");
            Assert.AreEqual((short)10922, SqlInt16.BitwiseAnd(TestInt2, TestIntMax).Value, "Test#3");

            //BitwiseOr
            Assert.AreEqual((short)MaxValue, SqlInt16.BitwiseOr(TestInt2, TestInt3).Value, "Test#4");
            Assert.AreEqual((short)21845, SqlInt16.BitwiseOr(TestInt, TestInt3).Value, "Test#5");
            Assert.AreEqual((short)MaxValue, SqlInt16.BitwiseOr(TestIntMax, TestInt2).Value, "Test#6");
        }