Exemplo n.º 1
0
        /// <summary>
        /// 測通刷新方法時所用的
        /// </summary>
        private void SessionReflashSetting()
        {
            #region arrange

            List <RoleDTO> reRoleDTO = new List <RoleDTO>()
            {
                new RoleDTO()
                {
                    RoleID = 1, RoleName = "Admin", Description = "最高權限"
                },
                new RoleDTO()
                {
                    RoleID = 2, RoleName = "A", Description = "A1"
                },
                new RoleDTO()
                {
                    RoleID = 3, RoleName = "B", Description = "B1"
                }
            };

            List <SecurityRoleFunctionDTO> reSRFRole = new List <SecurityRoleFunctionDTO>()
            {
                new SecurityRoleFunctionDTO()
                {
                    Description = "首頁", Url = "Home/Index"
                },
                new SecurityRoleFunctionDTO()
                {
                    Description = "瀏覽角色管理畫面", Url = "Role/RoleManagement"
                },
                new SecurityRoleFunctionDTO()
                {
                    Description = "角色新增修改刪除畫面", Url = "Role/RoleAddEditDelete"
                },
                new SecurityRoleFunctionDTO()
                {
                    Description = "編輯角色", Url = "Role/EditRole"
                },
                new SecurityRoleFunctionDTO()
                {
                    Description = "編輯角色使用者畫面", Url = "Role/RoleUserEdit"
                }
            };

            // httpContext物件設定
            var httpContext = FakeHttpContextManager.CreateHttpContextBase();
            httpContext.Session["UserID"]      = 1;
            httpContext.Session["AccountName"] = "kevan";

            // 設定httpContext
            _target.CurrentHttpContext = httpContext;

            _loginService.Stub(o => o.GetRoleDataByUserID(Arg <string> .Is.Anything)).Return(reRoleDTO);

            _securityService.Stub(o => o.GetSecurityRoleFunction(Arg <string> .Is.Anything)).Return(reSRFRole);

            #endregion
        }
Exemplo n.º 2
0
        public void SaveRoleFunctionSettingTest()
        {
            #region arrange (處理有關選時的行為 成功)

            // httpContext物件設定
            var httpContext = FakeHttpContextManager.CreateHttpContextBase();
            httpContext.Response.StatusCode = 200;

            // 設定httpContext
            _target.CurrentHttpContext = httpContext;

            List <FunctionCheckVO> functionCheckVO = new List <FunctionCheckVO>()
            {
                new FunctionCheckVO()
                {
                    RoleID = 1, FunctionID = 1, Url = "Role/RoleManagement", Description = "瀏覽角色管理畫面", Check = true
                },
                new FunctionCheckVO()
                {
                    RoleID = 1, FunctionID = 2, Url = "Role/RoleAddEditDelete", Description = "角色新增修改刪除畫面", Check = true
                },
                new FunctionCheckVO()
                {
                    RoleID = 1, FunctionID = 3, Url = "Role/EditRole", Description = "編輯角色", Check = false
                }
            };

            string roleID = null;

            string reMessage = string.Empty;

            _functionService.Stub(o => o.SaveRoleFunctionSetting(Arg <List <FunctionCheckVO> > .Is.Anything)).Return(reMessage);

            SessionReflashSetting();

            #endregion

            #region act

            var resultData = _target.SaveRoleFunctionSetting(functionCheckVO, roleID);

            var result = (string)((JsonResult)resultData).Data;

            #endregion

            #region assert

            Assert.AreEqual(_target.CurrentHttpContext.Response.StatusCode, 200);

            Assert.AreEqual(result, reMessage);

            #endregion
        }
Exemplo n.º 3
0
        public void RegistAccountTest()
        {
            #region arrange (註冊成功)

            // httpContext物件設定
            var httpContext = FakeHttpContextManager.CreateHttpContextBase();
            httpContext.Response.StatusCode = 200;

            // 傳入參數
            Account account = new Account()
            {
                UserName        = "******",
                Password        = "******",
                PasswordConfirm = "1qaz@WSX",
                AccountName     = "Kevan",
                Email           = "*****@*****.**"
            };

            // 回傳參數
            ExecuteResult reData = new ExecuteResult()
            {
                IsSuccessed = true
            };

            // 驗證資料
            _registService.Stub(o => o.RegistValid(Arg <Account> .Is.Anything)).Return(reData);
            // 註冊資料
            _registService.Stub(o => o.Regist(Arg <Account> .Is.Anything)).Return(reData);
            // 設定httpContext
            _target.CurrentHttpContext = httpContext;

            #endregion

            #region act

            var resultData = _target.RegistAccount(account);

            var result = (ExecuteResult)(((JsonResult)resultData).Data);

            #endregion

            #region assert

            // 測試回應狀態
            Assert.AreEqual(_target.CurrentHttpContext.Response.StatusCode, 200);

            // 測試註冊結果
            Assert.AreEqual(result.IsSuccessed, true);

            #endregion
        }
