Esempio n. 1
0
        public Account_Test()
        {
            Accounts accounts = new Accounts
            {
                Id            = Guid.NewGuid(),
                AccountNumber = "0037686809",
                AccountType   = "savings",
                Balance       = 0.0,
                DateCreated   = DateTime.Now,
                IsActive      = true,
            }; var atm = new Atm();

            atm.AtmNumber         = "4751763236699647";
            atm.AtmPin            = "3310";
            atm.ExpiryDate        = DateTime.Now;
            atm.SecurityNumber    = "564";
            _mockAccount          = new Mock <IAccount>();
            _mockAtm              = new Mock <IAtm>();
            _atmVm                = new AtmVm();
            _atmVm.AtmNumber      = "4751763236699647";
            _atmVm.AtmPin         = "3310";
            _atmVm.ExpiryDate     = "12/22";
            _atmVm.SecurityNumber = "564";
            _mockAtm.Setup(atm => atm.GetAtm(_atmVm)).ReturnsAsync(GetAtm());
            _mockUser = new Mock <IUser>();
            _mockUser.Setup(user => user.GetUser("toby")).ReturnsAsync(GetUser());
            _mockAccountGen = new Mock <IAccountGenerator>();
            _mockAccountGen.Setup(r => r.Get()).Returns("0090933344");
            _mockAccountJwt      = new Mock <IJwtSecurity>();
            _newToken            = new Token();
            _newToken.token      = "738290hdjzksLKLCjchxkclzKJCxclz:KZJVnmx,ckl";
            _newToken.ExpiryDate = DateTime.Now;
            _mockAccountJwt.Setup(r => r.JwtVerification(GetUser()))
            .Returns(_newToken);
            _mockAccount.Setup(repo => repo.FindAccountById(Guid.NewGuid())).ReturnsAsync(accounts);

            validate = new ValidateAtmController(_mockUser.Object, _mockAccount.Object, _mockAtm.Object, _mockAccountGen.Object, _mockAccountJwt.Object);
        }