Esempio n. 1
0
 public void SuccessfulLogin()
 {
     UserManagement userManagement = new UserManagement();
     var user = userManagement.Login(new User { Email = "*****@*****.**", Password = "******" });
     if (user == null)
         Assert.Fail("Successful login returned null user");
 }
Esempio n. 2
0
 public void GetAccountsForValidUser()
 {
     AccountManagement accManage = new AccountManagement();
     UserManagement userManage = new UserManagement();
     User user = userManage.Login(new User{ Email = "*****@*****.**", Password = "******"});
     var accounts = accManage.GetAccounts(user);
     if (accounts.Count() < 1)
         Assert.Fail("No accounts returned for valid user.");
 }
Esempio n. 3
0
        public void CreateInvalidAccount()
        {
            UserManagement userManagement = new UserManagement();
            User user = userManagement.Login(new User { Email = "*****@*****.**", Password = "******" });

            if (user == null)
                Assert.Fail("No user for new account.");

            Account newAccount = new Account();

            AccountManagement accountManagement = new AccountManagement();
            accountManagement.CreateAccount(newAccount);
        }
Esempio n. 4
0
 public User Login(User user)
 {
     try
     {
         UserManagement userManagement = new UserManagement();
         return userManagement.Login(user);
     }
     catch (ModelException ex)
     {
         CapitalError error = new CapitalError(ex);
         throw new FaultException<CapitalError>(error, error.Message);
     }
     catch (Exception)
     {
         return null;
     }
 }
Esempio n. 5
0
        public void UpdateValidAccount()
        {
            UserManagement userManage = new UserManagement();
            User user = userManage.Login(new User { Email = "*****@*****.**", Password = "******" });

            AccountManagement accManage = new AccountManagement();
            Account[] accounts = accManage.GetAccounts(user).ToArray();

            if (accounts == null || accounts.Count() < 1)
                Assert.Fail("No account to update.");

            Account target = accounts[0];

            target.AccountName = "New Account Name";
            target.Balance = 1000000;
            target.DefaultPayment = 50;

            accManage.UpdateAccount(target);
        }
Esempio n. 6
0
        public void CreateValidAccount()
        {
            UserManagement userManagement = new UserManagement();
            User user = userManagement.Login(new User { Email = "*****@*****.**", Password = "******" });

            if (user == null)
                Assert.Fail("No user for new account.");

            Account newAccount = new Account();
            newAccount.AccountName = "TEST 1";
            newAccount.CreationDate = DateTime.Now;
            newAccount.StartDate = DateTime.Now;
            newAccount.DefaultPayment = 200.00;
            newAccount.FrequencyId = 2;
            newAccount.UserId = user.UserId;
            newAccount.AccountTypeId = 1;

            AccountManagement accountManagement = new AccountManagement();
            accountManagement.CreateAccount(newAccount);
        }
Esempio n. 7
0
        public void CreateValidUserWithDeviceTest()
        {
            UserManagement userManagement = new UserManagement();
            Device device = new Device()
            {
                DeviceName = "Device Name",
                Manufacturer = "MANU",
                CreationDate = DateTime.Now,
                Model = "MODEL",
                UniqueDeviceId = "UNIQUE ID"
            };
            List<Device> devices = new List<Device>();
            devices.Add(device);

            userManagement.CreateUser(new User()
            {
                Email = "*****@*****.**",
                Password = "******",
                CreationDate = DateTime.Now,
                LastAccessDate = DateTime.Now,
                Devices = devices
            });
        }
Esempio n. 8
0
 public void UnsuccessfulLogin()
 {
     UserManagement userManagement = new UserManagement();
     userManagement.Login(new User { Email = "*****@*****.**", Password = "******" });
 }
Esempio n. 9
0
 public void CreateDuplicateUserTest()
 {
     UserManagement userManagement = new UserManagement();
     userManagement.CreateUser(new User() { Email = "*****@*****.**", Password = "******", CreationDate = DateTime.Now, LastAccessDate = DateTime.Now });
 }
Esempio n. 10
0
 public void CreateInvalidModelUserTest()
 {
     UserManagement userManagement = new UserManagement();
     userManagement.CreateUser(new User() { Email = "FAILED EMAIL VALIDATION", Password = "******", CreationDate = DateTime.Now, LastAccessDate = DateTime.Now });
 }
Esempio n. 11
0
        public void GetStatementsCreateSecondStatement()
        {
            UserManagement userManage = new UserManagement();
            User user = userManage.Login(new User { Email = "*****@*****.**", Password = "******" });

            AccountManagement accManage = new AccountManagement();
            Statement[] statements = accManage.GetStatements(user).ToArray();

            if (statements.Count() == 0)
                Assert.Fail("No Statement was created.");
        }
Esempio n. 12
0
        public void UpdateStatement()
        {
            UserManagement userManage = new UserManagement();
            User user = userManage.Login(new User { Email = "*****@*****.**", Password = "******" });

            AccountManagement accManage = new AccountManagement();

            Statement[] statements = accManage.GetStatements(user).ToArray();

            Statement statement = statements[0];
            statement.IsPaid = true;

            accManage.UpdateStatement(statement);
        }
Esempio n. 13
0
        public void ShareValidAccount()
        {
            UserManagement userManage = new UserManagement();
            AccountManagement accManage = new AccountManagement();

            // Owner            
            User Owner = userManage.CreateUser(new User
            {
                Email = "*****@*****.**",
                Password = "******",
                CreationDate = DateTime.Now,
                LastAccessDate = DateTime.Now
            });

            // Owner Account
            accManage.CreateAccount(new Account
            {
                AccountName = "ShareAccountTest",
                CreationDate = DateTime.Now,
                StartDate = DateTime.Now,
                FrequencyId = 3,
                AccountTypeId = 1,
                UserId = Owner.UserId
            });

            Account[] accounts = accManage.GetAccounts(Owner).ToArray();

            // Share user
            User shareUser = userManage.CreateUser(new User
            {
                Email = "*****@*****.**",
                Password = "******",
                CreationDate = DateTime.Now,
                LastAccessDate = DateTime.Now
            });

            // Share
            int accountID = accounts[0].AccountId;
            Share share = new Share();
            share.UserId = shareUser.UserId;
            share.AccountId = accounts[0].AccountId;
            share.PermissionLevelId = 2;

            accManage.ShareAccount(share);

            // Confirm
            accounts = accManage.GetAccounts(shareUser).ToArray();

            Account account = accounts.FirstOrDefault(x => x.AccountId == accountID);

            if (account == null)
                Assert.Fail("Shared account was not in Shared User collection.");

            if (!(account.IsShare))
                Assert.Fail("Shared account is not flagged as shared.");

            if (account.PermissionLevel < 1)
                Assert.Fail("Shared account permission level is invalid.");
        }
Esempio n. 14
0
        public void DeleteValidAccount()
        {
            UserManagement userManage = new UserManagement();
            User user = userManage.Login(new User { Email = "*****@*****.**", Password = "******" });

            AccountManagement accManage = new AccountManagement();
            Account[] accounts = accManage.GetAccounts(user).ToArray();

            if (accounts == null || accounts.Count() < 1)
                Assert.Fail("No account to delete.");

            accManage.DeleteAccount(accounts[0]);
        }