public async Task ExtensionWithDot() { // Given TestDocument input = new TestDocument(new NormalizedPath("Subfolder/write-test.abc")); SetDestination setDestination = new SetDestination(".txt"); // When TestDocument result = await ExecuteAsync(input, setDestination).SingleAsync(); // Then result.Destination.FullPath.ShouldBe("Subfolder/write-test.txt"); }
public async Task SetsDestinationUsingPath(string path, string expected) { // Given TestDocument input = new TestDocument(new NormalizedPath("Subfolder/write-test.abc")); SetDestination setDestination = new SetDestination(path); // When TestDocument result = await ExecuteAsync(input, setDestination).SingleAsync(); // Then result.Destination.FullPath.ShouldBe(expected); }
public async Task ShouldWriteDotFile() { // Given TestDocument input = new TestDocument(); SetDestination setDestination = new SetDestination((NormalizedPath)".dotfile"); // When TestDocument result = await ExecuteAsync(input, setDestination).SingleAsync(); // Then result.Destination.FullPath.ShouldBe(".dotfile"); }
public async Task SetsDestinationUsingExtension(string extension, string expected) { // Given TestDocument input = new TestDocument(new FilePath("Subfolder/write-test.abc")); SetDestination setDestination = new SetDestination(extension); // When TestDocument result = await ExecuteAsync(input, setDestination).SingleAsync(); // Then result.Destination.ShouldBe(expected); }
public async Task SetsDestinationFromStringDelegate() { // Given TestDocument input = new TestDocument(new NormalizedPath("Subfolder/write-test.abc")); SetDestination setDestination = new SetDestination("foo/bar.txt"); // When TestDocument result = await ExecuteAsync(input, setDestination).SingleAsync(); // Then result.Destination.FullPath.ShouldBe("foo/bar.txt"); }
public async Task ExtensionWithoutDotWritesFiles() { // Given TestDocument input = new TestDocument(new FilePath("Subfolder/write-test.abc")); SetDestination setDestination = new SetDestination("txt"); // When TestDocument result = await ExecuteAsync(input, setDestination).SingleAsync(); // Then result.Destination.ShouldBe("Subfolder/write-test.txt"); }
public async Task SetsDestinationFromDocumentDelegate() { // Given TestDocument input = new TestDocument(new NormalizedPath("Subfolder/write-test.abc")); SetDestination setDestination = new SetDestination( Config.FromDocument(doc => doc.Destination.ChangeExtension(".bar"))); // When TestDocument result = await ExecuteAsync(input, setDestination).SingleAsync(); // Then result.Destination.FullPath.ShouldBe("Subfolder/write-test.bar"); }
public async Task SetsDestinationFromMetadataOverridesExtension(string key, string value, string expected) { // Given TestDocument input = new TestDocument(new NormalizedPath("Subfolder/write-test.abc")) { { key, value } }; SetDestination setDestination = new SetDestination(".txt"); // When TestDocument result = await ExecuteAsync(input, setDestination).SingleAsync(); // Then result.Destination.FullPath.ShouldBe(expected); }
public async Task SetsDestinationFromMetadataWhenNullDestination(string key, string value, string expected) { // Given TestDocument input = new TestDocument() { { key, value } }; SetDestination setDestination = new SetDestination(); // When TestDocument result = await ExecuteAsync(input, setDestination).SingleAsync(); // Then result.Destination.FullPath.ShouldBe(expected); }
public async Task SetsDestinationFromMetadata(string key, string value, string expected) { // Given TestDocument input = new TestDocument(new FilePath("Subfolder/write-test.abc")) { { key, value } }; SetDestination setDestination = new SetDestination(); // When TestDocument result = await ExecuteAsync(input, setDestination).SingleAsync(); // Then result.Destination.ShouldBe(expected); }
public async Task SetsDestinationFromDelegateDoesNotOverrideMetadata(string key, string value, string expected) { // Given TestDocument input = new TestDocument(new NormalizedPath("Subfolder/write-test.abc")) { { key, value } }; SetDestination setDestination = new SetDestination( Config.FromDocument(doc => doc.Destination.ChangeExtension(".bar"))); // When TestDocument result = await ExecuteAsync(input, setDestination).SingleAsync(); // Then result.Destination.FullPath.ShouldBe(expected); }
public async Task SetsDestinationFromDelegateOverridesMetadata(string key) { // Given TestDocument input = new TestDocument(new FilePath("Subfolder/write-test.abc")) { { key, "foo" } }; SetDestination setDestination = new SetDestination( Config.FromDocument(doc => doc.Destination.ChangeExtension(".bar"))); // When TestDocument result = await ExecuteAsync(input, setDestination).SingleAsync(); // Then result.Destination.ShouldBe("Subfolder/write-test.bar"); }