예제 #1
0
        public void Test_TransferMoney_CallsTransferMoneyToDatabase_ReturnsFalseIfHasNotGotEnoughFundsToTransfer()
        {
            //ARRANGE
            bb.Setup(c => c.id).Returns(1);
            bb.Setup(c => c.accountOwnerId).Returns(1);
            bb.Setup(c => c.balance).Returns(100);

            gg.Setup(c => c.id).Returns(2);
            gg.Setup(c => c.accountOwnerId).Returns(2);
            gg.Setup(c => c.balance).Returns(100);

            accountRepoMock.Setup(c => c.GetAllAccounts()).Returns(new List <Account> {
                bb.Object, gg.Object
            });
            accountRepoMock.Setup(c => c.printBalance(1)).Returns(100);
            accountRepoMock.Setup(c => c.transferMoney(1, 2, 100));


            AccountLogic arTest = new AccountLogic(accountRepoMock.Object);

            bool expected = false;

            //ACT
            bool actual = arTest.transferMoney(1, 2, 101);

            //ASSERT
            Assert.AreEqual(expected, actual);
            accountRepoMock.Verify(a => a.GetAllAccounts());
            accountRepoMock.Verify(a => a.printBalance(1), Times.Once);
        }
예제 #2
0
        static DependencyResolver()
        {
            var DALappSetting = ReadSetting("DAL");

            if (DALappSetting == "File")
            {
                UserDao  = new FileUserDao();
                AwardDao = new FileAwardDao();
            }
            else if (DALappSetting == "DB")
            {
                UserDao      = new DBUserDao();
                AwardDao     = new DBAwardDao();
                AccountDao   = new DBAccountDao();
                AccountLogic = new AccountLogic(AccountDao);
            }
            else
            {
                UserDao  = new MemoryUserDao();
                AwardDao = new MemoryAwardDao();
            }

            UserLogic  = new UserLogic(UserDao);
            AwardLogic = new AwardLogic(AwardDao);
        }
        private void btnGenerateAccount_Click(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrWhiteSpace(textboxProxy.Text) || string.IsNullOrWhiteSpace(textboxCardContact.Text))
            {
                MessageBoxResult messageBoxResult = System.Windows.MessageBox.Show("Proxy & Card contact is required!", Common.APP_NAME, System.Windows.MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }

            MainWindow mainWindow = Window.GetWindow(this) as MainWindow;

            if (!mainWindow.OldCardContactValue.Equals(textboxCardContact.Text.Trim()))
            {
                mainWindow.Accounts            = AccountLogic.GenerateAccounts(StringHelper.GetLinesCollectionFromTextBox(textboxCardContact));
                mainWindow.OldCardContactValue = textboxCardContact.Text.Trim();
            }

            mainWindow.Proxies = StringHelper.GetLinesCollectionFromTextBox(textboxProxy);
            //mainWindow.ProxyType =
            ProxyTypeEnum proxyType;

            if (!Enum.TryParse(cbbProxyType.SelectedItem.ToString(), out proxyType))
            {
                proxyType = ProxyTypeEnum.Socks5;
            }
            mainWindow.ProxyType = proxyType;

            mainWindow.LoadingPage(true);
            mainWindow.LoadPage(mainWindow._accountManagerUc);
        }
 public AccountsForm(int clientId)
 {
     InitializeComponent();
     accountLogic  = new AccountLogic();
     this.clientId = clientId;
     reload();
 }
예제 #5
0
        // GET: Account/Logout
        public async Task <ActionResult> Logout()
        {
            ViewBag.LogIn = CurrentUser.UserLoggedIn();
            AccountLogic logic = new AccountLogic();

            if (!ModelState.IsValid)
            {
                return(View("Error"));
            }

            HttpRequestMessage apiRequest = CreateRequestToService(HttpMethod.Get, "api/Account/Logout");

            HttpResponseMessage apiResponse;

            try
            {
                apiResponse = await HttpClient.SendAsync(apiRequest);
            }
            catch
            {
                return(View("Error"));
            }

            if (!apiResponse.IsSuccessStatusCode)
            {
                return(View("Error"));
            }

            logic.Logout();
            CurrentUser.currentUserId = null;
            PassCookiesToClient(apiResponse);

            return(Redirect("http://angular.brewtodo.com"));
        }
