Пример #1
0
        public void Deserialization_Is_Correct(string json, BidirectionalList <int> expected, BidirectionalList <int> actual)
        {
            "Isolate the expected bidirectional assets".x(() => expected = this.BidiCollection);

            "That we can serialize the collection".x(() => json = SerializeObject(this.BidiCollection).AssertNotNull().AssertNotEmpty());

            "That we can deserialize the collection".x(() => actual = DeserializeObject <BidirectionalList <int> >(json).AssertNotNull());

            "And the collection deserialized correctly".x(() => actual.AssertNotSame(expected).AssertEqual(expected));
        }
Пример #2
0
        public void Background(IEnumerable <int> range)
        {
            "Initialize the range".x(() => range = Range(0, 1, 2, 3).ToList());

            "Initialize the collection".x(() => this.Collection = range.AssertIsType <List <int> >());

            "Verify the collection".x(() => this.Collection.AssertEqual(range));

            "Initialize the bidirectional scaffold".x(() => this.BidiCollection = this.Collection.ToBidirectionalList());

            "Verify the bidirectional asset".x(() => this.BidiCollection.AssertEqual(range));

            "Verify the bidirectional collection".x(() => this.BidiCollection.Collection.AssertEqual(range));

            "Verify the bidirectional collection instance".x(() => this.BidiCollection.Collection.AssertSame(this.Collection));
        }
Пример #3
0
 /// <summary>
 /// Configures the <paramref name="list"/> given an <paramref name="onConfig"/> callback.
 /// Allows for an opportunity to do further configuration on the Bidirectional assets,
 /// connect any <see cref="BidirectionalListItemCallback{T}"/> events, obtain the internal
 /// <see cref="IBidirectionalList{T}.Collection"/>, and so on.
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="list">The List being configured.</param>
 /// <param name="onConfig">A configuration Callback.</param>
 /// <returns></returns>
 public static BidirectionalList <T> Configure <T>(this BidirectionalList <T> list
                                                   , Action <BidirectionalList <T> > onConfig = null)
 {
     onConfig?.Invoke(list);
     return(list);
 }