Share via


2008 Advent Calendar December 18th

 

   1:      public class Advent18
   2:      {
   3:          private FileUtilWithDelete SetUp(string content, bool readable)
   4:          {
   5:              FileUtilWithDelete file = new FileUtilWithDelete("SomeFile.txt");
   6:              file.Create(content);
   7:              file.Readable = readable;
   8:              return file;
   9:          }
  10:   
  11:          [Fact]
  12:          public void ReadingAReadableFileReturnsFileContent()
  13:          {
  14:              using (FileUtilWithDelete file = SetUp("CONTENT", true))
  15:              {
  16:                  string content = file.Read();
  17:                  Assert.Equal<string>("CONTENT", content);
  18:              }
  19:          }
  20:   
  21:          [Fact]
  22:          public void ReadingAnUnreadableFileThrowsCorrectException()
  23:          {
  24:              using (FileUtilWithDelete file = SetUp("SHOULD NOT BE ABLE TO READ THIS", false))
  25:              {
  26:                  Assert.Throws<AccessViolationException>(() => { file.Read(); });
  27:              }
  28:          }
  29:      }

Now I like the names but they are hard to read. Why not add some space?

Comments

  • Anonymous
    December 18, 2008
    The comment has been removed