public void DefaultShutdownMethodTest() { _infoProviderMock.Setup(x => x.getShutdownMethod()).Returns(_shutdownMethodMock.Object); _shutdownMethodMock.SetupSet(x => x.VirtualMachineProxy = _machineProxyMock.Object).Verifiable(); ServiceAwareMachine m = new ServiceAwareMachine(_machineProxyMock.Object); m.ServiceInfoProvider = _infoProviderMock.Object; Assert.AreEqual(_shutdownMethodMock.Object, m.ShutdownMethod); _shutdownMethodMock.VerifyAll(); }
public void UserDefinedShutdownMethodTest() { _infoProviderMock.Setup(x => x.getShutdownMethod()).Returns(_shutdownMethodMock.Object); Mock <ShutdownMethod> userDefinedShutdownMethod = new Mock <ShutdownMethod>(); userDefinedShutdownMethod.SetupSet(x => x.VirtualMachineProxy = _machineProxyMock.Object).Verifiable(); userDefinedShutdownMethod.Protected().Setup <ProgressToken>("OnShutdownAsync"); ServiceAwareMachine m = new ServiceAwareMachine(_machineProxyMock.Object); m.ServiceInfoProvider = _infoProviderMock.Object; m.ShutdownMethod = userDefinedShutdownMethod.Object; m.ShutdownAsync(); Assert.AreEqual(userDefinedShutdownMethod.Object, m.ShutdownMethod); userDefinedShutdownMethod.VerifyAll(); }