Guest User

Untitled

a guest
Oct 23rd, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. [Test]
  2. public void EmptyConstraint()
  3. {
  4. //EmptyConstraint tests that an object is an empty string,
  5. //directory or collection.
  6.  
  7. //Syntax: Is.Empty
  8. string aString = String.Empty;
  9. Assert.That(aString, Is.Empty);
  10. string path = Environment.CurrentDirectory;
  11. DirectoryInfo dirInfo = new DirectoryInfo(path + @"\test");
  12. Assert.That(dirInfo, Is.Empty);
  13.  
  14. int[] collection = new int[] { };
  15. Assert.That(collection, Is.Empty);
  16.  
  17.  
  18. //Notes:
  19. ///EmptyConstraint creates and uses either an EmptyStringConstraint,
  20. ///EmptyDirectoryConstraint or EmptyCollectionConstraint depending
  21. ///on the argument tested.
  22. ///A DirectoryInfo argument is required in order to test for an
  23. ///empty directory.To test whether a string represents a directory
  24. ///path, you must first construct a DirectoryInfo.
  25. }
Add Comment
Please, Sign In to add comment