Exemplo n.º 4
0
        public void LogoutTest()
        {
            // arrange
            var httpContext = FakeHttpContextManager.CreateHttpContextBase();

            // 設定httpContext
            _target.CurrentHttpContext = httpContext;

            // act
            var result = _target.Logout() as RedirectToRouteResult;

            // assert
            Assert.IsTrue(!string.IsNullOrEmpty(result.RouteValues["action"].ToString()) && result.RouteValues["action"].ToString() == "Login");

            Assert.IsTrue(!string.IsNullOrEmpty(result.RouteValues["controller"].ToString()) && result.RouteValues["controller"].ToString() == "Account");
        }
Exemplo n.º 5
0
        public void AddFunctionTest1()
        {
            #region arrange (新增失敗)

            // httpContext物件設定
            var httpContext = FakeHttpContextManager.CreateHttpContextBase();
            httpContext.Response.StatusCode = 200;

            FunctionVO functionVO = new FunctionVO()
            {
                Url = "Role/RoleManagement", Title = "角色管理", Description = "瀏覽角色管理畫面", IsMenu = true, Parent = 0
            };

            string reMessage = "新增失敗。";

            _functionService.Stub(o => o.AddFunction(Arg <FunctionVO> .Is.Anything)).Return(reMessage);

            // 設定httpContext
            _target.CurrentHttpContext = httpContext;

            #endregion

            #region act

            var resultData = _target.AddFunction(functionVO);

            var result = (FunctionVO)(((JsonResult)resultData).Data);

            #endregion

            #region assert

            // 測試回應狀態
            Assert.AreEqual(_target.CurrentHttpContext.Response.StatusCode, 400);

            // 測試回傳結果
            Assert.AreEqual(result.Url, functionVO.Url);
            Assert.AreEqual(result.Title, functionVO.Title);
            Assert.AreEqual(result.Description, functionVO.Description);
            Assert.AreEqual(result.IsMenu, functionVO.IsMenu);
            Assert.AreEqual(result.Parent, functionVO.Parent);
            Assert.AreEqual(result.ParentName, functionVO.ParentName);
            Assert.AreEqual(result.Message, reMessage);

            #endregion
        }
Exemplo n.º 6
0
        public void LoginTest2()
        {
            #region arrange (登入失敗)

            // httpContext物件設定
            var httpContext = FakeHttpContextManager.CreateHttpContextBase();
            httpContext.Response.StatusCode = 200;

            // 輸入參數 登入資訊
            AccountInfoData accountInfoData = new AccountInfoData()
            {
                AccountName = "Jon",
                Password    = "******"
            };

            // 輸出參數 驗證後結果
            ExecuteResult reExcuteResult = new ExecuteResult()
            {
                IsSuccessed = false,
                Message     = "該帳號不存在。"
            };

            // 驗證帳號密碼
            _loginService.Stub(o => o.AccountValid(Arg <AccountInfoData> .Is.Anything)).Return(reExcuteResult);

            // 設定httpContext
            _target.CurrentHttpContext = httpContext;

            #endregion

            #region act

            var result = _target.Login(accountInfoData) as ViewResult;

            #endregion

            #region assert

            // 驗證資料
            Assert.AreEqual(((AccountInfoData)result.Model).AccountName, accountInfoData.AccountName);
            Assert.AreEqual(((AccountInfoData)result.Model).Password, accountInfoData.Password);
            Assert.AreEqual(((AccountInfoData)result.Model).Message, reExcuteResult.Message);

            #endregion
        }
