aboutsummaryrefslogtreecommitdiff
path: root/src/test/burn/WixTestTools/UserGroupVerifier.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/test/burn/WixTestTools/UserGroupVerifier.cs24
1 files changed, 21 insertions, 3 deletions
diff --git a/src/test/burn/WixTestTools/UserGroupVerifier.cs b/src/test/burn/WixTestTools/UserGroupVerifier.cs
index 2f874057..52a1a6bf 100644
--- a/src/test/burn/WixTestTools/UserGroupVerifier.cs
+++ b/src/test/burn/WixTestTools/UserGroupVerifier.cs
@@ -151,7 +151,7 @@ namespace WixTestTools
151 /// <param name="groupNames">list of groups to check for membership</param> 151 /// <param name="groupNames">list of groups to check for membership</param>
152 private static void IsMemberOf(string domainName, string memberName, bool shouldBeMember, params string[] groupNames) 152 private static void IsMemberOf(string domainName, string memberName, bool shouldBeMember, params string[] groupNames)
153 { 153 {
154 GroupPrincipal group = GetGroup(domainName, memberName); 154 Principal group = GetPrincipal(domainName, memberName);
155 Assert.False(null == group, String.Format("Group '{0}' was not found under domain '{1}'.", memberName, domainName)); 155 Assert.False(null == group, String.Format("Group '{0}' was not found under domain '{1}'.", memberName, domainName));
156 156
157 bool missedAGroup = false; 157 bool missedAGroup = false;
@@ -186,11 +186,29 @@ namespace WixTestTools
186 { 186 {
187 if (String.IsNullOrEmpty(domainName)) 187 if (String.IsNullOrEmpty(domainName))
188 { 188 {
189 return GroupPrincipal.FindByIdentity(new PrincipalContext(ContextType.Machine), IdentityType.Name, groupName); 189 return GroupPrincipal.FindByIdentity(new PrincipalContext(ContextType.Machine), groupName);
190 } 190 }
191 else 191 else
192 { 192 {
193 return GroupPrincipal.FindByIdentity(new PrincipalContext(ContextType.Domain,domainName), IdentityType.Name, groupName); 193 return GroupPrincipal.FindByIdentity(new PrincipalContext(ContextType.Domain,domainName), groupName);
194 }
195 }
196
197 /// <summary>
198 /// Returns the Principal object for a given name
199 /// </summary>
200 /// <param name="domainName">Domain name to look under, if Empty the LocalMachine is assumed as the domain</param>
201 /// <param name="name"></param>
202 /// <returns>Principal Object if found, or null other wise</returns>
203 private static Principal GetPrincipal(string domainName, string name)
204 {
205 if (String.IsNullOrEmpty(domainName))
206 {
207 return Principal.FindByIdentity(new PrincipalContext(ContextType.Machine), name);
208 }
209 else
210 {
211 return Principal.FindByIdentity(new PrincipalContext(ContextType.Domain, domainName), name);
194 } 212 }
195 } 213 }
196 } 214 }