예제 #6
0
        public void Test_WithdrawMoney_CallsWithdrawMoneyToDatabase_ReturnsTrueIfCanWithdraw()
        {
            //ARRANGE
            bb.Setup(c => c.id).Returns(1);
            bb.Setup(c => c.accountOwnerId).Returns(1);
            bb.Setup(c => c.balance).Returns(100);

            accountRepoMock.Setup(c => c.GetAllAccounts()).Returns(new List <Account> {
                bb.Object
            });
            accountRepoMock.Setup(c => c.printBalance(1)).Returns(100);
            accountRepoMock.Setup(c => c.withdrawMoney(1, 99)).Verifiable();

            AccountLogic arTest = new AccountLogic(accountRepoMock.Object);

            bool expected = true;

            //ACT
            bool actual = arTest.withdrawMoney(1, 99);

            //ASSERT
            Assert.AreEqual(expected, actual);
            accountRepoMock.Verify(a => a.GetAllAccounts());
            accountRepoMock.Verify(a => a.withdrawMoney(1, 99), Times.Once);
            accountRepoMock.Verify(a => a.printBalance(1), Times.Once);
        }
예제 #7
0
 public ForgetCredentialsControllerLogic(AccountLogic accountLogic, SecurityQuestionsAccountLogic securityQuestionsAccountLogic, SaltSecurityAnswerLogic saltSecurityAnswerLogic, SaltLogic saltLogic)
 {
     _accountLogic = accountLogic;
     _securityQuestionsAccountLogic = securityQuestionsAccountLogic;
     _saltSecurityAnswerLogic       = saltSecurityAnswerLogic;
     _saltLogic = saltLogic;
 }
예제 #8
0
 public void Init()
 {
     source = new AccountLogic();
     source.Deposit(200.00F);
     destination = new AccountLogic();
     destination.Deposit(150.00F);
 }
예제 #9
0
 public ForgetCredentialsControllerLogic()
 {
     _accountLogic = new AccountLogic();
     _securityQuestionsAccountLogic = new SecurityQuestionsAccountLogic();
     _saltSecurityAnswerLogic       = new SaltSecurityAnswerLogic();
     _saltLogic = new SaltLogic();
 }
예제 #10
0
 public AccountController(IUserDescription userInterface, IUniversity university, IParticipation part)
 {
     _userRepo          = userInterface;
     _participationRepo = part;
     _universitiesRepo  = university;
     _accountLogic      = new AccountLogic(userInterface, university, part);
 }
예제 #11
0
 private void ToInitialize()
 {
     if (this._Ic != "" && this._Ic.Length == 36)
     {
         AccounModel  accounModel  = new AccounModel();
         AccountLogic accountLogic = new AccountLogic();
         accounModel = accountLogic.GetModel(this._ic);
         if (accounModel != null)
         {
             this.txtaccountNum.Value = accounModel.accountNum;
             this.txtacountName.Value = accounModel.acountName;
             string   text  = "";
             string[] array = accounModel.authorizer.ToString().Split(new char[]
             {
                 ','
             });
             string[] array2 = array;
             for (int i = 0; i < array2.Length; i++)
             {
                 string text2 = array2[i];
                 if (text2 != "")
                 {
                     text = text + "," + text2;
                 }
             }
             string userName = this.am.GetUserName(text);
             this.Session["HumanCode"] = text;
             this.Session["HumanName"] = userName;
             this.txtauthorizer.Value  = userName;
             this.txtRemark.Value      = accounModel.Remark;
             this.txtinitialFund.Value = accounModel.initialFund.ToString();
         }
     }
 }
