public void IndexTest()
        {
            //Get a manual mock repository (IUserViewModel instance)
            //that includes two users, to be injected as a constructor parameter.
            IUserViewModel viewModel = new myUserViewModel();
            UsersController target = new UsersController(viewModel);

            ViewResult actual = target.Index();
            IUserViewModel result = (IUserViewModel)actual.Model;

            Assert.AreEqual(result.sysUsers.Count, 2);
        }
        public void UserForm_AddUserMissingFieldTest()
        {
            IUserViewModel viewModel = new myUserViewModel();
            UsersController target = new UsersController(viewModel);
            SysUser sysUser = new MockUserAdmin.Models.SysUser
            {
                EmailAddress = "*****@*****.**",
                Password = "******",
                FirstName = "Unique",
                //LastName = "User"
            };
            target.ModelState.AddModelError("LastName", "Please enter Last Name");
            int UserCountBefore = viewModel.sysUsers.Count;

            ViewResult actual = target.UserForm(sysUser);
            IList<Models.SysUser> result = (IList<Models.SysUser>)actual.Model;

            int UserCountAfter = result.Count;
            Assert.AreEqual(UserCountAfter, UserCountBefore );
        }
        public void UserForm_AddUserTest()
        {
            IUserViewModel viewModel = new myUserViewModel();
            UsersController target = new UsersController(viewModel);
            SysUser sysUser = new MockUserAdmin.Models.SysUser
            {
                EmailAddress = "*****@*****.**",
                Password = "******",
                FirstName = "Unique",
                LastName = "User"
            };

            int UserCountBefore = viewModel.sysUsers.Count;

            ViewResult actual = target.UserForm(sysUser);
            IUserViewModel result = (IUserViewModel)actual.Model;

            int UserCountAfter = result.sysUsers.Count;
            //confirm a user was added...
            Assert.AreEqual(UserCountAfter, UserCountBefore + 1);
        }
        public void UserForm_AddUserDuplicateEmailTest()
        {
            IUserViewModel viewModel = new myUserViewModel();
            UsersController target = new UsersController(viewModel);
            SysUser sysUser = new MockUserAdmin.Models.SysUser
            {
                EmailAddress = "*****@*****.**",
                Password = "******",
                FirstName = "User1",
                LastName = "Test"
            };

            int UserCountBefore = viewModel.sysUsers.Count;

            ViewResult actual = target.UserForm(sysUser);
            IUserViewModel result = (IUserViewModel)actual.Model;

            int UserCountAfter = result.sysUsers.Count;
            Assert.AreEqual(UserCountAfter, UserCountBefore );
        }