Esempio n. 1
0
        public void DeleteRoleTest()
        {
            #region arrange (刪除成功)

            string id = "1";

            int reDeleteRoleUserResult = 1;

            int reDeleteRoleFunctionResult = 1;

            int reDeleteRoleResult = 1;

            _sqlConnectionHelper.Stub(o => o.BeginTransaction()).Return(new SQLConnTran()
            {
                SqlConn = new SqlConnection(), SqlTrans = null
            });

            _roleUserRepo.Stub(o => o.DeleteRoleUserByRoleID(Arg <string> .Is.Anything, ref Arg <SqlConnection> .Ref(Is.Anything(), null).Dummy, ref Arg <SqlTransaction> .Ref(Is.Anything(), null).Dummy)).Return(reDeleteRoleUserResult);

            _roleFunctionRepo.Stub(o => o.DeleteRoleFunctionByRoleID(Arg <string> .Is.Anything, ref Arg <SqlConnection> .Ref(Is.Anything(), null).Dummy, ref Arg <SqlTransaction> .Ref(Is.Anything(), null).Dummy)).Return(reDeleteRoleFunctionResult);

            _roleRepo.Stub(o => o.DeleteRole(Arg <string> .Is.Anything, ref Arg <SqlConnection> .Ref(Is.Anything(), null).Dummy, ref Arg <SqlTransaction> .Ref(Is.Anything(), null).Dummy)).Return(reDeleteRoleResult);

            string reMessage = "";

            #endregion

            #region act

            var result = _target.DeleteRole(id);

            #endregion

            #region assert

            Assert.AreEqual(result, reMessage);

            #endregion
        }