public void GetDumpFileWillThrowExceptionIfNoDumpfile() { var process = "process"; var processId = 12345; var testResultsDirectory = "D:\\TestResults"; this.mockFileHelper.Setup(x => x.GetFiles(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <SearchOption>())) .Returns(new string[] { }); this.mockProcessHelper.Setup(x => x.GetProcessName(processId)) .Returns(process); this.mockHangDumperFactory.Setup(x => x.Create(It.IsAny <string>())) .Returns(new Mock <IHangDumper>().Object); this.mockCrashDumperFactory.Setup(x => x.Create(It.IsAny <string>())) .Returns(new Mock <ICrashDumper>().Object); var processDumpUtility = new ProcessDumpUtility( this.mockProcessHelper.Object, this.mockFileHelper.Object, this.mockHangDumperFactory.Object, this.mockCrashDumperFactory.Object); processDumpUtility.StartTriggerBasedProcessDump(processId, testResultsDirectory, false, ".NETCoreApp,Version=v5.0"); var ex = Assert.ThrowsException <FileNotFoundException>(() => processDumpUtility.GetDumpFiles()); Assert.AreEqual(ex.Message, Resources.Resources.DumpFileNotGeneratedErrorMessage); }