예제 #1
0
        public void ObserverDoesNotNotifyAfterRestart()
        {
            var mockLogger   = new Mock <ILogger <MinerUpdateAvailableObserver> >();
            var mockListener = new Mock <IMinerLogListener>();

            var objectUnderTest =
                new MinerUpdateAvailableObserver(mockLogger.Object, mockListener.Object);

            objectUnderTest.ReceiveLogMessage(this, new LogMessage()
            {
                Message = "stuff New version of T-Rex is available"
            });
            objectUnderTest.HasUpdate.Should().Be(true, "we indicated an update was avialable");
            objectUnderTest.ReceiveLogMessage(this, new LogMessage()
            {
                Message = TrexMiner.STARTUP_LOG_MESSAGE
            });

            objectUnderTest.HasUpdate.Should().Be(false, "the miner has restarted so no update should be available");
        }
예제 #2
0
        public void ObserverDoesNotNotifyWhenNoUpdateAvailable()
        {
            var mockLogger   = new Mock <ILogger <MinerUpdateAvailableObserver> >();
            var mockListener = new Mock <IMinerLogListener>();

            var objectUnderTest =
                new MinerUpdateAvailableObserver(mockLogger.Object, mockListener.Object);

            objectUnderTest.ReceiveLogMessage(this, new LogMessage()
            {
                Message = "stuff"
            });

            objectUnderTest.HasUpdate.Should().Be(false, "no update is available");
        }
예제 #3
0
        public void ObserverNotifiesWhenUpdateAvailable()
        {
            var mockLogger   = new Mock <ILogger <MinerUpdateAvailableObserver> >();
            var mockListener = new Mock <IMinerLogListener>();

            var objectUnderTest =
                new MinerUpdateAvailableObserver(mockLogger.Object, mockListener.Object);

            objectUnderTest.ReceiveLogMessage(this, new LogMessage()
            {
                Message = "stuff New version of T-Rex is available"
            });

            objectUnderTest.HasUpdate.Should().Be(true, "we indicated an update was avialable");
        }