コード例 #1
0
        public void Not_Be_Able_To_Parse_A_Mallformed_String_Without_A_Separator()
        {
            const string decimalString = "A234567890";
            const decimal expectedResult = 0;

            decimal result;
            var attribute = new DecimalFormatAttribute(3);

            Assert.IsFalse(attribute.TryParse(decimalString, out result));
            Assert.AreEqual(expectedResult, result);
        }
コード例 #2
0
        public void Be_Able_To_Parse_A_String_Without_A_Separator_To_A_Decimal_With_Precision_Of_3()
        {
            const string decimalString = "1234567890";
            const decimal expectedResult = 1234567.890m;

            decimal result;
            var attribute = new DecimalFormatAttribute(3);

            Assert.IsTrue(attribute.TryParse(decimalString, out result));
            Assert.AreEqual(expectedResult, result);
        }