Display Drive detection warning only for multiple drives (#7589)

* indexer drive detection helper code to not show the warning for a single drive

* removed interface from the namespace due to stylecop

* removed interfac which no longer exists

* filter out only fixed drives in the system and ignore the removable drives

* changed text to not all files are indexed, from not all drives are idnexed

* add additional info in the comment
This commit is contained in:
Alekhya
2020-10-29 10:38:15 -07:00
committed by GitHub
parent e30393e18f
commit fdffe20c0b
7 changed files with 54 additions and 12 deletions

View File

@@ -348,17 +348,21 @@ namespace Wox.Test.Plugins
Assert.AreEqual(Microsoft.Plugin.Indexer.Properties.Resources.Microsoft_plugin_indexer_open_in_console, contextMenuItems[1].Title);
}
[TestCase(0, false, ExpectedResult = true)]
[TestCase(0, true, ExpectedResult = false)]
[TestCase(1, false, ExpectedResult = false)]
[TestCase(1, true, ExpectedResult = false)]
public bool DriveDetectionMustDisplayWarningWhenEnhancedModeIsOffAndWhenWarningIsNotDisabled(int enhancedModeStatus, bool disableWarningCheckBoxStatus)
[TestCase(0, 2, false, ExpectedResult = true)]
[TestCase(0, 3, true, ExpectedResult = false)]
[TestCase(1, 2, false, ExpectedResult = false)]
[TestCase(1, 4, true, ExpectedResult = false)]
[TestCase(0, 1, false, ExpectedResult = false)]
public bool DriveDetectionMustDisplayWarningWhenEnhancedModeIsOffAndWhenWarningIsNotDisabled(int enhancedModeStatus, int driveCount, bool disableWarningCheckBoxStatus)
{
// Arrange
var mockRegistry = new Mock<IRegistryWrapper>();
mockRegistry.Setup(r => r.GetHKLMRegistryValue(It.IsAny<string>(), It.IsAny<string>())).Returns(enhancedModeStatus); // Enhanced mode is disabled
IndexerDriveDetection driveDetection = new IndexerDriveDetection(mockRegistry.Object);
var mockDriveInfo = new Mock<IDriveInfoWrapper>();
mockDriveInfo.Setup(d => d.GetDriveCount()).Returns(driveCount);
IndexerDriveDetection driveDetection = new IndexerDriveDetection(mockRegistry.Object, mockDriveInfo.Object);
driveDetection.IsDriveDetectionWarningCheckBoxSelected = disableWarningCheckBoxStatus;
// Act & Assert