예제 #12
0
        public IActionResult Register(RegisterBranchViewModel viewModel)
        {
            AccountLogic logic = new AccountLogic();

            logic.AddBrach(viewModel.Branch, viewModel.Account);
            return(RedirectToAction("Login"));
        }
예제 #13
0
 public TransactionController(ITransactionContext transactionContext, IUserContext userContext, IAccountContext accountContext, ISavingsContext savingsContext, IFileProvider fileProvider)
 {
     _transactionLogic = new TransactionLogic(transactionContext);
     _userLogic        = new UserLogic(userContext);
     _accountLogic     = new AccountLogic(accountContext);
     _savingLogic      = new SavingLogic(savingsContext);
     _fileProvider     = fileProvider;
 }
예제 #14
0
        public AccountController(IConfiguration config, IHostingEnvironment environment)
        {
            _accountLogic = new AccountLogic(config);

            _friendLogic = new FriendLogic(config);

            _hostingEnvironment = environment;
        }
예제 #15
0
 public ActionController(TelemetryScopedLogger logger, IStringLocalizer localizer, ITenantRepository tenantRepository, AccountLogic userAccountLogic, AccountActionLogic accountActionLogic) : base(logger)
 {
     this.logger             = logger;
     this.localizer          = localizer;
     this.tenantRepository   = tenantRepository;
     this.userAccountLogic   = userAccountLogic;
     this.accountActionLogic = accountActionLogic;
 }
예제 #16
0
    public void getMonthPlanMainInfo(DateTime dtime)
    {
        Fund_Plan_MonthMainInfo fund_Plan_MonthMainInfo = new Fund_Plan_MonthMainInfo();

        fund_Plan_MonthMainInfo.PrjGuid      = this.PrjGuid;
        fund_Plan_MonthMainInfo.PlanType     = this.plantype;
        fund_Plan_MonthMainInfo.PlanYear     = dtime.Year;
        fund_Plan_MonthMainInfo.PlanMonth    = dtime.Month;
        fund_Plan_MonthMainInfo.OperateTime  = DateTime.Now;
        fund_Plan_MonthMainInfo.OperatorCode = base.UserCode;
        fund_Plan_MonthMainInfo     = this.FA.GetMainInfo(fund_Plan_MonthMainInfo);
        this.hdfMonthPalnID.Value   = fund_Plan_MonthMainInfo.MonthPlanID.ToString();
        this.FileUpload1.RecordCode = fund_Plan_MonthMainInfo.MonthPlanID.ToString();
        this.txtRemark.Text         = fund_Plan_MonthMainInfo.Remark.ToString();
        this.txtadddate.Text        = fund_Plan_MonthMainInfo.OperateTime.ToString("yyyy-MM-dd");
        if (fund_Plan_MonthMainInfo.OperatorName != null && fund_Plan_MonthMainInfo.OperatorName != "")
        {
            this.txtadduser.Text = fund_Plan_MonthMainInfo.OperatorName.ToString();
        }
        else
        {
            AccountLogic accountLogic       = new AccountLogic();
            string       userNameByUserCode = accountLogic.GetUserNameByUserCode(this.Session["yhdm"].ToString());
            this.txtadduser.Text = userNameByUserCode;
        }
        DateTime t = Convert.ToDateTime(string.Concat(new object[]
        {
            DateTime.Today.Year.ToString(),
            '-',
            DateTime.Today.Month.ToString(),
            "-01"
        }));

        if (dtime < t)
        {
            this.hdfFlowState.Value = "10";
            this.trtoolbar.Style.Add("display", "none");
            this.trtoolbar2.Style.Add("display", "");
            this.lbEidtTS.Text = "    不能编制过去的计划,现在是查看状态!";
        }
        else
        {
            this.hdfFlowState.Value = fund_Plan_MonthMainInfo.FlowState.ToString();
            if (fund_Plan_MonthMainInfo.FlowState > -1)
            {
                this.trtoolbar.Style.Add("display", "none");
                this.trtoolbar2.Style.Add("display", "");
                this.lbEidtTS.Text = "    此计划" + Common2.GetState(fund_Plan_MonthMainInfo.FlowState.ToString()) + "不能编制,现在是查看状态!";
            }
            else
            {
                this.trtoolbar.Style.Add("display", "");
                this.trtoolbar2.Style.Add("display", "none");
                this.lbEidtTS.Text = "";
            }
        }
        this.BindPlanDetail();
    }
