private JObject WriteRelation(PropertyRelation relation) { return(new JObject( new JProperty("sourceId", new JValue(relation.From.ToString())), new JProperty("targetId", new JValue(relation.To.ToString())) )); }
public void PropertyRelation_ToHashCode_IdenticalForSameFeature() { var relation = new PropertyRelation(new PropertyIdentifier("from"), new PropertyIdentifier("to")); var secondRelation = new PropertyRelation(new PropertyIdentifier("from"), new PropertyIdentifier("to")); Assert.AreEqual(relation.GetHashCode(), secondRelation.GetHashCode()); }
public void ToString_Returns_NotEmptyString() { var from = new PropertyIdentifier("from"); var to = new PropertyIdentifier("to"); var propertyRelation = new PropertyRelation(from, to); Assert.False(string.IsNullOrEmpty(propertyRelation.ToString())); }
public void Constructor_SetsFields_Correctly() { var from = new PropertyIdentifier("from"); var to = new PropertyIdentifier("to"); var propertyRelation = new PropertyRelation(from, to); Assert.AreEqual(from, propertyRelation.From); Assert.AreEqual(to, propertyRelation.To); }
public void RegisterChangedAction(string origin, params Action[] target_action) { if (!PropertyRelations.TryGetValue(origin, out var rel)) { PropertyRelations[origin] = rel = new PropertyRelation(); } foreach (var action in target_action) { if (!rel.RelatedChangedActions.Contains(action)) { rel.RelatedChangedActions.Add(action); } } }
public void RegisterItemActionChanged(string origin, params Action[] OnChanged) { if (!ItemPropertyRelations.TryGetValue(origin, out var rel)) { ItemPropertyRelations[origin] = rel = new PropertyRelation(); } foreach (var act in OnChanged) { if (rel.RelatedChangedActions.Contains(act)) { continue; } rel.RelatedChangedActions.Add(act); } }
public void RegisterRelationProperty(string origin, NotifyBase target_owner, params string[] target_prop) { if (!PropertyRelations.TryGetValue(origin, out var rel)) { PropertyRelations[origin] = rel = new PropertyRelation(); } foreach (var prop in target_prop) { var desc = new NotifyDescriptor(target_owner, prop); if (!rel.RelatedProps.Contains(desc)) { rel.RelatedProps.Add(desc); } } }
public void RegisterItemRelationProperty(string origin, NotifyBase target_owner, params string[] target_prop) { if (!ItemPropertyRelations.TryGetValue(origin, out var rel)) { ItemPropertyRelations[origin] = rel = new PropertyRelation(); } foreach (var prop in target_prop) { var temp = new NotifyDescriptor(target_owner, prop); if (rel.RelatedProps.Contains(temp)) { continue; } rel.RelatedProps.Add(temp); } }
public IEnumerator <TestCaseData> GetEnumerator() { var from = new PropertyIdentifier("from"); var to = new PropertyIdentifier("to"); var propertyRelation = new PropertyRelation(from, to); yield return(new TestCaseData(propertyRelation, propertyRelation).Returns(true)); yield return(new TestCaseData(propertyRelation, new PropertyRelation(new PropertyIdentifier("from"), new PropertyIdentifier("to"))).Returns(true)); yield return(new TestCaseData(propertyRelation, new PropertyRelation(new PropertyIdentifier("to"), new PropertyIdentifier("to"))).Returns(false)); yield return(new TestCaseData(propertyRelation, new PropertyRelation(new PropertyIdentifier("from"), new PropertyIdentifier("from"))).Returns(false)); yield return(new TestCaseData(propertyRelation, null).Returns(false)); yield return(new TestCaseData(propertyRelation, 3).Returns(false)); }
public void TestAuthKey() { var b = new PropertyRelation <ResourceGroupOptions, string>(k => k.ResourceGroup); var s = b.GetAuthKey(); }
public bool Equals_Returns_Correctly(PropertyRelation propertyRelation, object other) { return(propertyRelation.Equals(other)); }