private static void UserCardRegistration(ICardAuthority cardAuthority) { //The same object will be used for two cards so we are creating a scenario of a joint card. var userCardAccount = new Account(123456, 25.5f); //Card number should be ideally 16 digits but for card recognition simulation, //we will make it four digits card. //Card 1 cardAuthority.RegisterCard("4512"); var cashCard1 = cardAuthority.FindCard("4512"); cashCard1.SetPin(2535); cashCard1.LinkAccount(userCardAccount); //Registering same account to both cards. //Card 1 cardAuthority.RegisterCard("4513"); var cashCard2 = cardAuthority.FindCard("4513"); cashCard2.SetPin(2535); cashCard2.LinkAccount(userCardAccount); }
/// <summary> /// Init machine account /// </summary> /// <param name="machineAccount"></param> public VendingMachine(IAccount machineAccount, ICardAuthority cardAuthority) : this() //Also call default constructor { _machineAccount = machineAccount; _cardAuthority = cardAuthority; }