Esempio n. 1
0
 private void Child_Changed(object sender, JsonValueChangeEventArgs e)
 {
     for (int i = 0; i < this.grid.Items.Count; i++)
     {
         if (this.grid.Items[i] == sender)
         {
             int index = this.grid.Items.IndexOf(this.grid.Items[i]);
             this.grid.Items.RemoveAt(index);
             this.grid.Items.Insert(index, sender);
         }
     }
 }
Esempio n. 2
0
        private static void ValidateExpectedEvents(List <Tuple <bool, JsonValue, JsonValueChangeEventArgs> > expectedEvents, List <Tuple <bool, JsonValue, JsonValueChangeEventArgs> > actualEvents)
        {
            Assert.Equal(expectedEvents.Count, actualEvents.Count);
            for (int i = 0; i < expectedEvents.Count; i++)
            {
                bool expectedIsChanging = expectedEvents[i].Item1;
                bool actualIsChanging   = expectedEvents[i].Item1;
                Assert.Equal(expectedIsChanging, actualIsChanging);

                JsonValue expectedSender = expectedEvents[i].Item2;
                JsonValue actualSender   = actualEvents[i].Item2;
                Assert.Equal(expectedSender, actualSender);

                JsonValueChangeEventArgs expectedEventArgs = expectedEvents[i].Item3;
                JsonValueChangeEventArgs actualEventArgs   = actualEvents[i].Item3;
                Assert.Equal(expectedEventArgs.Change, actualEventArgs.Change);
                Assert.Equal(expectedEventArgs.Index, actualEventArgs.Index);
                Assert.Equal(expectedEventArgs.Key, actualEventArgs.Key);

                string expectedChild = expectedEventArgs.Child == null ? "null" : expectedEventArgs.Child.ToString();
                string actualChild   = actualEventArgs.Child == null ? "null" : actualEventArgs.Child.ToString();
                Assert.Equal(expectedChild, actualChild);
            }
        }
 private static void PreventChanging(object sender, JsonValueChangeEventArgs e)
 {
     throw new InvalidOperationException("AnyInstance.AnyJsonArray or AnyJsonObject cannot be modified; please clone the instance if the test needs to change it.");
 }
Esempio n. 4
0
 private static void PreventChanging(object sender, JsonValueChangeEventArgs e)
 {
     throw new InvalidOperationException("AnyInstance.AnyJsonArray or AnyJsonObject cannot be modified; please clone the instance if the test needs to change it.");
 }
Esempio n. 5
0
 private void Items_Changed(object sender, JsonValueChangeEventArgs e)
 {
     switch (e.Change)
     {
         case JsonValueChange.Add:
             this.grid.Items.Insert(e.Index, e.Child);
             break;
         case JsonValueChange.Remove:
             this.grid.Items.RemoveAt(e.Index);
             break;
     }
 }