public void RemovePackageDoesNotRemovesRootIfNotEmpty() { // Arrange var mockFileSystem = new MockProjectSystem(); mockFileSystem.AddFile(@"A.1.0\A.1.0.nupkg"); mockFileSystem.AddFile(@"B.1.0\B.1.0.nupkg"); var repository = new LocalPackageRepository(new DefaultPackagePathResolver(mockFileSystem), mockFileSystem); IPackage package = PackageUtility.CreatePackage("A", "1.0"); // Act repository.RemovePackage(package); // Assert Assert.Equal(2, mockFileSystem.Deleted.Count); Assert.True(mockFileSystem.Deleted.Contains("A.1.0")); Assert.True(mockFileSystem.Deleted.Contains(@"A.1.0\A.1.0.nupkg")); }
public void RemovePackageRemovesPackageFileAndDirectoryAndRoot() { // Arrange var mockFileSystem = new MockProjectSystem(); mockFileSystem.AddFile(PathFixUtility.FixPath(@"A.1.0\A.1.0.nupkg")); var repository = new LocalPackageRepository(new DefaultPackagePathResolver(mockFileSystem), mockFileSystem); IPackage package = PackageUtility.CreatePackage("A", "1.0"); // Act repository.RemovePackage(package); // Assert Assert.Equal(3, mockFileSystem.Deleted.Count); Assert.True(mockFileSystem.Deleted.Contains("")); Assert.True(mockFileSystem.Deleted.Contains("A.1.0")); Assert.True(mockFileSystem.Deleted.Contains(PathFixUtility.FixPath(@"A.1.0\A.1.0.nupkg"))); }
public void RemovePackageDoesNotRemovesRootIfNotEmpty() { // Arrange var mockFileSystem = new MockProjectSystem(); mockFileSystem.AddFile(PathFixUtility.FixPath(@"A.1.0\A.1.0.nupkg")); mockFileSystem.AddFile(PathFixUtility.FixPath(@"B.1.0\B.1.0.nupkg")); var repository = new LocalPackageRepository(new DefaultPackagePathResolver(mockFileSystem), mockFileSystem); IPackage package = PackageUtility.CreatePackage("A", "1.0"); // Act repository.RemovePackage(package); // Assert Assert.Equal(2, mockFileSystem.Deleted.Count); Assert.True(mockFileSystem.Deleted.Contains(Path.Combine(mockFileSystem.Root, @"A.1.0"))); Assert.True(mockFileSystem.Deleted.Contains(Path.Combine(mockFileSystem.Root, PathFixUtility.FixPath(@"A.1.0\A.1.0.nupkg")))); }
public void RemovePackageRemovesPackageFileAndDirectoryAndRoot() { // Arrange var mockFileSystem = new MockProjectSystem(); mockFileSystem.AddFile(@"A.1.0\A.1.0.nupkg"); var repository = new LocalPackageRepository(new DefaultPackagePathResolver(mockFileSystem), mockFileSystem); IPackage package = PackageUtility.CreatePackage("A", "1.0"); // Act repository.RemovePackage(package); // Assert Assert.Equal(3, mockFileSystem.Deleted.Count); Assert.True(mockFileSystem.Deleted.Contains("")); Assert.True(mockFileSystem.Deleted.Contains("A.1.0")); Assert.True(mockFileSystem.Deleted.Contains(@"A.1.0\A.1.0.nupkg")); }