public void CannotClearBuilderOnceCollectionIsCreated() { TestCollectionBuilder builder = _composition.WithCollectionBuilder <TestCollectionBuilder>() .Append <Resolved1>() .Append <Resolved2>(); IServiceProvider factory = _composition.CreateServiceProvider(); TestCollection col = builder.CreateCollection(factory); Assert.Throws <InvalidOperationException>(() => builder.Clear()); }
public void CanClearBuilderBeforeCollectionIsCreated() { TestCollectionBuilder builder = _composition.WithCollectionBuilder <TestCollectionBuilder>() .Append <Resolved1>() .Append <Resolved2>(); builder.Clear(); Assert.IsFalse(builder.Has <Resolved1>()); Assert.IsFalse(builder.Has <Resolved2>()); IServiceProvider factory = _composition.CreateServiceProvider(); TestCollection col = builder.CreateCollection(factory); AssertCollection(col); }