public void MaxFailNullRefException() { IEnumerable <IMoney> monies; MoneyCalculator moneyCalc = new MoneyCalculator(); IMoney max; Money.Money[] moneyList = null; monies = moneyCalc.GetMoneyEnumList(moneyList); Console.WriteLine(moneyCalc.ShowMoneyList("Current List: {", monies)); max = moneyCalc.Max(monies); Console.WriteLine(moneyCalc.ShowMoneyList("Max Amount: {", max)); }
public void SumPerCurrencySuccessful2() { IEnumerable <IMoney> monies; MoneyCalculator moneyCalc = new MoneyCalculator(); Money.Money[] moneyList = new Money.Money[] { new Money.Money(10, "GBP"), new Money.Money(20, "GBP"), new Money.Money(30, "EUR") }; monies = moneyCalc.GetMoneyEnumList(moneyList); Console.WriteLine(moneyCalc.ShowMoneyList("Current List: {", monies)); monies = moneyCalc.SumPerCurrency(moneyList); Console.WriteLine(moneyCalc.ShowMoneyList("Sum Per Currency: {", monies)); }
public void MaxFailArgsException() { IEnumerable <IMoney> monies; MoneyCalculator moneyCalc = new MoneyCalculator(); IMoney max; Money.Money[] moneyList = new Money.Money[] { new Money.Money(10, "GBP"), new Money.Money(20, "EUR"), new Money.Money(30, "GBP") }; monies = moneyCalc.GetMoneyEnumList(moneyList); Console.WriteLine(moneyCalc.ShowMoneyList("Current List: {", monies)); max = moneyCalc.Max(monies); Console.WriteLine(moneyCalc.ShowMoneyList("Max Amount: {", max)); }
public void SumPerCurrencyFailNullRefException() { IEnumerable <IMoney> monies; MoneyCalculator moneyCalc = new MoneyCalculator(); // Failing Condition // Money.Money[] moneyList = new Money.Money[] //{ // new Money.Money(10, "GBP"), // new Money.Money(20, "GBP"), // new Money.Money(30, "EUR") //}; Money.Money[] moneyList = null; monies = moneyCalc.GetMoneyEnumList(moneyList); Console.WriteLine(moneyCalc.ShowMoneyList("Current List: {", monies)); monies = moneyCalc.SumPerCurrency(moneyList); Console.WriteLine(moneyCalc.ShowMoneyList("Sum Per Currency: {", monies)); }