public void ShouldConvertToCellValue() { //Arrange string value0; string value1; string value2; var converter = new DecimalConverter(); //Act bool success0 = converter.TryConvertToCellValue(0.123m, out value0); bool success1 = converter.TryConvertToCellValue(1000000000m, out value1); bool success2 = converter.TryConvertToCellValue(-12.84848715m, out value2); //Assert Assert.IsTrue(success0); Assert.IsTrue(success1); Assert.IsTrue(success2); Assert.AreEqual("0.123", value0); Assert.AreEqual("1000000000", value1); Assert.AreEqual("-12.84848715", value2); }
public void ShouldFailToConvertToCellValue() { //Arrange string value0; string value1; string value2; var converter = new DecimalConverter(); //Act bool success0 = converter.TryConvertToCellValue(0.18f, out value0); bool success1 = converter.TryConvertToCellValue(Int64.MaxValue, out value1); bool success2 = converter.TryConvertToCellValue("NaN", out value2); //Assert Assert.IsFalse(success0); Assert.IsFalse(success1); Assert.IsFalse(success2); }