public void DeleteUserSuccessful()
        {
            //First, create a user with known id
            var repo = new UserRepository();
            var id = Guid.NewGuid().ToString();
            var user = new User
            {
                Id = id,
                FirstName = "Test",
                LastName = "Test",
                City = "Test",
                AddressLine1 = "Line 1",
                Country = "AUS",
                State = "state",
                Zip = "123456",
                Email = id + "@google.com"
            };

            var createdUser = repo.CreateUser(user);

            //Then, get user
            var gotUser = repo.GetUserById(id);
            Assert.IsNotNull(gotUser);
            Assert.AreEqual(gotUser.Id, id);

            //Now, delete user
            repo.DeleteUser(id);

            //And check whether user exists now
            var success = false;
            try
            {
                repo.GetUserById(id);
            }
            catch (UnauthorizedException)
            {
                success = true;
            }

            if (!success)
            {
                Assert.Fail("Delete user failed!");
            }
        }
        public void EditUserMissingId()
        {
            var repo = new UserRepository();
            var id = Guid.NewGuid().ToString();
            var user = new User
            {
                Id = id,
                FirstName = "Test",
                LastName = "Test",
                City = "Test",
                AddressLine1 = "Line 1",
                Country = "AUS",
                State = "state",
                Zip = "123456",
                Email = id + "@google.com"
            };

            repo.UpdateUser(user);
        }
 public void ValidationErrorUserCreateWrongEmail()
 {
     var repo = new UserRepository();
     var id = Guid.NewGuid().ToString();
     var user = new User
     {
         Id = id,
         FirstName = "Test",
         LastName = "Test",
         City = "Test",
         AddressLine1 = "Line 1",
         Country = "AUS",
         State = "state",
         Zip = "123456",
         Email = id
     };
     repo.CreateUser(user);
 }
        public void UserCreateSuccessful()
        {
            var repo = new UserRepository();
            var id = Guid.NewGuid().ToString();
            var user = new User
            {
                Id = id,
                FirstName = "Test",
                LastName = "Test",
                City = "Test",
                AddressLine1 = "Line 1",
                Country = "AUS",
                State = "state",
                Zip = "123456",
                Email = id + "@google.com"
            };

            var createdUser = repo.CreateUser(user);

            Assert.AreEqual(user.Id, createdUser.Id);
            Assert.AreEqual(user.FirstName, createdUser.FirstName);
            Assert.AreEqual(user.LastName, createdUser.LastName);
            Assert.AreEqual("Test Test", createdUser.FullName);
            Assert.AreEqual(user.Email, createdUser.Email);
            Assert.IsTrue(createdUser.CreatedAt.HasValue);
            Assert.IsTrue(createdUser.UpdatedAt.HasValue);
        }
 public void ValidationErrorUserCreateWrongCountry()
 {
     var repo = new UserRepository();
     var id = Guid.NewGuid().ToString();
     var user = new User
     {
         Id = id,
         FirstName = "Test",
         LastName = "Test",
         City = "Test",
         AddressLine1 = "Line 1",
         Country = "Australia", //Not a correct ISO code
         State = "state",
         Zip = "123456",
         Email = id + "@google.com"
     };
     repo.CreateUser(user);
 }
 public void SendMobilePinSuccessful()
 {
     var repo = new UserRepository();
     repo.SendMobilePin("89592d8a-6cdb-4857-a90d-b41fc817d639"); //ID for user with mobile phone
 }
 public void DeleteUserMissingId()
 {
     var repo = new UserRepository();
     var id = Guid.NewGuid().ToString();
     Assert.IsFalse(repo.DeleteUser(id));
 }
        public void ListUsersSuccessful()
        {
            //First, create a user, so we'll have at least one
            var repo = new UserRepository();
            var id = Guid.NewGuid().ToString();
            var user = new User
            {
                Id = id,
                FirstName = "Test",
                LastName = "Test",
                City = "Test",
                AddressLine1 = "Line 1",
                Country = "AUS",
                State = "state",
                Zip = "123456",
                Email = id + "@google.com"
            };

            var createdUser = repo.CreateUser(user);

            //Then, list users
            var users = repo.ListUsers(200);

            Assert.IsNotNull(users);
            Assert.IsTrue(users.Any());
            Assert.IsTrue(users.Any(x => x.Id == id));
        }
 public void ListUsersTooHighLimit()
 {
     var repo = new UserRepository();
     repo.ListUsers(201);
 }
 public void ListUserPayPalAccountsSuccessful()
 {
     var repo = new UserRepository();
     var items = repo.ListPayPalAccountsForUser("89592d8a-6cdb-4857-a90d-b41fc817d639");
 }
 public void ListUsersNegativeParams()
 {
     var repo = new UserRepository();
     repo.ListUsers(-10, -20);
 }
 public void ListUserDisbursementAccountsSuccessful()
 {
     var repo = new UserRepository();
     var items = repo.GetDisbursementAccount("89592d8a-6cdb-4857-a90d-b41fc817d639", "123","123");
 }
        public void GetUserSuccessful()
        {
            //First, create a user with known id
            var repo = new UserRepository();
            var id = Guid.NewGuid().ToString();
            var user = new User
            {
                Id = id,
                FirstName = "Test",
                LastName = "Test",
                City = "Test",
                AddressLine1 = "Line 1",
                Country = "AUS",
                State = "state",
                Zip = "123456",
                Email = id + "@google.com"
            };

            var createdUser = repo.CreateUser(user);

            //Then, get user
            var gotUser = repo.GetUserById(id);

            Assert.IsNotNull(gotUser);
            Assert.AreEqual(gotUser.Id, id);
        }
 public void GetUserMissingId()
 {
     var repo = new UserRepository();
     var id = Guid.NewGuid().ToString();
     repo.GetUserById(id);
 }
        public void EditUserSuccessful()
        {
            //First, create a user we'll work with
            var repo = new UserRepository();
            var id = Guid.NewGuid().ToString();
            var user = new User
            {
                Id = id,
                FirstName = "Test",
                LastName = "Test",
                City = "Test",
                AddressLine1 = "Line 1",
                Country = "AUS",
                State = "state",
                Zip = "123456",
                Email = id + "@google.com"
            };

            var createdUser = repo.CreateUser(user);

            //Now, try to edit newly created user
            user.FirstName = "Test123";
            user.LastName = "Test123";
            var modifiedUser = repo.UpdateUser(user);

            Assert.AreEqual("Test123", modifiedUser.FirstName);
            Assert.AreEqual("Test123", modifiedUser.LastName);
        }
Exemple #16
0
 public void SendMobilePinSuccessful()
 {
     var repo = new UserRepository();
 }