public void StorageService_IncorrectWithdrawForAccType_ThrowsException() { AccountOwner owner = new AccountOwner("Ilya", "Priv"); IidGenerator gen = new IdGeneratorBIC(); IPointsCounter counter = new PointsCounter(); string id = service.CreateNewAccount(AccountTypes.Basic, owner, gen, counter); Assert.Throws <ArgumentException>(() => service.Withdraw(id, 1000)); }
public void StorageService_DeletingAccountTryingToGetDeletedInfo_ThrowsException() { AccountOwner owner = new AccountOwner("Ilya", "Priv"); IidGenerator gen = new IdGeneratorBIC(); IPointsCounter counter = new PointsCounter(); string id = service.CreateNewAccount(AccountTypes.Basic, owner, gen, counter); service.DeleteAccount(id); Assert.Throws <NullReferenceException>(() => service.AccInfo(id)); }
public bool StorageService_WithdrawPointsCountInfoOutput_ExpectedResult(string info) { AccountOwner owner = new AccountOwner("Kirill", "Fidz"); IidGenerator gen = new IdGeneratorBIC(); IPointsCounter counter = new PointsCounter(); string id = service.CreateNewAccount(AccountTypes.Basic, owner, gen, counter); service.Deposit(id, 1000); string result = info.Replace("tochange", id); return(result == service.AccInfo(id)); }
public bool IdGeneration_DifferentGenerators_ExpectedResult(int length) { IidGenerator gen; if (length < 20) { gen = new IdGeneratorIBAN(); } else { gen = new IdGeneratorBIC(); } return(length == gen.Generate().Length); }
public bool StorageService_AccountsCreation_ExpectedResult(int length) { AccountOwner owner = new AccountOwner("Kirill", "Fidz"); IidGenerator gen; IPointsCounter counter = new PointsCounter(); if (length == 18) { gen = new IdGeneratorIBAN(); return(length == service.CreateNewAccount(AccountTypes.Basic, owner, gen, counter).Length); } else if (length == 32) { gen = new IdGeneratorBIC(); return(length == service.CreateNewAccount(AccountTypes.Basic, owner, gen, counter).Length); } else { throw new ArgumentException(); } }