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);
        }
示例#2
0
 public ActionResult Add(Bank bank)
 {
     _bankService.AddBank(bank);
     return(Redirect("/Bank/All"));
 }
示例#3
0
 public static void AddNewBank(AddBankViewModel model)
 {
     _bankService.AddBank(model);
     _userService.ChangeIsHasBankStatus(model.AdminId, true);
 }