Exemplo n.º 7
0
        public void AddRoleTest1()
        {
            #region arrange (新增失敗)

            // httpContext物件設定
            var httpContext = FakeHttpContextManager.CreateHttpContextBase();
            httpContext.Response.StatusCode = 200;

            // 傳入新增的腳色
            RoleVO roleVO = new RoleVO()
            {
                RoleName = "Admin", Description = "最高權限"
            };

            // 回傳新增後的腳色
            string reMessage = "新增失敗。";

            _roleService.Stub(o => o.AddRole(Arg <RoleVO> .Is.Anything)).Return(reMessage);

            // 設定httpContext
            _target.CurrentHttpContext = httpContext;

            #endregion

            #region act

            var resultData = _target.AddRole(roleVO);

            var result = (RoleVO)(((JsonResult)resultData).Data);

            #endregion

            #region assert

            // 測試回應狀態
            Assert.AreEqual(_target.CurrentHttpContext.Response.StatusCode, 400);

            // 測試回傳結果
            Assert.AreEqual(result.RoleName, "Admin");
            Assert.AreEqual(result.Description, "最高權限");
            Assert.AreEqual(result.Message, "新增失敗。");

            #endregion
        }
Exemplo n.º 8
0
        public void SaveRoleUserSettingTest3()
        {
            #region arrange (處理清空所有check時的行為 失敗)

            // httpContext物件設定
            var httpContext = FakeHttpContextManager.CreateHttpContextBase();
            httpContext.Response.StatusCode = 200;

            // 設定httpContext
            _target.CurrentHttpContext = httpContext;

            List <UserCheckVO> userCheckVO = new List <UserCheckVO>()
            {
                new UserCheckVO()
                {
                    RoleID = 1, UserID = 1, Check = true, AccountName = "kevan", UserName = "******"
                }
            };

            string roleID = "1";

            string reMessage = "刪除失敗。";

            _roleService.Stub(o => o.ClearRoleUserByRoleID(Arg <string> .Is.Anything)).Return(reMessage);

            #endregion

            #region act

            var resultData = _target.SaveRoleUserSetting(userCheckVO, roleID);

            var result = (string)((JsonResult)resultData).Data;

            #endregion

            #region assert

            Assert.AreEqual(_target.CurrentHttpContext.Response.StatusCode, 400);

            Assert.AreEqual(result, reMessage);

            #endregion
        }
Exemplo n.º 9
0
        public void SaveRoleFunctionSettingTest2()
        {
            #region arrange (處理清空所有check時的行為 成功)

            // httpContext物件設定
            var httpContext = FakeHttpContextManager.CreateHttpContextBase();
            httpContext.Response.StatusCode = 200;

            // 設定httpContext
            _target.CurrentHttpContext = httpContext;

            List <FunctionCheckVO> functionCheckVO = new List <FunctionCheckVO>()
            {
            };

            string roleID = "1";

            string reMessage = string.Empty;

            _functionService.Stub(o => o.ClearRoleFunctionByRoleID(Arg <string> .Is.Anything)).Return(reMessage);

            SessionReflashSetting();

            #endregion

            #region act

            var resultData = _target.SaveRoleFunctionSetting(functionCheckVO, roleID);

            var result = (string)((JsonResult)resultData).Data;

            #endregion

            #region assert

            Assert.AreEqual(_target.CurrentHttpContext.Response.StatusCode, 200);

            Assert.AreEqual(result, reMessage);

            #endregion
        }
Exemplo n.º 10
0
        public void EditRoleTest1()
        {
            #region arrange (編輯失敗)

            // httpContext物件設定
            var httpContext = FakeHttpContextManager.CreateHttpContextBase();
            httpContext.Response.StatusCode = 200;

            // 設定httpContext
            _target.CurrentHttpContext = httpContext;

            RoleVO roleVO = new RoleVO()
            {
                RoleID = 1, RoleName = "Admin", Description = "最高權限"
            };

            string reMessage = "編輯失敗。";

            _roleService.Stub(o => o.EditRole(Arg <RoleVO> .Is.Anything)).Return(reMessage);

            #endregion

            #region act

            var resultData = _target.EditRole(roleVO);

            var result = (string)((JsonResult)resultData).Data;

            #endregion

            #region assert

            // 測試回應狀態
            Assert.AreEqual(_target.CurrentHttpContext.Response.StatusCode, 400);

            Assert.AreEqual(result, reMessage);

            #endregion
        }
Exemplo n.º 11
0
        public void DeleteFunctionTest1()
        {
            #region arrange (刪除失敗)

            // httpContext物件設定
            var httpContext = FakeHttpContextManager.CreateHttpContextBase();
            httpContext.Response.StatusCode = 200;

            string id = "1";

            string reMessage = "刪除失敗。";

            _functionService.Stub(o => o.DeleteFunction(Arg <string> .Is.Anything)).Return(reMessage);

            // 設定httpContext
            _target.CurrentHttpContext = httpContext;

            #endregion

            #region act

            var resultData = _target.DeleteFunction(id);

            var result = (string)(((JsonResult)resultData).Data);

            #endregion

            #region assert

            // 測試回應狀態
            Assert.AreEqual(_target.CurrentHttpContext.Response.StatusCode, 400);

            Assert.AreEqual(result, reMessage);

            #endregion
        }
