public void Test_Add_Multiple_Bindings_To_Collection_Throws_ArgumentNullException() { IBindingCollection collection = new BindingCollection(); Assert.Throws <ArgumentNullException>(() => { collection.AddRange(null); }); }
public static async Task Fill <T>(this BindingCollection <T> self, IEnumerable <T> items, int itemsPerIteration = 100) { self.AllItems = items; self.Clear(); if (itemsPerIteration == -1) { self.AddRange(items); } else { var groupCount = items.Count() / itemsPerIteration; for (int index = 0; index < groupCount; index++) { var part = items.Skip(index * itemsPerIteration).Take(itemsPerIteration); self.AddRange(part); await Task.Delay(1).ConfigureAwait(true); } } }
public void Test_Add_Multiple_Bindings_To_Collection() { IBinding <ISample> binding = from b in Bind <ISample>() select new Sample(); IBinding <ISample> otherSampleBinding = Bind <ISample>().Select(b => new Sample(new object())); IBinding <IHasSample> otherBinding = from b in Bind <IHasSample>() select new HasSample(Dependency(binding)); IBindingCollection collection = new BindingCollection(); collection.AddRange(new IBinding[] { binding, otherBinding, otherSampleBinding }); Assert.Equal(3, collection.BindingCount); }