示例#1
0
        static void Main(string[] args)
        {
            var portfolio = new List <ITrade>
            {
                new Trade {
                    Value = 2000000, ClientSector = "Private"
                },
                new Trade {
                    Value = 400000, ClientSector = "Public"
                },
                new Trade {
                    Value = 500000, ClientSector = "Public"
                },
                new Trade {
                    Value = 3000000, ClientSector = "Public"
                },
            };

            Console.WriteLine("Input:");
            portfolio.ForEach(item => Console.WriteLine("Value = " + item.Value.ToString() + ", ClientSector = " + item.ClientSector));
            Console.WriteLine("");

            var bankTrade = new BankTrade();
            var result    = bankTrade.GetTradeCategories(portfolio);

            Console.WriteLine("Output: " + string.Join(", ", result));

            var tradeCategories = new string[] { "HIGHRISK", "LOWRISK", "LOWRISK", "MEDIUMRISK" };

            Console.WriteLine("Expected: " + string.Join(", ", tradeCategories));
            Console.ReadKey();
        }
示例#2
0
        public void PublicMediumRiskTest()
        {
            var portfolio = new List <ITrade>
            {
                new Trade {
                    Value = 3000000, ClientSector = "Public"
                }
            };

            var bankTrade = new BankTrade();
            var result    = bankTrade.GetTradeCategories(portfolio);

            Assert.Equal(Risk.MEDIUMRISK.ToString(), result[0]);
        }
示例#3
0
        public void PortfolioTest(double Value, string ClientSector, string risk)
        {
            var portfolio = new List <ITrade>
            {
                new Trade {
                    Value = Value, ClientSector = ClientSector
                }
            };

            var bankTrade = new BankTrade();
            var result    = bankTrade.GetTradeCategories(portfolio);

            Assert.Equal(risk, result[0]);
        }
示例#4
0
        public void PrivateHighRiskTest()
        {
            var portfolio = new List <ITrade>
            {
                new Trade {
                    Value = 2000000, ClientSector = "Private"
                }
            };

            var bankTrade = new BankTrade();
            var result    = bankTrade.GetTradeCategories(portfolio);

            Assert.Equal(Risk.HIGHRISK.ToString(), result[0]);
        }