Exemplo n.º 12
0
        public void DeleteRoleTest()
        {
            #region arrange (成功刪除腳色)

            // httpContext物件設定
            var httpContext = FakeHttpContextManager.CreateHttpContextBase();
            httpContext.Response.StatusCode = 200;

            // 設定httpContext
            _target.CurrentHttpContext = httpContext;

            string id = "1";

            string reMessage = string.Empty;

            _roleService.Stub(o => o.DeleteRole(Arg <string> .Is.Anything)).Return(reMessage);

            #endregion

            #region act

            var resultData = _target.DeleteRole(id);

            var result = (string)(((JsonResult)resultData).Data);

            #endregion

            #region assert

            // 測試回應狀態
            Assert.AreEqual(_target.CurrentHttpContext.Response.StatusCode, 200);

            Assert.AreEqual(result, reMessage);

            #endregion
        }
Exemplo n.º 13
0
        public void EditFunctionTest1()
        {
            #region arrange (編輯成功)

            List <RoleDTO> reRoleDTO = new List <RoleDTO>()
            {
                new RoleDTO()
                {
                    RoleID = 1, RoleName = "Admin", Description = "最高權限"
                },
                new RoleDTO()
                {
                    RoleID = 2, RoleName = "A", Description = "A1"
                },
                new RoleDTO()
                {
                    RoleID = 3, RoleName = "B", Description = "B1"
                },
            };

            List <SecurityRoleFunctionDTO> reSecurityRoleFunctionDTO = new List <SecurityRoleFunctionDTO>()
            {
                new SecurityRoleFunctionDTO()
                {
                    Url = "Role/RoleManagement", Description = "瀏覽角色管理畫面"
                },
                new SecurityRoleFunctionDTO()
                {
                    Url = "Role/RoleAddEditDelete", Description = "角色新增修改刪除畫面"
                },
                new SecurityRoleFunctionDTO()
                {
                    Url = "Role/EditRole", Description = "編輯角色"
                }
            };

            // httpContext物件失敗
            var httpContext = FakeHttpContextManager.CreateHttpContextBase();
            httpContext.Response.StatusCode = 200;

            // 設定httpContext
            _target.CurrentHttpContext = httpContext;

            httpContext.Session["UserID"] = 1;

            httpContext.Session["AccountName"] = "kevan";

            FunctionVO functionVO = new FunctionVO()
            {
                FunctionID = 1, Url = "Role/RoleManagement", Title = "角色管理", Description = "瀏覽角色管理畫面", IsMenu = true, Parent = 0
            };

            string reMessage = "編輯失敗";

            _loginService.Stub(o => o.GetRoleDataByUserID(Arg <string> .Is.Anything)).Return(reRoleDTO);

            _securityService.Stub(o => o.GetSecurityRoleFunction(Arg <string> .Is.Anything)).Return(reSecurityRoleFunctionDTO);

            _functionService.Stub(o => o.EditFunction(Arg <FunctionVO> .Is.Anything)).Return(reMessage);

            #endregion

            #region act

            var resultData = _target.EditFunction(functionVO);

            var result = (string)((JsonResult)resultData).Data;

            #endregion

            #region assert

            // 測試回應狀態
            Assert.AreEqual(_target.CurrentHttpContext.Response.StatusCode, 400);

            Assert.AreEqual(result, reMessage);

            #endregion
        }
