diff --git a/SafeExamBrowser.Communication.UnitTests/Proxies/BaseProxyTests.cs b/SafeExamBrowser.Communication.UnitTests/Proxies/BaseProxyTests.cs index 9fab7b3d..9515b6b1 100644 --- a/SafeExamBrowser.Communication.UnitTests/Proxies/BaseProxyTests.cs +++ b/SafeExamBrowser.Communication.UnitTests/Proxies/BaseProxyTests.cs @@ -361,5 +361,27 @@ namespace SafeExamBrowser.Communication.UnitTests.Proxies Assert.IsTrue(lost); } + + [TestMethod] + public void MustLogStatusChanges() + { + var proxy = new Mock(); + var connectionLost = false; + + proxyObjectFactory.Setup(f => f.CreateObject(It.IsAny())).Returns(proxy.Object); + sut.ConnectionLost += () => connectionLost = true; + sut.Connect(Guid.Empty); + + proxy.Raise(p => p.Closed += null, It.IsAny()); + proxy.Raise(p => p.Closing += null, It.IsAny()); + proxy.Raise(p => p.Faulted += null, It.IsAny()); + proxy.Raise(p => p.Opened += null, It.IsAny()); + proxy.Raise(p => p.Opening += null, It.IsAny()); + + logger.Verify(l => l.Debug(It.IsAny()), Times.AtLeast(4)); + logger.Verify(l => l.Warn(It.IsAny()), Times.AtLeastOnce); + + Assert.IsTrue(connectionLost); + } } }