public void String_Converted_To_Int_Throws_Exception() { // Arrange string withDollarSign = "!!@!@"; // Act Exception ex = Assert.Throws <System.IO.IOException>(() => CreditCardProcessor.CurrencyStringConvertToInt(withDollarSign)); // Assert Assert.Equal("The handle is invalid", ex.Message); }
public void String_Successfully_Converted_To_Int() { // Arrange string withDollarSign = "$1000"; string withComma = "1,000"; string withDollarSignAndComma = "$1,000"; // Act int dollarSignConversion = CreditCardProcessor.CurrencyStringConvertToInt(withDollarSign); int commaConversion = CreditCardProcessor.CurrencyStringConvertToInt(withComma); int dollarSignAndCommaConversion = CreditCardProcessor.CurrencyStringConvertToInt(withDollarSignAndComma); // Assert Assert.Equal(1000, dollarSignConversion); Assert.Equal(1000, commaConversion); Assert.Equal(1000, dollarSignAndCommaConversion); }