Exemplo n.º 14
0
        public void SessionReflashTest()
        {
            #region arrange

            List <RoleDTO> reRoleDTO = new List <RoleDTO>()
            {
                new RoleDTO()
                {
                    RoleID = 1, RoleName = "Admin", Description = "最高權限"
                },
                new RoleDTO()
                {
                    RoleID = 2, RoleName = "A", Description = "A1"
                },
                new RoleDTO()
                {
                    RoleID = 3, RoleName = "B", Description = "B1"
                }
            };

            List <SecurityRoleFunctionDTO> reSRFRole = new List <SecurityRoleFunctionDTO>()
            {
                new SecurityRoleFunctionDTO()
                {
                    Description = "首頁", Url = "Home/Index"
                },
                new SecurityRoleFunctionDTO()
                {
                    Description = "瀏覽角色管理畫面", Url = "Role/RoleManagement"
                },
                new SecurityRoleFunctionDTO()
                {
                    Description = "角色新增修改刪除畫面", Url = "Role/RoleAddEditDelete"
                },
                new SecurityRoleFunctionDTO()
                {
                    Description = "編輯角色", Url = "Role/EditRole"
                },
                new SecurityRoleFunctionDTO()
                {
                    Description = "編輯角色使用者畫面", Url = "Role/RoleUserEdit"
                }
            };

            // httpContext物件設定
            var httpContext = FakeHttpContextManager.CreateHttpContextBase();
            httpContext.Session["UserID"]      = 1;
            httpContext.Session["AccountName"] = "kevan";

            // 設定httpContext
            _target.CurrentHttpContext = httpContext;

            _loginService.Stub(o => o.GetRoleDataByUserID(Arg <string> .Is.Anything)).Return(reRoleDTO);

            _securityService.Stub(o => o.GetSecurityRoleFunction(Arg <string> .Is.Anything)).Return(reSRFRole);

            #endregion

            #region act

            _target.SessionReflash();

            #endregion

            #region assert

            for (int i = 0; i < _target.CurrentSecurityLevel.SecurityRole.Count; i++)
            {
                Assert.AreEqual(_target.CurrentSecurityLevel.SecurityRole[i].RoleID, reRoleDTO[i].RoleID);
                Assert.AreEqual(_target.CurrentSecurityLevel.SecurityRole[i].RoleName, reRoleDTO[i].RoleName);
                Assert.AreEqual(_target.CurrentSecurityLevel.SecurityRole[i].Description, reRoleDTO[i].Description);
            }

            for (int i = 0; i < _target.CurrentSecurityLevel.SecurityUrl.Count; i++)
            {
                Assert.AreEqual(_target.CurrentSecurityLevel.SecurityUrl[i].Url, reSRFRole[i].Url);
                Assert.AreEqual(_target.CurrentSecurityLevel.SecurityUrl[i].Description, reSRFRole[i].Description);
            }

            #endregion
        }
