public void CannotInsertIntoBuilderAtWrongIndex() { TestCollectionBuilder builder = _composition.WithCollectionBuilder <TestCollectionBuilder>() .Append <Resolved1>() .Append <Resolved2>(); Assert.Throws <ArgumentOutOfRangeException>(() => builder.Insert <Resolved3>(99)); Assert.Throws <ArgumentOutOfRangeException>(() => builder.Insert <Resolved3>(-1)); }
public void CanInsertIntoEmptyBuilder() { TestCollectionBuilder builder = _composition.WithCollectionBuilder <TestCollectionBuilder>(); builder.Insert <Resolved2>(); IServiceProvider factory = _composition.CreateServiceProvider(); TestCollection col = builder.CreateCollection(factory); AssertCollection(col, typeof(Resolved2)); }
public void CannotInsertIntoBuilderOnceCollectionIsCreated() { TestCollectionBuilder builder = _composition.WithCollectionBuilder <TestCollectionBuilder>() .Append <Resolved1>() .Append <Resolved2>(); IServiceProvider factory = _composition.CreateServiceProvider(); TestCollection col = builder.CreateCollection(factory); Assert.Throws <InvalidOperationException>(() => builder.Insert <Resolved3>()); }