nunit/nunit-framework — pull request #179 by rprouse (2014-08-11 16:09:35+00:00)
Title: Added DirectoryExistsConstraint

This completes the work for issue #111 and all of the planned changes in https://github.com/nunit/dev/wiki/File-Directory-and-Path-Assertions

I added unit tests to show that `Assert.AreEqual()` or `Assert.That(..., Is.EqualTo())` with `DirectoryInfo` arguments works. Unit tests were also added for the `EmptyDirectoryConstraint`.

When I added the `Exists` to the `Assert.That` syntax, I realized that it does not take an expected, so there is no way to specify what the argument type is. Therefore I did not know if I was looking at a file or directory. To handle this, I merged the `DirectoryExistsConstraint` and the `FileExistsConstraint`.

To maintain the behavior of the `FileAssert` class, I added a bool property and constructor to the new `ExistsConstraint` class that forced it to only work with files when called from `FileAssert`.

I also added a new `Does` helper class so that we can say `Assert.That(fileOrDir, Does.Exist)` and `Assert.That(fileOrDir, Does.Not.Exist)`

You can now write asserts like the following

```C#
Assert.That(fileStr, Does.Exist);
Assert.That(dirStr, Does.Exist);
Assert.That(fileStr, Does.Not.Exist);
Assert.That(new FileInfo(fileStr), Does.Exist);
Assert.That(new DirectoryInfo(dirStr), Does.Exist);
Assert.That(new DirectoryInfo(actual), Is.EqualTo(expected));

FileAssert.Exists(fileStr);
FileAssert.Exists(new FileInfo(fileStr));
FileAssert.DoesNotExist(fileStr);
FileAssert.DoesNotExist(new FileInfo(fileStr));

Assert.That(new DirectoryInfo(actual), Is.Empty);
Assert.That(new DirectoryInfo(actual), Is.Not.Empty);
```