Ejemplo n.º 1
0
        public void Int16AndUInt16ConvertToStringTest()
        {
            Int16  val0 = 0;
            Int16  val1 = 1;
            Int16  val2 = -1;
            UInt16 val3 = 0;
            UInt16 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");
        }