Example #1
0
        public void Shutdown()
        {
            ManagerMockBadShutdown bad = ManagerMockBadShutdown.Instantiate(applicationManagerMock.Object);

            bad.Start();
            Assert.Equal(State.Running, bad.State);

            Assert.Throws <ManagerStopException>(() => bad.Stop());

            ManagerMockFailingShutdown fail = ManagerMockFailingShutdown.Instantiate(applicationManagerMock.Object);

            fail.Start();
            Assert.Equal(State.Running, fail.State);

            IResult result = fail.Stop();

            Assert.Equal(ResultCode.Failure, result.ResultCode);
        }
Example #2
0
 /// <summary>
 ///     Instantiates the Manager.
 /// </summary>
 /// <param name="manager">The ApplicationManager dependency.</param>
 /// <returns>The instantiated Manager.</returns>
 public static ManagerMockBadShutdown Instantiate(IApplicationManager manager)
 {
     // remove the code that makes this a singleton so that test runners can get a fresh instance each time.
     instance = new ManagerMockBadShutdown(manager);
     return(instance);
 }