public void Set() { BaseCollection <int> collection = new BaseCollection <int>( ); collection.Set(new [] { 1, 2, 3 }); Assert.AreEqual(3, collection.Count()); Assert.AreEqual(1, collection[0]); Assert.AreEqual(2, collection[1]); Assert.AreEqual(3, collection[2]); }
public void CallEvents() { BaseCollection <int> collection = new BaseCollection <int>(); var setSubscriber = Substitute.For <IDummyEventSubscriber <IEnumerable <int> > >(); var addedSubscriber = Substitute.For <IDummyEventSubscriber <int> >(); var removedSubscriber = Substitute.For <IDummyEventSubscriber <int> >(); collection.OnSet += setSubscriber.React; collection.OnAdded += addedSubscriber.React; collection.OnRemoved += removedSubscriber.React; collection.Set(new [] { 1, 2, 3, 4 }); collection.Add(4); collection.Remove(2); collection.RemoveAt(0); setSubscriber.Received().React(collection.list); addedSubscriber.Received().React(4); removedSubscriber.Received().React(2); removedSubscriber.Received().React(1); }