public void Constructor() { ManagerMock test = ManagerMock.Instantiate(applicationManagerMock.Object); Assert.Equal(true, test.CheckDependency()); Assert.Throws <DependencyNotResolvedException>(() => test.CheckBadDependency()); test.Dispose(); }
public void StartWithStoppedDependency() { Mock <IApplicationManager> a = new Mock <IApplicationManager>(); a.Setup(m => m.State).Returns(State.Stopped); ManagerMock test = ManagerMock.Instantiate(a.Object); // start the manager and assert that it is running IResult start = test.Start(); Assert.Equal(ResultCode.Failure, start.ResultCode); }
public void Start() { ManagerMock test = ManagerMock.Instantiate(applicationManagerMock.Object); // start the manager and assert that it is running IResult start = test.Start(); Assert.Equal(State.Running, test.State); // try to start again and assert that the operation fails IResult startAgain = test.Start(); Assert.Equal(ResultCode.Failure, startAgain.ResultCode); }
public void Restart() { ManagerMock test = ManagerMock.Instantiate(applicationManagerMock.Object); // start the manager and assert that it is running test.Start(); Assert.Equal(State.Running, test.State); // restart the manager and assert that the operation succeeded IResult restart = test.Restart(); Assert.Equal(ResultCode.Success, restart.ResultCode); Assert.Equal(State.Running, test.State); }
public void StateProperty() { ManagerMock test = ManagerMock.Instantiate(applicationManagerMock.Object); Assert.Equal(State.Initialized, test.State); }
public void ManagerName() { ManagerMock test = ManagerMock.Instantiate(applicationManagerMock.Object); Assert.Equal("Mock Manager", test.ManagerName); }
public void EventProviderName() { ManagerMock test = ManagerMock.Instantiate(applicationManagerMock.Object); Assert.Equal(test.GetType().Name, test.EventProviderName); }
public void AutomaticRestartPending() { ManagerMock test = ManagerMock.Instantiate(applicationManagerMock.Object); Assert.Equal(false, test.AutomaticRestartPending); }
/// <summary> /// Instantiates and returns the Manager. /// </summary> /// <param name="manager">The ApplicationManager dependency.</param> /// <returns>The instantiated Manager.</returns> public static ManagerMock Instantiate(IApplicationManager manager) { // remove the code that makes this a singleton so that test runners can get a fresh instance each time. instance = new ManagerMock(manager); return(instance); }