Created
October 25, 2019 08:08
-
-
Save Meertman/ef6461c2adee967117f6500811bbe697 to your computer and use it in GitHub Desktop.
Cake issue related to retrieval of relative current directory.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using Cake.Core.IO; | |
using NUnit.Framework; | |
namespace CakeIssues | |
{ | |
[TestFixture(arguments: "./")] | |
[TestFixture(arguments: @".\")] | |
public class WhenRetrievingDirectory | |
{ | |
private readonly string _directoryToRetrieve; | |
private FileSystem _fileSystem; | |
public WhenRetrievingDirectory(string directoryToRetrieve) | |
{ | |
_directoryToRetrieve = directoryToRetrieve; | |
} | |
[SetUp] | |
public void Setup() | |
{ | |
_fileSystem = new FileSystem(); | |
} | |
[Test] | |
public void ThrowsException() | |
{ | |
Assert.That(WhenRetrieving, Throws.Exception); | |
} | |
[Test] | |
public void ThrowsArgumentException() | |
{ | |
Assert.That(WhenRetrieving, Throws.ArgumentException); | |
} | |
[Test] | |
public void ThrowsArgumentExceptionWithMessagePathIsNotOfLegalForm() | |
{ | |
var argumentException = Assert.Throws<ArgumentException>(WhenRetrieving); | |
Assert.That(argumentException.Message, Is.EqualTo("The path is not of a legal form.")); | |
} | |
private void WhenRetrieving() | |
{ | |
_fileSystem.GetDirectory(_directoryToRetrieve); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment