public override TestResult Execute(int paramSetId) { try { var param = new NameValueCollection(); _unitTestVm.ReadParameterValue(paramSetId, "USER", param); _unitTestVm.ReadParameterValue(paramSetId, "LOGIN", param); _unitTestVm.ReadParameterValue(paramSetId, "PASSWORD", param); var userInfo = new MgUserInformation(); userInfo.SetMgUsernamePassword(param["LOGIN"], param["PASSWORD"]); userInfo.SetLocale("en"); var site = new MgSite(); site.Open(userInfo); MgByteReader reader = site.EnumerateGroups(param["USER"]); site.Close(); return(TestResult.FromByteReader(reader)); } catch (MgException ex) { return(TestResult.FromMgException(ex)); } }
public override TestResult Execute(int paramSetId) { try { var param = new NameValueCollection(); _unitTestVm.ReadParameterValue(paramSetId, "USER", param); _unitTestVm.ReadParameterValue(paramSetId, "LOGIN", param); _unitTestVm.ReadParameterValue(paramSetId, "PASSWORD", param); var userInfo = new MgUserInformation(); userInfo.SetMgUsernamePassword(param["LOGIN"], param["PASSWORD"]); userInfo.SetLocale("en"); var site = new MgSite(); site.Open(userInfo); MgStringCollection roles = site.EnumerateRoles(param["USER"]); site.Close(); return(new TestResult(CommonUtility.MgStringCollectionToString(roles), "text/plain")); } catch (MgException ex) { return(TestResult.FromMgException(ex)); } }
public override TestResult Execute(int paramSetId) { try { var site = new MgSite(); var user = new MgUserInformation(); user.SetMgSessionId(_session.SessionID ?? ""); site.Open(user); var userId = site.GetUserForSession(); site.Close(); return(new TestResult(userId, "text/plain")); } catch (MgException ex) { return(TestResult.FromMgException(ex)); } }
public override TestResult Execute(int paramSetId) { try { var user = new MgUserInformation(); user.SetMgUsernamePassword("Administrator", "admin"); user.SetLocale("en"); var site = new MgSite(); site.Open(user); string session = site.CreateSession(); _session.SessionID = session; site.Close(); return(new TestResult(session, "text/plain")); } catch (MgException ex) { return(TestResult.FromMgException(ex)); } }