Exemplo n.º 1
0
        private void assertintParsing(SifFormatter formatter, String stringValue, int value)
        {
            Console.WriteLine("Testing int parse of '" + stringValue + "' using " + formatter.ToString());
            int?testValue = formatter.ToInt(stringValue);

            Assertion.AssertEquals("int Value", value, testValue);
            Assertion.AssertEquals("String Value", stringValue, formatter.ToString(value));

            testValue = formatter.ToInt(null);
            Assertion.AssertNull("int value should be null", testValue);
        }
Exemplo n.º 2
0
        private void assertFloatParsing(SifFormatter formatter, String stringValue, float value)
        {
            Console.WriteLine("Testing Float parse of '" + stringValue + "' using " + formatter.ToString());
            float?testValue = formatter.ToFloat(stringValue);

            Assert.AreEqual(value, testValue);
            Assert.AreEqual(stringValue, formatter.ToString(value), "String Value");

            testValue = formatter.ToFloat(null);
            Assert.IsFalse(testValue.HasValue, "Float value should be null");
        }
Exemplo n.º 3
0
        private void assertBooleanParsing(SifFormatter formatter, String stringValue, Boolean value)
        {
            Console.WriteLine("Testing Boolean parse of '" + stringValue + "' using " + formatter.ToString());
            Boolean?testValue = formatter.ToBool(stringValue);

            Assertion.AssertEquals("Boolean Value", value, testValue);
            Assertion.AssertEquals("String Value", stringValue, formatter.ToString(value));

            testValue = formatter.ToBool(null);
            Assertion.AssertNull("Boolean value should be null", testValue);
        }
Exemplo n.º 4
0
        private void AssertDateParsing(SifFormatter formatter, String stringValue, Calendar value)
        {
            Console.WriteLine("Testing Date parse of '" + stringValue + "' using " + formatter.ToString());
            //Calendar testValue = formatter.ToDate(stringValue);
            DateTime testValue = (DateTime)formatter.ToDate(stringValue);

            Assertion.AssertEquals("Date Value", value, testValue);
            Assertion.AssertEquals("String Value", stringValue, (String)formatter.ToDateString(testValue));

            testValue = (DateTime)formatter.ToDate(null);
            Assertion.AssertNull("Date value should be null", testValue);
        }