public void CanCleanPackageFolders() { var mfs = new MockFileSystem(); mfs.CreateDirectory("c:\\packages\\Component"); mfs.AddFile("c:\\packages\\Component\\test.txt", "blah"); mfs.AddFile("c:\\packages\\Component\\test.dll","blah"); mfs.AddFile("c:\\packages\\repositories.config","blah"); var re = new Mock<IRepositoryEnumerator>(); re.Setup(r => r.GetPackageReferenceFiles(It.IsAny<FileInfo>())).Returns(new List<PackageReferenceFile>()); var repositoryManager = new RepositoryManager(@"c:\packages\repositories.config", re.Object, mfs); Assert.AreEqual(1, mfs.GetDirectories(repositoryManager.RepositoryConfig.Directory.FullName).Count()); //_repositoryManager.CleanPackageFolders(); Assert.AreEqual(0, mfs.GetDirectories(repositoryManager.RepositoryConfig.Directory.FullName).Count()); }
public void ConstructParser() { var mfs = new MockFileSystem(); var correctConfig = @"<?xml version='1.0' encoding='utf-8'?> <repositories> <repository path='..\Project1\packages.config' /> <repository path='..\Project2\packages.config' /> <repository path='..\Project3\packages.config' /> </repositories>"; mfs.AddFile(@"c:\packages\repositories.config", correctConfig); mfs.AddFile(@"c:\project1\packages.config", correctConfig); mfs.AddFile(@"c:\project2\packages.config", correctConfig); mfs.AddFile(@"c:\project3\packages.config", correctConfig); mfs.AddFile(@"c:\packages\repositories.config", correctConfig); var repositoryManager = new RepositoryManager(@"c:\packages\repositories.config", new RepositoryEnumerator(mfs), mfs); Assert.IsNotNull(repositoryManager); Assert.AreEqual(3, repositoryManager.PackageReferenceFiles.Count()); }