コード例 #1
0
 public void ShouldFailToConvertToCSharpValue()
 {
     //Arrange
     object value0;
     object value1;
     object value2;
     var converter = new FloatConverter();
     //Act
     bool success0 = converter.TryConvertToCSharpValue("9E10D", out value0);
     bool success1 = converter.TryConvertToCSharpValue("N/A", out value1);
     bool success2 = converter.TryConvertToCSharpValue("10000E", out value2);
     //Assert
     Assert.IsFalse(success0);
     Assert.IsFalse(success1);
     Assert.IsFalse(success2);
 }
コード例 #2
0
        public void ShouldConvertToCSharpValue()
        {
            //Arrange
            object value0;
            object value1;
            object value2;
            var converter = new FloatConverter();
            //Act
            bool success0 = converter.TryConvertToCSharpValue("0.123", out value0);
            bool success1 = converter.TryConvertToCSharpValue("9E10", out value1);
            bool success2 = converter.TryConvertToCSharpValue("-12.84848715", out value2);
            //Assert
            Assert.IsTrue(success0);
            Assert.IsTrue(success1);
            Assert.IsTrue(success2);
            Assert.AreEqual(0.123f, value0);
            Assert.AreEqual(9E10f, value1);
            Assert.AreEqual(-12.84848715f, value2);


        }