Ejemplo n.º 1
0
        public void TestComparePrimitiveType01()
        {
            //Test Procedure Call
            int  comparedValue = 0;
            bool result        = BinaryHelper.ComparePrimitiveType(null, null, out comparedValue);

            //Post Condition Check
            Assert.IsFalse(result);
            Assert.AreEqual(0, comparedValue);

            //test2 --- first type is invalid type
            //Test Procedure Call
            result = BinaryHelper.ComparePrimitiveType(typeof(object), typeof(string), out comparedValue);
            //Post Condition Check
            Assert.IsFalse(result);
            Assert.AreEqual(0, comparedValue);

            //test3 --- second type greater type
            //Test Procedure Call
            result = BinaryHelper.ComparePrimitiveType(typeof(int), typeof(string), out comparedValue);
            //Post Condition Check
            Assert.IsTrue(result);
            Assert.AreEqual(-1, comparedValue);


            //test4 --- first type greater type
            //Test Procedure Call
            result = BinaryHelper.ComparePrimitiveType(typeof(string), typeof(int), out comparedValue);
            //Post Condition Check
            Assert.IsTrue(result);
            Assert.AreEqual(1, comparedValue);

            //test5 --- second type is invalid type
            //Test Procedure Call
            result = BinaryHelper.ComparePrimitiveType(typeof(int), typeof(object), out comparedValue);
            //Post Condition Check
            Assert.IsFalse(result);
            Assert.AreEqual(0, comparedValue);
        }