Exemple #1
0
        public void TestProcessDumps_notDMPandlessthan1600_ExpectcalltoCorruptlogger()
        {   //Arrange
            fakeEmailService              fakeEmailService        = new fakeEmailService();
            FakeFileExtensionManager      theFakeFileExtensionMgr = new FakeFileExtensionManager();
            FakeCrashLoggingService       theFakeCrashLogger      = new FakeCrashLoggingService();
            FakeCorruptFileLoggingService thecorruptFile          = new FakeCorruptFileLoggingService();
            testableSystemMonitor         theSysMon = new testableSystemMonitor(theFakeFileExtensionMgr, theFakeCrashLogger, thecorruptFile, fakeEmailService);
            String expectedResult = "Dump file is corrupt: ";

            theFakeFileExtensionMgr.notdotdmp = true;//Setting to true means no dot dumpfile extension
            //Act
            theSysMon.ProcessDumps();
            //Assert
            Assert.AreEqual(thecorruptFile.lastCalledWithMessage, expectedResult);
            // assert against the FakeCrashLogger to check it was called properly.
        }
Exemple #2
0
        public void TestProcessDumps_ValidDumpFile_ExpectCallToCrashLoggerLogError()//Test for invalid file needed this only looks for valid file
        {
            //Arrange
            fakeEmailService              fakeEmailService        = new fakeEmailService();
            FakeFileExtensionManager      theFakeFileExtensionMgr = new FakeFileExtensionManager();
            FakeCrashLoggingService       theFakeCrashLogger      = new FakeCrashLoggingService();
            FakeCorruptFileLoggingService thecorruptFile          = new FakeCorruptFileLoggingService();
            testableSystemMonitor         theSysMon = new testableSystemMonitor(theFakeFileExtensionMgr, theFakeCrashLogger, thecorruptFile, fakeEmailService);
            String expectedResult = "Dump file is valid ";

            //Act
            theSysMon.ProcessDumps();
            //Assert
            Assert.AreEqual(theFakeCrashLogger.lastCalledWithMessage, expectedResult);
            // assert against the FakeCrashLogger to check it was called properly.
        }
Exemple #3
0
        public void TestProcessDumps_Invalidfile_ExpectcallToCorruptfileloggerLogCorruptionDetails()
        {
            //Arrange
            fakeEmailService fakeEmailService                     = new fakeEmailService();
            FakeCorruptFileLoggingService thecorruptFile          = new FakeCorruptFileLoggingService();
            FakeFileExtensionManager      theFakeFileExtensionMgr = new FakeFileExtensionManager();
            FakeCrashLoggingService       theFakeCrashLogger      = new FakeCrashLoggingService();
            testableSystemMonitor         theSysMon               = new testableSystemMonitor(theFakeFileExtensionMgr, theFakeCrashLogger, thecorruptFile, fakeEmailService);
            String expectedResult = "Dump file is corrupt: ";

            //Act
            //string[] result = theFakeFileExtensionMgr.scanAndReadDumpfileNames();
            theFakeFileExtensionMgr.notdotdmp   = true;
            theFakeFileExtensionMgr.notless1600 = true;
            theSysMon.ProcessDumps();
            //Assert
            Assert.AreEqual(thecorruptFile.lastCalledWithMessage, expectedResult);
            // assert against the FakeCrashLogger to check it was called properly.
        }
Exemple #4
0
        public void TestProcessDumps_ExceptionInCorruptFileLogger_Expectcalltosendemail()
        {
            //Arrange
            fakeEmailService fakeEmailService                     = new fakeEmailService();
            FakeCorruptFileLoggingService thecorruptFile          = new FakeCorruptFileLoggingService();
            FakeFileExtensionManager      theFakeFileExtensionMgr = new FakeFileExtensionManager();
            FakeCrashLoggingService       theFakeCrashLogger      = new FakeCrashLoggingService();
            testableSystemMonitor         theSysMon               = new testableSystemMonitor(theFakeFileExtensionMgr, theFakeCrashLogger, thecorruptFile, fakeEmailService);
            Boolean expectedResult = true;

            //Act
            //string[] result = theFakeFileExtensionMgr.scanAndReadDumpfileNames();
            theFakeFileExtensionMgr.notdotdmp           = true;
            theFakeFileExtensionMgr.notless1600         = true;
            thecorruptFile.FilestatusNotNormalException = true;
            theSysMon.ProcessDumps();
            //Assert
            Assert.AreEqual(fakeEmailService.emailsent, expectedResult);
            // assert against the FakeCrashLogger to check it was called properly.
        }
Exemple #5
0
        public void TestProcessDumps_ExceptionInCrashLoggerCalls_ExpectSendEmail()
        {
            //Arrange
            fakeEmailService fakeEmailService                     = new fakeEmailService();
            FakeCorruptFileLoggingService thecorruptFile          = new FakeCorruptFileLoggingService();
            FakeFileExtensionManager      theFakeFileExtensionMgr = new FakeFileExtensionManager();
            FakeCrashLoggingService       theFakeCrashLogger      = new FakeCrashLoggingService();
            testableSystemMonitor         theSysMon               = new testableSystemMonitor(theFakeFileExtensionMgr, theFakeCrashLogger, thecorruptFile, fakeEmailService);

            Boolean expectedResult = true;

            theFakeCrashLogger.primeExeption = true;


            //Act
            theSysMon.ProcessDumps();
            //Assert
            Assert.AreEqual(fakeEmailService.emailsent, expectedResult);
            // assert against the emailservice to check it was called properly.
        }