コード例 #1
0
 private JObject WriteRelation(PropertyRelation relation)
 {
     return(new JObject(
                new JProperty("sourceId", new JValue(relation.From.ToString())),
                new JProperty("targetId", new JValue(relation.To.ToString()))
                ));
 }
コード例 #2
0
        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());
        }
コード例 #3
0
        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()));
        }
コード例 #4
0
        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);
        }
コード例 #5
0
 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);
         }
     }
 }
コード例 #6
0
ファイル: NotifyCollection.cs プロジェクト: bigworld12/EZApps
 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);
     }
 }
コード例 #7
0
 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);
         }
     }
 }
コード例 #8
0
ファイル: NotifyCollection.cs プロジェクト: bigworld12/EZApps
 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);
     }
 }
コード例 #9
0
            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));
            }
コード例 #10
0
 public void TestAuthKey()
 {
     var b = new PropertyRelation <ResourceGroupOptions, string>(k => k.ResourceGroup);
     var s = b.GetAuthKey();
 }
コード例 #11
0
 public bool Equals_Returns_Correctly(PropertyRelation propertyRelation, object other)
 {
     return(propertyRelation.Equals(other));
 }