/// <summary> /// Returns true if Link instances are equal /// </summary> /// <param name="other">Instance of Link to be compared</param> /// <returns>Boolean</returns> public bool Equals(Link other) { if (other is null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( Rel == other.Rel || Rel != null && Rel.Equals(other.Rel) ) && ( Href == other.Href || Href != null && Href.Equals(other.Href) )); }
public IOicResource CreateResource(OicResolver resolver) { if (!resolver.TryGetResourseType(ResourceTypes, out var type)) { throw new NotImplementedException($"Unsupported resource types [\"{string.Join("\", ", ResourceTypes)}\"]"); } if (!Rel.Equals("hosts", StringComparison.OrdinalIgnoreCase)) { throw new NotImplementedException($"Unsure how to implement rel = \"{Rel}\" at this stage."); } var resource = (IOicResource)Activator.CreateInstance(type); resource.Name = Title; resource.RelativeUri = Href.OriginalString; // Todo: Figure out how to get the relative path from a Resource Link and not assume OriginalString will always work foreach (var resourceType in ResourceTypes) { resource.ResourceTypes.Add(resourceType); } resource.Interfaces |= Interfaces; return(resource); }
public bool Equals(Link other) { if (other == null) { return(false); } if (!Rel.Equals(other.Rel, StringComparison.InvariantCultureIgnoreCase)) { return(false); } if (!Href.Equals(other.Href, StringComparison.InvariantCultureIgnoreCase)) { return(false); } if (!Method.Equals(other.Method, StringComparison.InvariantCultureIgnoreCase)) { return(false); } if (Links.Intersect(other.Links).Any()) { return(false); } return(true); }
public bool IsNext() { return(Rel.Equals("next", StringComparison.OrdinalIgnoreCase)); }
public bool IsLast() { return(Rel.Equals("last", StringComparison.OrdinalIgnoreCase)); }