예제 #1
0
        // Get interest per person for multiple users with 1 wallet each
        public void MultipleUsers_TotalInterestPerPerson()
        {
            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"
            };
            Wallet secondWallet = new Wallet()
            {
                cards = new List <CreditCard>()
                {
                    visaCard
                }, walletName = "Tom's Wallet"
            };

            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(1, 6);
            expectedInterestByUser.Add(2, 10);
            var calculatedInterest = clientGroup.GetInterestPerClient();

            var equal = TestDictEquality(expectedInterestByUser, calculatedInterest);

            Assert.IsTrue(equal);
        }