public void GetStreamReturnsCorrectContentWhenNupkgFileIsNestedInsidePackageFolder() { // Arrange var fileSystem = new MockFileSystem(); fileSystem.CreateDirectory("A.1.0.0"); fileSystem.AddFile("A.1.0.0\\A.1.0.0.nupkg", "aaa"); fileSystem.AddFile( "A.1.0.0\\A.1.0.0.nuspec", CreatePackageManifestContent("A", "1.0.0")); var package = new UnzippedPackage(fileSystem, "A.1.0.0"); // Act Stream stream = package.GetStream(); // Assert Assert.NotNull(stream); string content = stream.ReadToEnd(); Assert.Equal("aaa", content); }
public void CanCleanPackageFolders(string repositoryConfig) { var repositoryGroupManager = new RepositoryGroupManager(repositoryConfig, _mfs); foreach (var repositoryManager in repositoryGroupManager.RepositoryManagers) { if (repositoryManager.RepositoryConfig.Directory != null) { _mfs.CreateDirectory(Path.Combine(repositoryManager.RepositoryConfig.Directory.Name, "Test")); } } //repositoryGroupManager.CleanPackageFolders(); foreach (var repositoryManager in repositoryGroupManager.RepositoryManagers) { if (repositoryManager.RepositoryConfig.Directory != null) { Assert.AreEqual(0, _mfs.GetDirectories(repositoryManager.RepositoryConfig.Directory.Name).Count()); } } }
public async Task Write_image_files() { _fs.CreateDirectory("wwwroot/images/posts/the-post"); _fs.WriteFile("wwwroot/images/posts/the-post/a.png"); _fs.WriteFile("wwwroot/images/posts/the-post/b.png"); _fs.log.Clear(); var images = new[] { new Image("a.png", "the-post", new byte[] { 1, 2, 3 }), new Image("b.png", "the-post", new byte[] { 4, 5 }) }; var imageCollection = new ImageCollection(images, null, "the-post"); await _ctx.AddOrUpdateAsync(imageCollection); _fs.log.Should() .BeEquivalentTo(new[] { "write-file wwwroot/images/posts/the-post/a.png 1,2,3", "write-file wwwroot/images/posts/the-post/b.png 4,5" }, cfg => cfg.WithStrictOrdering()); }
void AndGivenAndOldVersionDirectoryExistsButIsEmpty() { _fileSystem.CreateDirectory(OldDir); }
public static void CreateSFMDirectory(MockFileSystem fs) { fs.CreateDirectory("C:\\"); fs.CreateDirectory("C:\\SFM"); }