public void ShouldConvertToCellValue() { //Arrange string value0; string value1; string value2; var converter = new IntConverter(); //Act bool success0 = converter.TryConvertToCellValue(123, out value0); bool success1 = converter.TryConvertToCellValue(int.MaxValue, out value1); bool success2 = converter.TryConvertToCellValue(-15, out value2); //Assert Assert.IsTrue(success0); Assert.IsTrue(success1); Assert.IsTrue(success2); Assert.AreEqual("123", value0); Assert.AreEqual(int.MaxValue.ToString(), value1); Assert.AreEqual("-15", value2); }
public void ShouldFailToConvertToCellValue() { //Arrange string value0; string value1; string value2; var converter = new IntConverter(); //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); }