public void AddBankTest() { var ctx = new StandardListsContext(false); ctx.ClientContext.SiteUsers.AddItem(new UserEmulator() { Login = "******", DisplayName = "Иванов Иван Иванович" }); var currentUser = ctx.ClientContext.EnsureUser("ftc\\testuser"); var bankRepository = new BankRepository(ctx); var httpRepositoryStub = new Mock <IHttpRepository>(); httpRepositoryStub.Setup(m => m.GetCurrentUserLogin()).Returns( "ftc\\testuser" ); var bankService = new BankService(bankRepository, new CurrentUserRepository(httpRepositoryStub.Object, ctx)); bankService.AddBank(new Bank() { Title = "test bank1" }); Assert.IsTrue(ctx.Banks.Count() == 1); }
public ActionResult Add(Bank bank) { _bankService.AddBank(bank); return(Redirect("/Bank/All")); }
public static void AddNewBank(AddBankViewModel model) { _bankService.AddBank(model); _userService.ChangeIsHasBankStatus(model.AdminId, true); }