public void Must_be_comparable() { DomainName a = "example.com"; DomainName b = "example.com"; DomainName c = "apple.com"; DomainName d = "orange.com"; a.CompareTo(b).Should().Be(0); b.CompareTo(a).Should().Be(0); b.CompareTo(c).Should().Be(1); b.CompareTo(d).Should().Be(-1); }
internal bool IsCovering(DomainName name) { DomainName nextDomainName = new DomainName(NextHashedOwnerName.ToBase32HexString(), name.GetParentName()); // NSEC*-Record are organized in a chained list with the last element pointing to the first. // So either the name being queries is between the current item (Name) and nextDomainName or // the current item is greater than the the next item. In this case, we have to cases: // 1. The name being queried is on the right side of the list (name > nextName) // 2. The name being queired is on the left side of the list (Name < name) // If one of these three criteria is met, the record is covering the name being queried. return((name.CompareTo(Name) > 0 && name.CompareTo(nextDomainName) < 0) || (Name.CompareTo(nextDomainName) > 0 && (name.CompareTo(Name) > 0 || name.CompareTo(nextDomainName) < 0))); }
internal bool IsCovering(DomainName name, DomainName zone) { return(((name.CompareTo(Name) > 0) && (name.CompareTo(NextDomainName) < 0)) || // within zone ((name.CompareTo(Name) > 0) && NextDomainName.Equals(zone))); // behind zone }
internal bool IsCovering(DomainName name) { DomainName nextDomainName = new DomainName(NextHashedOwnerName.ToBase32HexString(), name.GetParentName()); return((name.CompareTo(Name) > 0) && (name.CompareTo(nextDomainName) < 0)); }