Exemplo n.º 15
0
        public void LoginTest1()
        {
            #region arrange (登入成功)

            // httpContext物件設定
            var httpContext = FakeHttpContextManager.CreateHttpContextBase();
            httpContext.Response.StatusCode = 200;

            // 輸入參數
            AccountInfoData accountInfoData = new AccountInfoData()
            {
                AccountName = "kevan",
                Password    = "******"
            };

            // 輸出參數
            ExecuteResult reExcuteResult = new ExecuteResult()
            {
                IsSuccessed = true
            };

            // 透過帳號名稱所取得的帳號資訊
            UserDTO reUserDTO = new UserDTO()
            {
                UserID      = 1,
                AccountName = "kevan",
                Password    = "******",
                UserName    = "******",
                Email       = "*****@*****.**"
            };

            // 透過ID所取得腳色資料包
            List <RoleDTO> reRoleDTOList = new List <RoleDTO>()
            {
                new RoleDTO()
                {
                    RoleID = 1, RoleName = "Admin", Description = "最高權限"
                },
                new RoleDTO()
                {
                    RoleID = 2, RoleName = "A", Description = "A1"
                },
                new RoleDTO()
                {
                    RoleID = 3, RoleName = "B", Description = "B1"
                }
            };

            // 透過ID取得該使用者所有的權限資料包
            List <SecurityRoleFunctionDTO> reSRFRole1 = new List <SecurityRoleFunctionDTO>()
            {
                new SecurityRoleFunctionDTO()
                {
                    Description = "首頁", Url = "Home/Index"
                },
                new SecurityRoleFunctionDTO()
                {
                    Description = "瀏覽角色管理畫面", Url = "Role/RoleManagement"
                },
                new SecurityRoleFunctionDTO()
                {
                    Description = "角色新增修改刪除畫面", Url = "Role/RoleAddEditDelete"
                },
                new SecurityRoleFunctionDTO()
                {
                    Description = "編輯角色", Url = "Role/EditRole"
                },
                new SecurityRoleFunctionDTO()
                {
                    Description = "編輯角色使用者畫面", Url = "Role/RoleUserEdit"
                }
            };

            List <SecurityRoleFunctionDTO> reSRFRole2 = new List <SecurityRoleFunctionDTO>()
            {
                new SecurityRoleFunctionDTO()
                {
                    Description = "首頁", Url = "Home/Index"
                },
                new SecurityRoleFunctionDTO()
                {
                    Description = "瀏覽角色管理畫面", Url = "Role/RoleManagement"
                },
                new SecurityRoleFunctionDTO()
                {
                    Description = "角色新增修改刪除畫面", Url = "Role/RoleAddEditDelete"
                },
                new SecurityRoleFunctionDTO()
                {
                    Description = "編輯角色", Url = "Role/EditRole"
                },
                new SecurityRoleFunctionDTO()
                {
                    Description = "編輯角色使用者畫面", Url = "Role/RoleUserEdit"
                }
            };

            List <SecurityRoleFunctionDTO> reSRFRole3 = new List <SecurityRoleFunctionDTO>()
            {
                new SecurityRoleFunctionDTO()
                {
                    Description = "首頁", Url = "Home/Index"
                },
                new SecurityRoleFunctionDTO()
                {
                    Description = "瀏覽角色管理畫面", Url = "Role/RoleManagement"
                },
                new SecurityRoleFunctionDTO()
                {
                    Description = "角色新增修改刪除畫面", Url = "Role/RoleAddEditDelete"
                },
                new SecurityRoleFunctionDTO()
                {
                    Description = "編輯角色", Url = "Role/EditRole"
                },
                new SecurityRoleFunctionDTO()
                {
                    Description = "編輯角色使用者畫面", Url = "Role/RoleUserEdit"
                }
            };

            List <SecurityRoleFunctionDTO> reSRF = new List <SecurityRoleFunctionDTO>();
            reSRF.AddRange(reSRFRole1);
            reSRF.AddRange(reSRFRole2);
            reSRF.AddRange(reSRFRole3);

            // 驗證使用者帳號密碼
            _loginService.Stub(o => o.AccountValid(Arg <AccountInfoData> .Is.Anything)).Return(reExcuteResult);

            // 取得帳號資料
            _loginService.Stub(o => o.GetUserDataByAccountName(Arg <AccountInfoData> .Is.Anything)).Return(reUserDTO);

            // 取得腳色資料包
            _loginService.Stub(o => o.GetRoleDataByUserID(Arg <string> .Is.Anything)).Return(reRoleDTOList);

            // 取得功能權限
            _securityService.Stub(o => o.GetSecurityRoleFunction("1")).Return(reSRFRole1);
            _securityService.Stub(o => o.GetSecurityRoleFunction("2")).Return(reSRFRole2);
            _securityService.Stub(o => o.GetSecurityRoleFunction("3")).Return(reSRFRole3);

            // 設定httpContext
            _target.CurrentHttpContext = httpContext;

            #endregion

            #region act

            var result = _target.Login(accountInfoData) as RedirectToRouteResult;

            #endregion

            #region assert

            // 驗證 Action
            Assert.IsTrue(string.IsNullOrEmpty(result.RouteValues["action"].ToString()) || result.RouteValues["action"].ToString() == "Index");

            // 驗證 Controller
            Assert.IsTrue(string.IsNullOrEmpty(result.RouteValues["controller"].ToString()) || result.RouteValues["controller"].ToString() == "Home");

            // 取得 Session 並驗證
            var sessionInfo = _target.CurrentHttpContext.Session["LoginInfo"] as SecurityLevel;

            // 驗證權限資料
            for (int i = 0; i < sessionInfo.SecurityRole.Count; i++)
            {
                Assert.AreEqual(sessionInfo.SecurityRole[i].RoleID, reRoleDTOList[i].RoleID);
                Assert.AreEqual(sessionInfo.SecurityRole[i].RoleName, reRoleDTOList[i].RoleName);
                Assert.AreEqual(sessionInfo.SecurityRole[i].Description, reRoleDTOList[i].Description);
            }

            for (int i = 0; i < sessionInfo.SecurityUrl.Count; i++)
            {
                Assert.AreEqual(sessionInfo.SecurityUrl[i].Url, reSRF[i].Url);
                Assert.AreEqual(sessionInfo.SecurityUrl[i].Description, reSRF[i].Description);
            }

            Assert.AreEqual(sessionInfo.UserData.UserId, 1);
            Assert.AreEqual(sessionInfo.UserData.AccountName, "kevan");

            Assert.AreEqual(_target.CurrentHttpContext.Session["UserName"], "kevan");

            #endregion
        }