Skip to content

Instantly share code, notes, and snippets.

@Meertman
Created October 25, 2019 08:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Meertman/ef6461c2adee967117f6500811bbe697 to your computer and use it in GitHub Desktop.
Save Meertman/ef6461c2adee967117f6500811bbe697 to your computer and use it in GitHub Desktop.
Cake issue related to retrieval of relative current directory.
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