コード例 #1
0
        public void TestUninstallResolverSimpleFail()
        {
            // Act
            Exception exception = null;

            try
            {
                var result = UninstallResolver.GetPackagesToBeUninstalled(E1,
                                                                          PackageDependencyInfo1,
                                                                          InstalledPackages1,
                                                                          new UninstallationContext(removeDependencies: true)).ToList();
            }
            catch (InvalidOperationException ex)
            {
                exception = ex;
            }
            catch (AggregateException ex)
            {
                exception = ExceptionUtility.Unwrap(ex);
            }

            // Assert
            Assert.NotNull(exception);
            Assert.True(exception is InvalidOperationException);
            Assert.Equal("Unable to uninstall 'E.1.0.0' because 'C.1.0.0' depends on it.",
                         exception.Message);
        }
コード例 #2
0
        public void DiamondDependencyUninstall()
        {
            // Act
            var result = UninstallResolver.GetPackagesToBeUninstalled(A1,
                                                                      DiamondDependencyInfo,
                                                                      DiamondDependencyInstalledPackages,
                                                                      new UninstallationContext(removeDependencies: true)).ToList();

            // Assert
            Assert.Equal(4, result.Count);
            Assert.True(result[0].Equals(A1));
            Assert.True(result[1].Equals(B1));
            Assert.True(result[2].Equals(C1));
            Assert.True(result[3].Equals(D1));
        }
コード例 #3
0
        public void TestUninstallResolverSimplePass()
        {
            // Act
            var result = UninstallResolver.GetPackagesToBeUninstalled(A1,
                                                                      PackageDependencyInfo1,
                                                                      InstalledPackages1,
                                                                      new UninstallationContext(removeDependencies: true)).ToList();

            // Assert
            Assert.Equal(5, result.Count);
            Assert.True(result[0].Equals(A1));
            Assert.True(result[1].Equals(B1));
            Assert.True(result[2].Equals(C1));
            Assert.True(result[3].Equals(D1));
            Assert.True(result[4].Equals(E1));
        }