Ejemplo n.º 1
0
        // Get interest per wallet for multiple users
        public void MultipleUsers_TotalInterestPerWallet()
        {
            CreditCard visaCard = new CreditCard()
            {
                cardName = "Visa Card", cardId = 1, balance = 100, cardType = CardType.Visa,
            };
            CreditCard mcCard = new CreditCard()
            {
                cardName = "MC Card", cardId = 2, balance = 100, cardType = CardType.MasterCard,
            };
            CreditCard discoverCard = new CreditCard()
            {
                cardName = "Discover Card", cardId = 3, balance = 100, cardType = CardType.Discover,
            };

            Wallet myWallet = new Wallet()
            {
                cards = new List <CreditCard>()
                {
                    mcCard, discoverCard
                }, walletName = "John's Wallet", walletId = 4
            };
            Wallet secondWallet = new Wallet()
            {
                cards = new List <CreditCard>()
                {
                    visaCard
                }, walletName = "Tom's Wallet", walletId = 3
            };

            Client myClient = new Client()
            {
                clientId = 1, clientName = "John", clientWallets = new List <Wallet>()
                {
                    myWallet
                }
            };
            Client client2 = new Client()
            {
                clientId = 2, clientName = "Tom", clientWallets = new List <Wallet>()
                {
                    secondWallet
                }
            };

            ClientGroup clientGroup = new ClientGroup()
            {
                clientList = new List <Client>()
                {
                    myClient, client2
                }, groupName = "Client Group 1"
            };


            var expectedInterestByUser = new Dictionary <int, double>();

            expectedInterestByUser.Add(4, 6);
            expectedInterestByUser.Add(3, 10);
            var calculatedInterest = clientGroup.GetInterestPerWallet();

            var equal = TestDictEquality(expectedInterestByUser, calculatedInterest);

            Assert.IsTrue(equal);
        }