コード例 #1
0
 public void TestForFileNotFoundException()
 {
     try
     {
         //give the  path of not available csv file
         string path = @"D:\trimbak\state analys\StatesusData.csv";
         //call the readmethod and it return the number of record
         BaseStateCensus ReadForStateCensus = new BaseStateCensus(path);
         int             record             = ReadForStateCensus.ReadMethod(',');
     }
     catch (StateCensusException e)
     {
         Assert.AreEqual("file is not present on this location", e.Message);
     }
 }
コード例 #2
0
 public void TestForWrongTypeException()
 {
     try
     {
         //chenge file type csv to txt and check
         string path = @"D:\trimbak\state analys\StateCensusData.txt";
         //send the file path
         BaseStateCensus ReadForStateCensus = new BaseStateCensus(path);
         //call the readmethod and it return the number of record
         int record = ReadForStateCensus.ReadMethod(',');
     }
     catch (StateCensusException e)
     {
         Assert.AreEqual("enter proper file", e.Message);
     }
 }
コード例 #3
0
 public void TestForWrongTypeExceptionForStateCode()
 {
     try
     {
         //chenge file type csv to txt and check
         string Path = @"D:\trimbak\state analys\StateCode.txt";
         //create object fo csv reder by using local file path
         BaseStateCensus ReadForCsvState = new BaseStateCensus(Path);
         //call the readmethod and it return the number of record
         int record = ReadForCsvState.ReadMethod(',');
     }
     catch (StateCensusException e)
     {
         Assert.AreEqual("enter proper file", e.Message);
     }
 }
コード例 #4
0
 public void TestForFileNotFoundExceptionForStateCode()
 {
     try
     {
         //give the  path of not existing csv file
         string Path = @"D:\trimbak\state analys\Statee.csv";
         //create object fo csv reder by using local file path
         BaseStateCensus ReadForCsvState = new BaseStateCensus(Path);
         //call the readmethod and it return the number of record
         int record = ReadForCsvState.ReadMethod(',');
     }
     catch (StateCensusException e)
     {
         Assert.AreEqual("file is not present on this location", e.Message);
     }
 }