コード例 #1
0
        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));
        }
コード例 #2
0
        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));
        }
コード例 #3
0
        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));
        }
コード例 #4
0
        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));
        }