public void DisposeDisposeCausingBarf() { DefaultPicoContainer pico = new DefaultPicoContainer(); pico.Start(); pico.Stop(); pico.Dispose(); try { pico.Dispose(); Assert.Fail("Should have barfed"); } catch (Exception) { // expected; } }
public void StartStopDisposeDisposeCausingBarf() { DefaultPicoContainer pico = new DefaultPicoContainer(); object o = pico.ComponentInstances; pico.Start(); pico.Stop(); pico.Dispose(); try { pico.Dispose(); Assert.Fail("Should have barfed"); } catch (Exception) { // expected; } }
public void OnlyStartableComponentsAreInstantiatedOnStart() { IMutablePicoContainer pico = new DefaultPicoContainer(); pico.RegisterComponentImplementation("recording", typeof(StringBuilder)); pico.RegisterComponentImplementation(typeof(A)); pico.RegisterComponentImplementation(typeof(NotStartable)); pico.Start(); pico.Stop(); pico.Dispose(); Assert.AreEqual("<AA>!A", pico.GetComponentInstance("recording").ToString()); }
public void OnlyStartableComponentsAreInstantiatedOnStart() { IMutablePicoContainer pico = new DefaultPicoContainer(); pico.RegisterComponentImplementation("recording", typeof (StringBuilder)); pico.RegisterComponentImplementation(typeof (A)); pico.RegisterComponentImplementation(typeof (NotStartable)); pico.Start(); pico.Stop(); pico.Dispose(); Assert.AreEqual("<AA>!A", pico.GetComponentInstance("recording").ToString()); }