public void ThrowArgumentExceptionGivenInputWithInvalidCurrencySymbol(string input) { KinguilaHojeTextualInformationParser parser = GetDefaultParser(); ArgumentException exception = Assert.Throws <ArgumentException>(() => parser.ParseCurrencyRate(input)); Assert.Contains("currencyRate", exception.ParamName); Assert.Contains("currency symbol", exception.Message); }
public void ThrowArgumentExceptionGivenUnsupportedDateInput(string dateInput) { KinguilaHojeTextualInformationParser parser = GetDefaultParser(); var exception = Assert.Throws <ArgumentException>(() => parser.ParseDate(dateInput)); Assert.Equal("date", exception.ParamName); Assert.Contains("is invalid", exception.Message); }
public void ThrowArgumentOutOfRangeExceptionGivenInputWithNonPositiveAmount(string input) { KinguilaHojeTextualInformationParser parser = GetDefaultParser(); ArgumentOutOfRangeException exception = Assert.Throws <ArgumentOutOfRangeException>(() => parser.ParseCurrencyRate(input)); Assert.Contains("currencyRate", exception.ParamName); Assert.Contains("must be positive", exception.Message); }
public void ParseDateGivenCorrectInput(string dateInput, int expectedMonth, int expectedDay) { KinguilaHojeTextualInformationParser parser = GetDefaultParser(); DateTimeOffset dateTime = parser.ParseDate(dateInput); Assert.Equal(expectedMonth, dateTime.Month); Assert.Equal(expectedDay, dateTime.Day); Assert.Equal(2013, dateTime.Year); }
public void ParseCurrencyGivenCorrectInput(String input, decimal expectedAmount, string expectedCurrency) { KinguilaHojeTextualInformationParser parser = GetDefaultParser(); CurrencyRate currencyRate = parser.ParseCurrencyRate(input); Assert.NotNull(currencyRate); Assert.Equal(expectedAmount, currencyRate.Amount); Assert.Equal(Currency.FromISO4217Code(expectedCurrency), currencyRate.Currency); }