Beispiel #1
0
        public void CrashCountIsResetOnRestart()
        {
            var mockLogger   = new Mock <ILogger <CrashCountLogObserver> >();
            var mockListener = new Mock <IMinerLogListener>();

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

            const int crashCount = 3;

            objectUnderTest.ReceiveLogMessage(this, new LogMessage()
            {
                Message = "GPU CRASH LIST"
            });
            objectUnderTest.ReceiveLogMessage(this, new LogMessage()
            {
                Message = "WD: GPU#0: " + crashCount
            });
            objectUnderTest.ReceiveLogMessage(this, new LogMessage()
            {
                Message = TrexMiner.STARTUP_LOG_MESSAGE
            });

            objectUnderTest.CrashCount.Should().Be(0, "we faked restarting the miner");
        }
Beispiel #2
0
        public void CrashCountIsCounted()
        {
            var mockLogger   = new Mock <ILogger <CrashCountLogObserver> >();
            var mockListener = new Mock <IMinerLogListener>();

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

            const int crashCount = 3;

            objectUnderTest.ReceiveLogMessage(this, new LogMessage()
            {
                Message = "GPU CRASH LIST"
            });
            objectUnderTest.ReceiveLogMessage(this, new LogMessage()
            {
                Message = "WD: GPU#0: " + crashCount
            });
            objectUnderTest.ReceiveLogMessage(this, new LogMessage()
            {
                Message = "WD: GPU#0: " + crashCount
            });

            objectUnderTest.CrashCount.Should().Be(crashCount, "this is how many times we said we crashed");
        }
Beispiel #3
0
        public void CrashCountWithoutPrefixIsNotCounted()
        {
            var mockLogger   = new Mock <ILogger <CrashCountLogObserver> >();
            var mockListener = new Mock <IMinerLogListener>();

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

            const int crashCount = 3;

            objectUnderTest.ReceiveLogMessage(this, new LogMessage()
            {
                Message = "WD: GPU#0: " + crashCount
            });

            objectUnderTest.CrashCount.Should().Be(0, "the crash count prefix identifier was not sent");
        }