public void ShouldConvertToCellValue() { //Arrange string value0; string value1; string value2; var converter = new FloatConverter(); //Act bool success0 = converter.TryConvertToCellValue(0.123f, out value0); bool success1 = converter.TryConvertToCellValue(1000000000f, out value1); bool success2 = converter.TryConvertToCellValue(-12.85f, out value2); //Assert Assert.IsTrue(success0); Assert.IsTrue(success1); Assert.IsTrue(success2); Assert.AreEqual("0.123", value0); Assert.AreEqual("1E+09", value1); Assert.AreEqual("-12.85", value2); }
public void ShouldFailToConvertToCellValue() { //Arrange string value0; string value1; string value2; var converter = new FloatConverter(); //Act bool success0 = converter.TryConvertToCellValue(0.18D, out value0); bool success1 = converter.TryConvertToCellValue("-1", out value1); bool success2 = converter.TryConvertToCellValue("NaN", out value2); //Assert Assert.IsFalse(success0); Assert.IsFalse(success1); Assert.IsFalse(success2); }