public void SetIndexer_OnContainerControlledCollection_ThrowsNotSupported() { // Arrange var container = ContainerFactory.New(); container.RegisterAll <IPlugin>(typeof(Plugin0), typeof(Plugin1), typeof(Plugin2)); var plugins = container.GetAllInstances <IPlugin>() as IList <IPlugin>; // Act Action action = () => plugins[0] = new Plugin0(); // Assert AssertThat.ThrowsWithExceptionMessageContains <NotSupportedException>(ReadOnlyMessage, action); }
public void SetIndexer_OnContainerControlledCollection_ThrowsNotSupported() { // Arrange var container = ContainerFactory.New(); container.RegisterCollection<IPlugin>(new[] { typeof(Plugin0), typeof(Plugin1), typeof(Plugin2) }); var plugins = container.GetAllInstances<IPlugin>() as IList<IPlugin>; // Act Action action = () => plugins[0] = new Plugin0(); // Assert AssertThat.ThrowsWithExceptionMessageContains<NotSupportedException>(ReadOnlyMessage, action); }