public void TestDependencyChecker() { var installation = MockInstallation.GetInstallation(); var noConflictingVersions = MockInstallation.GetConflictingFiles(); // GetConflictingFiles has conflicting files, but no conflicting versions, so this should return None. var issue = DependencyChecker.CheckDependencies(installation, noConflictingVersions); Assert.AreEqual(DependencyChecker.Issue.None, issue); // Conflicting has no conflicting files, but conflicting versions, so this should return BrokenPackages. var conflictingVersion = MockInstallation.GetConflictingVersion(); issue = DependencyChecker.CheckDependencies(installation, conflictingVersion); Assert.AreEqual(DependencyChecker.Issue.BrokenPackages, issue); }
public void TestOverwritePackageDetection() { var success = PackageInstallAction.InstallationQuestion.Success; var overwrite = PackageInstallAction.InstallationQuestion.OverwriteFile; // Conflict PackageInstallAction.InstallationQuestion conflict = PackageInstallAction.CheckForOverwrittenPackages(MockInstallation.GetInstallation(), MockInstallation.GetConflictingFiles(), false); Assert.AreNotEqual(success, conflict); // Conflict + --force var conflictForced = PackageInstallAction.CheckForOverwrittenPackages(MockInstallation.GetInstallation(), MockInstallation.GetConflictingFiles(), true); Assert.AreEqual(overwrite, conflictForced); // No conflict var noConflict = PackageInstallAction.CheckForOverwrittenPackages(MockInstallation.GetInstallation(), MockInstallation.TestNonConflicting(), false); Assert.AreEqual(success, noConflict); // Conflicting capitalization between files "package/a/test" vs "Package/A/test". If forced this will work differently based on platform. var conflictCapitalization = PackageInstallAction.CheckForOverwrittenPackages(MockInstallation.GetInstallation(), MockInstallation.TestConflictingCapitalization(), false); Assert.AreNotEqual(success, conflictCapitalization); // Conflict but the file is inside Dependencies, so its ok. var dependenciesConflict = PackageInstallAction.CheckForOverwrittenPackages(MockInstallation.GetInstallation(), MockInstallation.GetConflictingFilesInDependencies(), false); Assert.AreEqual(success, dependenciesConflict); }