Пример #1
0
        public void ActivateUser_Success()
        {
            var result = _controller.ActivateUser(new UserViewModel()
            {
                UserID = 11, ForceRollback = true
            });
            var jsonResponse  = (JsonResult)result;
            var data          = result.Data;
            var modelResponse = (Response <UserModel>)data;
            var rowsAffected  = modelResponse.RowAffected;

            Assert.IsTrue(rowsAffected > 0);
        }
        public void ActivateUser()
        {
            AdminController adminController = new AdminController(adminRuleEngine);
            UserModel       activateModel   = new UserModel()
            {
                UserID      = 11, UserName = "******", FirstName = "Test", LastName = "User", EffectiveToDate = DateTime.Now, Roles = new List <RoleModel>()
                {
                }, IsActive = false, ForceRollback = true
            };
            var activateUserResult = adminController.ActivateUser(activateModel);
            var response           = activateUserResult as HttpResult <Response <UserModel> >;
            var data         = response.Value.DataItems;
            int rowsAffected = response.Value.RowAffected;

            Assert.IsNotNull(data);
            Assert.IsTrue(data.Contains(activateModel));
            Assert.AreEqual(4, data.Count());
        }