public void Be_Valid() { var sut = new PremiumAccount(null); var result = sut.Validate(new AccountValidation(null, 20000, AccountType.Premium)); result.Valid.Should().Be(true); }
public static PremiumAccount CreatePremiumAccount(int accountID, global::WebStack.QA.Test.OData.Containment.Proxy.GiftCard giftCard) { PremiumAccount premiumAccount = new PremiumAccount(); premiumAccount.AccountID = accountID; if ((giftCard == null)) { throw new global::System.ArgumentNullException("giftCard"); } premiumAccount.GiftCard = giftCard; return(premiumAccount); }
public void GenerateNumber(PremiumAccount account) { StringBuilder sb = new StringBuilder(""); foreach (int group in Groups) { for (int i = 0; i < group; i++) { sb.Append(new Random().Next(0, 9)); } } this.Number = sb.ToString(); //? refernce }
public void OpenAccount(AccountType type, decimal sum, AccountStateHandler openHandler, AccountStateHandler closeHandler, AccountStateHandler putHandler, AccountStateHandler withdrawHandler, AccountStateHandler transferHandler, AccountStateHandler changeTypeHandler) // open new account { T newAccount = default(T); switch (type) { case AccountType.Small: newAccount = new SmallAccount(sum) as T; break; case AccountType.Middle: newAccount = new MiddleAccount(sum) as T; break; case AccountType.Premium: newAccount = new PremiumAccount(sum) as T; break; } if (newAccount == null) { throw new NullReferenceException("Unreal to create an account of chosen type. Account is null object"); } _accounts.Add(newAccount); newAccount.OpenEvent += openHandler; newAccount.CloseEvent += closeHandler; newAccount.PutEvent += putHandler; newAccount.WithdrawEvent += withdrawHandler; newAccount.TransferEvent += transferHandler; newAccount.ChangeAccountTypeEvent += changeTypeHandler; Item item = new Item("opening", sum); newAccount.Opened(item); newAccount.OpenEvent -= openHandler; }
public static Ice.DispatchStatus calculateLoan___(PremiumAccount obj__, IceInternal.Incoming inS__, Ice.Current current__) { checkMode__(Ice.OperationMode.Normal, current__.mode); IceInternal.BasicStream is__ = inS__.startReadParams(); int amount; Bank.currency curr; int period; amount = is__.readInt(); curr = (Bank.currency)is__.readEnum(3); period = is__.readInt(); inS__.endReadParams(); int totalCost; float interestRate; try { obj__.calculateLoan(amount, curr, period, out totalCost, out interestRate, current__); IceInternal.BasicStream os__ = inS__.startWriteParams__(Ice.FormatType.DefaultFormat); os__.writeInt(totalCost); os__.writeFloat(interestRate); inS__.endWriteParams__(true); return Ice.DispatchStatus.DispatchOK; } catch(Bank.IncorrectData ex__) { inS__.writeUserException__(ex__, Ice.FormatType.DefaultFormat); return Ice.DispatchStatus.DispatchUserException; } }
public static PremiumAccount CreatePremiumAccount(int accountID, global::WebStack.QA.Test.OData.Containment.Proxy.GiftCard giftCard) { PremiumAccount premiumAccount = new PremiumAccount(); premiumAccount.AccountID = accountID; if ((giftCard == null)) { throw new global::System.ArgumentNullException("giftCard"); } premiumAccount.GiftCard = giftCard; return premiumAccount; }