示例#1
0
        public void DeleteLoginUser()
        {
            loginUserMgtController.FunTypeKey = "Delete";
            commonFixture.MockControllerInfo(loginUserMgtController, "http://localhost:50653/AccessControl/LoginUserManage/Delete");

            WCFAuthInfoVM entity_WCFAuthInfoVM = new WCFAuthInfoVM("", "", commonFixture.StrToken, "LoginUserManage", "Delete", this.commonFixture.LanguageKey.ToString(), "");

            loginUserMgtController.guidList_AccessedLUserID = loginUserMgtController.GetLUserIDList(commonFixture.entity_BaseSession, "LoginUserManage", "Create", loginUserMgtController.loginUserMgtHelper.Value, entity_WCFAuthInfoVM);

            LUSerListResult entity_LUSerListResult = loginUserMgtController.loginUserMgtHelper.Value.GetListWithPaging(entity_WCFAuthInfoVM, new LoginUserVM(), 1, int.MaxValue, "", "", new List <string>(), loginUserMgtController.guidList_AccessedLUserID);

            Assert.NotEmpty(entity_LUSerListResult.EntityList_LoginUserVM);


            List <LoginUserVM> entityList_LUVM = entity_LUSerListResult.EntityList_LoginUserVM.Where(current => current.LoginName.IndexOf("Test") == 0).ToList();

            foreach (var item in entityList_LUVM)
            {
                FormCollection formCollection = new FormCollection(new NameValueCollection
                {
                    { "UserID", item.ID.ToString() }
                });

                JsonResult jsonResult = (JsonResult)loginUserMgtController.Delete(formCollection);

                Assert.NotNull(jsonResult.Data);

                Assert.IsType <CommonJsonResult>(jsonResult.Data);

                Assert.True(((CommonJsonResult)jsonResult.Data).Success);
            }
        }
示例#2
0
        public void DeleteLoginUser()
        {
            loginUserMgtController.FunTypeKey = "Delete";
            commonFixture.MockControllerInfo(loginUserMgtController, "http://localhost:50653/AccessControl/LoginUserManage/Delete");

            WCFSessionVM entity_WCFSessionVM = new WCFSessionVM("", "", commonFixture.StrToken, "LoginUserManage", "Delete", this.commonFixture.LanguageKey.ToString(), "");

            Random random = new Random();

            int         r             = random.Next(1, 1000);
            string      str_LoginName = "A" + r;
            LoginUserVM 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())
            };

            WCFReturnResult createResult = loginUserMgtController.loginUserMgtHelper.Value.Create(entity_WCFSessionVM, loginUserVM);

            loginUserMgtController.guidList_AccessedLUserID = loginUserMgtController.GetLUserIDList(commonFixture.entity_ServerSideSession, "LoginUserManage", "Create", loginUserMgtController.loginUserMgtHelper.Value, entity_WCFSessionVM);

            LUSerListResult entity_LUSerListResult = loginUserMgtController.loginUserMgtHelper.Value.GetListWithPaging(entity_WCFSessionVM, new LoginUserVM(), 1, int.MaxValue, "", "", new List <string>(), loginUserMgtController.guidList_AccessedLUserID);

            Assert.NotEmpty(entity_LUSerListResult.EntityList_LoginUserVM);

            LoginUserVM entity_LoginUserVM = entity_LUSerListResult.EntityList_LoginUserVM.Where(current => current.LoginName == str_LoginName).FirstOrDefault();


            FormCollection formCollection = new FormCollection(new NameValueCollection
            {
                { "UserID", entity_LoginUserVM.ID.ToString() }
            });

            JsonResult jsonResult = (JsonResult)loginUserMgtController.Delete(formCollection);

            Assert.NotNull(jsonResult.Data);

            Assert.IsType <CommonJsonResult>(jsonResult.Data);

            Assert.True(((CommonJsonResult)jsonResult.Data).Success);
        }