public void CameraComponentTerminateTest() { CameraComponent target = new CameraComponent(); PrivateObject obj = new PrivateObject(target); Mock <ILogger> loggerMock = new Mock <ILogger>(); Mock <IExecutableContext> execContextMock = new Mock <IExecutableContext>(); Mock <IMessageRouter> msgRouterMock = new Mock <IMessageRouter>(); execContextMock.Setup(f => f.MessageRouter).Returns(msgRouterMock.Object); obj.SetFieldOrProperty("mLogger", loggerMock.Object); obj.SetFieldOrProperty("mContext", execContextMock.Object); obj.SetFieldOrProperty("mName", "TESTNAME"); target.Terminate(); loggerMock.Verify(f => f.Terminate(), Times.Once()); msgRouterMock.Verify(f => f.DeregisterTopic("TESTNAME", target), Times.Once()); }