//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void testFailingShutdown() throws LifecycleException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: internal virtual void TestFailingShutdown() { LifeSupport lifeSupport = NewLifeSupport(); LifecycleMock instance1 = new LifecycleMock(null, null, null, null); lifeSupport.Add(instance1); Exception shutdownThrowable = new Exception(); LifecycleMock instance2 = new LifecycleMock(null, null, null, shutdownThrowable); lifeSupport.Add(instance2); LifecycleMock instance3 = new LifecycleMock(null, null, null, null); lifeSupport.Add(instance3); lifeSupport.Start(); try { lifeSupport.Shutdown(); fail("Failure was expected"); } catch (LifecycleException throwable) { assertEquals(shutdownThrowable, throwable.InnerException); } assertEquals(LifecycleStatus.Shutdown, lifeSupport.Status); assertEquals(LifecycleStatus.Shutdown, instance1.Status); assertEquals(LifecycleStatus.Shutdown, instance2.Status); assertEquals(LifecycleStatus.Shutdown, instance3.Status); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void testFailingStartAndFailingStop() internal virtual void TestFailingStartAndFailingStop() { LifeSupport lifeSupport = NewLifeSupport(); Exception stopThrowable = new Exception(); LifecycleMock instance1 = new LifecycleMock(null, null, stopThrowable, null); lifeSupport.Add(instance1); Exception startThrowable = new Exception(); LifecycleMock instance2 = new LifecycleMock(null, startThrowable, null, null); lifeSupport.Add(instance2); LifecycleMock instance3 = new LifecycleMock(null, null, null, null); lifeSupport.Add(instance3); try { lifeSupport.Start(); fail("Failure was expected"); } catch (LifecycleException throwable) { assertEquals(startThrowable, throwable.InnerException); assertEquals(1, throwable.Suppressed.length); assertThat(throwable.Suppressed[0], instanceOf(typeof(LifecycleException))); assertEquals(stopThrowable, throwable.Suppressed[0].Cause); } assertEquals(LifecycleStatus.Stopped, lifeSupport.Status); assertEquals(LifecycleStatus.Stopped, instance1.Status); assertEquals(LifecycleStatus.Stopped, instance2.Status); assertEquals(LifecycleStatus.Stopped, instance3.Status); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void testAddInstanceWhenInitInitsInstance() throws LifecycleException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: internal virtual void TestAddInstanceWhenInitInitsInstance() { LifeSupport support = NewLifeSupport(); support.Init(); LifecycleMock instance1 = new LifecycleMock(null, null, null, null); support.Add(instance1); assertEquals(LifecycleStatus.Stopped, instance1.Status); assertEquals(LifecycleStatus.None, instance1.Transitions[0]); assertEquals(2, instance1.Transitions.Count); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void testAddInstanceWhenShutdownDoesNotAffectInstance() throws LifecycleException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: internal virtual void TestAddInstanceWhenShutdownDoesNotAffectInstance() { LifeSupport support = NewLifeSupport(); support.Init(); support.Start(); support.Stop(); support.Shutdown(); LifecycleMock instance1 = new LifecycleMock(null, null, null, null); support.Add(instance1); assertEquals(LifecycleStatus.None, instance1.Status); assertEquals(1, instance1.Transitions.Count); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void testOkLifecycle() throws LifecycleException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: internal virtual void TestOkLifecycle() { LifeSupport lifeSupport = NewLifeSupport(); LifecycleMock instance1 = new LifecycleMock(null, null, null, null); lifeSupport.Add(instance1); LifecycleMock instance2 = new LifecycleMock(null, null, null, null); lifeSupport.Add(instance2); LifecycleMock instance3 = new LifecycleMock(null, null, null, null); lifeSupport.Add(instance3); lifeSupport.Init(); assertEquals(LifecycleStatus.Stopped, lifeSupport.Status); assertEquals(LifecycleStatus.Stopped, instance1.Status); assertEquals(LifecycleStatus.Stopped, instance2.Status); assertEquals(LifecycleStatus.Stopped, instance3.Status); lifeSupport.Start(); assertEquals(LifecycleStatus.Started, lifeSupport.Status); assertEquals(LifecycleStatus.Started, instance1.Status); assertEquals(LifecycleStatus.Started, instance2.Status); assertEquals(LifecycleStatus.Started, instance3.Status); lifeSupport.Stop(); assertEquals(LifecycleStatus.Stopped, lifeSupport.Status); assertEquals(LifecycleStatus.Stopped, instance1.Status); assertEquals(LifecycleStatus.Stopped, instance2.Status); assertEquals(LifecycleStatus.Stopped, instance3.Status); lifeSupport.Start(); assertEquals(LifecycleStatus.Started, lifeSupport.Status); assertEquals(LifecycleStatus.Started, instance1.Status); assertEquals(LifecycleStatus.Started, instance2.Status); assertEquals(LifecycleStatus.Started, instance3.Status); lifeSupport.Shutdown(); assertEquals(LifecycleStatus.Shutdown, lifeSupport.Status); assertEquals(LifecycleStatus.Shutdown, instance1.Status); assertEquals(LifecycleStatus.Shutdown, instance2.Status); assertEquals(LifecycleStatus.Shutdown, instance3.Status); }