/// <summary> /// Equals override /// </summary> /// <param name="obj">The object to compare against</param> /// <returns>True if equal</returns> public override bool Equals(object obj) { if (obj is RosetteRelationship) { RosetteRelationship other = obj as RosetteRelationship; List <bool> conditions = new List <bool>() { this.Adjucts != null && other.Adjucts != null?this.Adjucts.SequenceEqual(other.Adjucts) : this.Adjucts == other.Adjucts, #pragma warning disable 618 this.Arguments != null && other.Arguments != null?this.Arguments.SequenceEqual(other.Arguments) : this.Arguments == other.Arguments, #pragma warning restore 618 this.ArgumentsFull != null && other.ArgumentsFull != null?this.ArgumentsFull.SequenceEqual(other.ArgumentsFull) : this.ArgumentsFull == other.ArgumentsFull, this.Confidence == other.Confidence, this.Locatives != null && other.Locatives != null?this.Locatives.SequenceEqual(other.Locatives) : this.Locatives == other.Locatives, this.Predicate == other.Predicate, this.Temporals != null && other.Temporals != null?this.Temporals.SequenceEqual(other.Temporals) : this.Temporals == other.Temporals, this.Modalities != null && other.Modalities != null?this.Modalities.SetEquals(other.Modalities) : this.Modalities == other.Modalities, this.GetHashCode() == other.GetHashCode() }; return(conditions.All(condition => condition)); } else { return(false); } }
internal RelationshipContractResolver(RosetteRelationship relationship) : base() { this.Relationship = relationship; }
public void Relationships_All_Constructors_Equal_Test() { Init(); decimal confidence = (decimal)0.8541343114184464; string predicate = "be filmed"; string arg1 = "The Ghostbusters movie"; string loc1 = "in Boston"; List<string> locatives = new List<string>() {loc1}; RosetteRelationship relationshipFromOriginalConstructor = new RosetteRelationship(predicate, new List<string>() {arg1}, null, locatives, null, confidence); RosetteRelationship relationshipFromDoubleDictConstructor = new RosetteRelationship(predicate, new Dictionary<int, string>() {{1, arg1}}, new Dictionary<int, string>(), null, locatives, null, confidence, null); RosetteRelationship relationshipFromFullArgumentsConstructor = new RosetteRelationship(predicate, new List<Argument>() {new Argument(1, arg1, null)}, null, locatives, null, confidence, null); Assert.True(relationshipFromOriginalConstructor.Equals(relationshipFromDoubleDictConstructor) && relationshipFromDoubleDictConstructor.Equals(relationshipFromFullArgumentsConstructor) && relationshipFromOriginalConstructor.ToString().Equals(relationshipFromDoubleDictConstructor.ToString()) && relationshipFromDoubleDictConstructor.ToString().Equals(relationshipFromFullArgumentsConstructor.ToString())); }