예제 #17
0
 public RegistrationControllerLogic()
 {
     _userProfileLogic        = new UserProfileLogic();
     _saltLogic               = new SaltLogic();
     _partialAccountSaltLogic = new PartialAccountSaltLogic();
     _accountLogic            = new AccountLogic();
     _partialAccountLogic     = new PartialAccountLogic();
     _securityQuestionLogic   = new SecurityQuestionLogic();
 }
예제 #18
0
 public AccountController()
 {
     _accountControllerLogic = new AccountControllerLogic();
     _accountLogic           = new AccountLogic();
     _jAccessTokenLogic      = new JAccessTokenLogic();
     _saltLogic        = new SaltLogic();
     _userProfileLogic = new UserProfileLogic();
     _zipLocationLogic = new ZipLocationLogic();
 }
예제 #19
0
 public SsoControllerLogic()
 {
     _jAccessTokenLogic       = new JAccessTokenLogic();
     _expiredAccessTokenLogic = new ExpiredAccessTokenLogic();
     _saltLogic = new SaltLogic();
     _partialAccountSaltLogic = new PartialAccountSaltLogic();
     _accountLogic            = new AccountLogic();
     _partialAccountLogic     = new PartialAccountLogic();
 }
예제 #20
0
        public async void Cancel()
        {
            if (IsEdit)
            {
                await AccountLogic.AddTransactionAmount(_transactionRepository.Selected);
            }

            ((Frame)Window.Current.Content).GoBack();
        }
예제 #21
0
        public IActionResult UserEdit(string id)
        {
            var model = new UserRoleView();

            model.AllRoles  = AccountLogic.GetRoles();
            model.UserRoles = AccountLogic.GetUserRoles(id);
            model.UserId    = id;

            return(View(model));
        }
예제 #22
0
 public void SetUp()
 {
     uList      = new List <UserViewModel>();
     aList      = new List <Account>();
     uApi       = new TestUserApiMethods(uList, aList);
     aApi       = new TestAccountApiMethods(aList, uList);
     uLogic     = new UserLogic(uApi);
     aLogic     = new AccountLogic(aApi);
     controller = new UserController(uLogic, aLogic);
 }
예제 #23
0
 static DependencyResolver()
 {
     AccountDao    = new AccountDao();
     AccountLogic  = new AccountLogic(AccountDao);
     CategoryDao   = new CategoryDao();
     CategoryLogic = new CategoryLogic(CategoryDao);
     SubjectDao    = new SubjectDao();
     SubjectLogic  = new SubjectLogic(SubjectDao);
     TestDao       = new TestDao();
     TestLogic     = new TestLogic(TestDao);
 }
예제 #24
0
 public RegistrationControllerLogic(AccountLogic accountLogic, PartialAccountLogic partialAccountLogic,
                                    PartialAccountSaltLogic partialAccountSaltLogic, SaltLogic saltLogic, UserProfileLogic userProfileLogic,
                                    SecurityQuestionLogic securityQuestionLogic)
 {
     _accountLogic            = accountLogic;
     _partialAccountLogic     = partialAccountLogic;
     _partialAccountSaltLogic = partialAccountSaltLogic;
     _saltLogic             = saltLogic;
     _userProfileLogic      = userProfileLogic;
     _securityQuestionLogic = securityQuestionLogic;
 }
