Exemple #1
0
        public void Int64AndUInt64ConvertToStringTest()
        {
            Int64  val0 = 0;
            Int64  val1 = 1;
            Int64  val2 = -1;
            UInt64 val3 = 0;
            UInt64 val4 = 1;

            val0.CastToString().ShouldBe("0");
            val1.CastToString().ShouldBe("1");
            val2.CastToString().ShouldBe("-1");
            val3.CastToString().ShouldBe("0");
            val4.CastToString().ShouldBe("1");

            val0.CastToString("---").ShouldBe("0");
            val1.CastToString("---").ShouldBe("1");
            val2.CastToString("---").ShouldBe("-1");
            val3.CastToString("---").ShouldBe("0");
            val4.CastToString("---").ShouldBe("1");

            val0.CastToString(NumericConvOptions.ZeroAsEmpty).ShouldBe("0");
            val1.CastToString(NumericConvOptions.ZeroAsEmpty).ShouldBe("1");
            val2.CastToString(NumericConvOptions.ZeroAsEmpty).ShouldBe("-1");
            val3.CastToString(NumericConvOptions.ZeroAsEmpty).ShouldBe("0");
            val4.CastToString(NumericConvOptions.ZeroAsEmpty).ShouldBe("1");

            val0.CastToString(NumericConvOptions.ZeroAsEmpty, "---").ShouldBe("---");
            val1.CastToString(NumericConvOptions.ZeroAsEmpty, "---").ShouldBe("1");
            val2.CastToString(NumericConvOptions.ZeroAsEmpty, "---").ShouldBe("-1");
            val3.CastToString(NumericConvOptions.ZeroAsEmpty, "---").ShouldBe("---");
            val4.CastToString(NumericConvOptions.ZeroAsEmpty, "---").ShouldBe("1");
        }