public bool IsMatch (EndpointDiscoveryMetadata endpointDiscoveryMetadata)
{
var edm = endpointDiscoveryMetadata;
if (edm == null)
throw new ArgumentNullException ("endpointDiscoveryMetadata");
if (ContractTypeNames.Count > 0) {
bool match = false;
foreach (var qn in ContractTypeNames)
if (edm.ContractTypeNames.Contains (qn))
match = true;
if (!match)
return false;
}
if (Scopes.Count > 0) {
bool match = false;
foreach (var scope in Scopes) {
if (ScopeMatchBy == null || ScopeMatchBy.Equals (ScopeMatchByPrefix)) {
if (edm.Scopes.Contains (scope))
match = true;
} else if (ScopeMatchBy.Equals (ScopeMatchByExact)) {
if (edm.Scopes.Any (s => s.AbsoluteUri == scope.AbsoluteUri))
match = true;
}
else if (ScopeMatchBy.Equals (ScopeMatchByUuid))
throw new NotImplementedException ();
else if (ScopeMatchBy.Equals (ScopeMatchByNone))
throw new NotImplementedException ();
else if (ScopeMatchBy.Equals (ScopeMatchByLdap))
throw new NotImplementedException ();
else
throw new InvalidOperationException (String.Format ("Unexpected ScopeMatchBy value: {0}", ScopeMatchBy));
}
if (!match)
return false;
}
if (Extensions.Count > 0)
throw new NotImplementedException (String.Format ("{0} extensions are found", Extensions.Count));
return true;
}