예제 #25
0
 public SsoControllerLogic(AccountLogic accountLogic, PartialAccountLogic partialAccountLogic,
                           PartialAccountSaltLogic partialAccountSaltLogic, SaltLogic saltLogic, JAccessTokenLogic jAccessTokenLogic,
                           ExpiredAccessTokenLogic expiredAccessTokenLogic)
 {
     _accountLogic            = accountLogic;
     _partialAccountLogic     = partialAccountLogic;
     _partialAccountSaltLogic = partialAccountSaltLogic;
     _saltLogic               = saltLogic;
     _jAccessTokenLogic       = jAccessTokenLogic;
     _expiredAccessTokenLogic = expiredAccessTokenLogic;
 }
예제 #26
0
        public IHttpActionResult GetPeople()
        {
            var result = AccountLogic.getOtherPeople(User.Identity.GetUserId());

            if (result != null)
            {
                return(Ok(result));
            }

            return(BadRequest());
        }
예제 #27
0
 public LoginController(TelemetryScopedLogger logger, IStringLocalizer localizer, ITenantRepository tenantRepository, SessionLogic sessionLogic, SequenceLogic sequenceLogic, AccountLogic accountLogic, LoginUpLogic loginUpLogic, LogoutUpLogic logoutUpLogic) : base(logger)
 {
     this.logger           = logger;
     this.localizer        = localizer;
     this.tenantRepository = tenantRepository;
     this.sessionLogic     = sessionLogic;
     this.sequenceLogic    = sequenceLogic;
     this.accountLogic     = accountLogic;
     this.loginUpLogic     = loginUpLogic;
     this.logoutUpLogic    = logoutUpLogic;
 }
예제 #28
0
 public MfaController(TelemetryScopedLogger logger, IStringLocalizer localizer, ITenantRepository tenantRepository, LoginPageLogic loginPageLogic, SequenceLogic sequenceLogic, SecurityHeaderLogic securityHeaderLogic, AccountLogic userAccountLogic, AccountActionLogic accountActionLogic, AccountTwoFactorLogic accountTwoFactorLogic) : base(logger)
 {
     this.logger                = logger;
     this.localizer             = localizer;
     this.tenantRepository      = tenantRepository;
     this.loginPageLogic        = loginPageLogic;
     this.sequenceLogic         = sequenceLogic;
     this.securityHeaderLogic   = securityHeaderLogic;
     this.userAccountLogic      = userAccountLogic;
     this.accountActionLogic    = accountActionLogic;
     this.accountTwoFactorLogic = accountTwoFactorLogic;
 }
예제 #29
0
        public void Deposit_WithInvalidArguments(int accountNo, int sum, decimal expectedBalance)
        {
            var bankRepository = GetBankRepository();
            var accountLogic   = new AccountLogic(bankRepository);

            var account = bankRepository.Customers.First(x => x.Accounts.First().AccountNo == accountNo).Accounts.Single();

            var resultStatus = account.Deposit(sum);

            Assert.NotEqual("success", resultStatus);
            Assert.Equal(account.Balance, expectedBalance);
        }
예제 #30
0
        public void AccountTests()
        {
            AccountLogic accountLogic = new AccountLogic();
            LoginModel   loginModel   = accountLogic.LogGebruikerIn("*****@*****.**", "Test123");

            Assert.IsNotNull(loginModel.Voornaam);

            loginModel = accountLogic.LogGebruikerIn("*****@*****.**", "Fout wachtwoord");
            Assert.IsNull(loginModel);

            Assert.IsNotNull(accountLogic.RegistreerGebruiker("*****@*****.**", "Test123", "Robin", "Velthuys", "5628KN", "4"));
        }
예제 #31
0
        public IActionResult UserList()
        {
            var user      = _userManager.GetUserAsync(HttpContext.User).Result;
            var userRoles = _userManager.GetRolesAsync(user).Result;

            var list = AccountLogic.GetAccessUser(user, userRoles.ToList())
                       .Select(x => new Tuple <User, bool>(x, _userManager.GetRolesAsync(x).Result.Contains("Student")))
                       .OrderBy(x => x.Item2)
                       .ToList();

            return(View(list));
        }