Пример #1
0
        public void CreateFun()
        {
            fManageController.FunTypeKey = "Create";
            commonFixture.MockControllerInfo(fManageController, "http://localhost:50653/AccessControl/FManage/Create");

            List <FunctionSelectedType> entityList_FunctionSelectedType = new List <FunctionSelectedType>();

            entityList_FunTypeVM.ForEach(current =>
            {
                entityList_FunctionSelectedType.Add(new FunctionSelectedType()
                {
                    FunctionType = current.FunctionType,
                    ID           = current.ID,
                    Selected     = true
                });
            });

            FunctionVM functionVM = new FunctionVM()
            {
                FunctionPath     = "1100",
                FunctionName     = "",
                FunctionKey      = "Temp",
                SelectedTypeList = entityList_FunctionSelectedType
            };

            ActionResult result = fManageController.Create(functionVM);

            Assert.IsType <RedirectToRouteResult>(result);
        }
        public void DisplayLoginPage()
        {
            LoginUserMgtHelper luMgtHelper = new LoginUserMgtHelper(this.commonFixture.postOffice.LoginUserMgtSerPath);

            commonFixture.MockControllerInfo(loginController, "http://localhost:50653/AccessControl/Login/Index");

            ViewResult loginPageResult_Index = (ViewResult)loginController.Index("cn");

            Assert.True(loginPageResult_Index.TempData.ContainsKey(StaticContent.LanguageKey));

            Assert.True(loginPageResult_Index.TempData[StaticContent.LanguageKey].ToString() == "cn");
        }
        public void CreateFunType()
        {
            ftManageController.FunTypeKey = "Create";
            commonFixture.MockControllerInfo(ftManageController, "http://localhost:50653/AccessControl/FTManage/Create");

            FunctionTypeVM functionTypeVM = new FunctionTypeVM()
            {
                FunctionType = "FTTest"
            };

            ActionResult result = ftManageController.Create(functionTypeVM);

            Assert.IsType <RedirectToRouteResult>(result);
        }
Пример #4
0
        public void CreateLoginUser()
        {
            loginUserMgtController.FunTypeKey = "Create";
            commonFixture.MockControllerInfo(loginUserMgtController, "http://localhost:50653/AccessControl/LoginUserManage/Create");

            Random random = new Random();

            #region [ Create Login User with Specific Functions ]
            //00010001
            FunctionVM entity_FunctionVM = entityList_FunctionVM.Where(current => current.FunctionPath == "00010001").FirstOrDefault();

            string str_FunID = entity_FunctionVM.ID.ToString();

            FunDetailInfo entity_FunDetailInfo = new FunDetailInfo();

            WebCommonHelper webCommonHelper = new WebCommonHelper();
            webCommonHelper.CallWCFHelper(loginUserMgtController, (entity_WCFSessionVM) =>
            {
                entity_FunDetailInfo = loginUserMgtController.funMgtHelper.Value.GetFunDetailInfo_FID(entity_WCFSessionVM, str_FunID);
                entity_FunDetailInfo.FDSelected.ForEach(current => current = true);
            });

            JavaScriptSerializer javaScriptSerializer = new JavaScriptSerializer();

            List <FunDetailInfo> entityList_FunDetailInfo = new List <FunDetailInfo>();
            entityList_FunDetailInfo.Add(entity_FunDetailInfo);

            int    r             = random.Next(1, 1000);
            string str_LoginName = "A" + r;

            //LoginUser
            LoginUserVM loginUserVM = new LoginUserVM()
            {
                LoginName     = str_LoginName,
                NewPwd        = "A12346.b",
                ConfirmNewPwd = "A12346.b",
                Status        = 1,
                UserType      = 1,
                funDListJson  = javaScriptSerializer.Serialize(entityList_FunDetailInfo)
            };

            ActionResult actionResult = loginUserMgtController.Create(loginUserVM);

            Assert.IsType <RedirectToRouteResult>(actionResult);
            #endregion

            #region [ Create Login User with Role ]
            r             = random.Next(1, 1000);
            str_LoginName = "A" + r;
            loginUserVM   = new LoginUserVM()
            {
                LoginName      = str_LoginName,
                NewPwd         = "A12346.b",
                ConfirmNewPwd  = "A12346.b",
                Status         = 1,
                UserType       = 2,
                roleListIDList = String.Join("|", entityList_LUserRoleVM.Select(current => current.ID.ToString()).ToArray())
            };
            actionResult = loginUserMgtController.Create(loginUserVM);

            Assert.IsType <RedirectToRouteResult>(actionResult);
            #endregion

            #region [ Create Login User with Org ]
            List <string> strList_Org = entityList_LUserOrganizationVM.Where(current => current.OrganizationPath == "00010001" || current.OrganizationPath == "000100010002").Select(current => current.ID.ToString()).ToList();

            List <string> strList_OrgDetail = entityList_LUserOrgDetailsVM.Select(current => current.ID.ToString()).ToList();

            r             = random.Next(1, 1000);
            str_LoginName = "A" + r;
            loginUserVM   = new LoginUserVM()
            {
                LoginName        = str_LoginName,
                NewPwd           = "A12346.b",
                ConfirmNewPwd    = "A12346.b",
                Status           = 1,
                UserType         = 3,
                orgListIDList    = String.Join("|", strList_Org),
                orgDetailsIDList = String.Join("|", strList_OrgDetail)
            };
            actionResult = loginUserMgtController.Create(loginUserVM);

            Assert.IsType <RedirectToRouteResult>(actionResult);
            #endregion
        }