vendredi 5 février 2016

C# unit testing IOexception

I am struggling to create a unit test of this nature:

 [TestMethod, ExpectedException(typeof(IOException))]
       public void FileNotFound_ThrowsIOException()
       {
    }

The bit I need to test is the following:

[public static List<blah> ParseBlahdata()
       {
           List<blah> blahs = new List<blah>();
           var read = new StreamReader(File.OpenRead(webpage));
           var parse = new CsvParser(read);
           while (true)
           {
               var row = parse.Read();
               if (row == null)
               {
                   break;
               }
               blahs.Add(new blah(row[0]));
           }
           return blahs;
       }

Thank you for any help!

Aucun commentaire:

Enregistrer un commentaire