Пример #1
0
 public void Test_DataParser_Wrong_Rate()
 {
     var data = new string[] { "Joe", "123#123", "1000" };
     var parser = new DataParser();
     Assert.Throws<DataParsingException>(() =>
     {
         var result = parser.Parse(data);
     });
 }
Пример #2
0
 public void Test_DataParser_Wrong_Number_Of_Fields()
 {
     var data = new string[] { "123.123", "1000" };
     var parser = new DataParser();
     Assert.Throws<DataParsingException>(() =>
     {
         var result = parser.Parse(data);
     });
 }
Пример #3
0
 public void Test_DataParser_Missing_Name()
 {
     var data = new string[] { "", "123.123", "1000" };
     var parser = new DataParser();
     Assert.Throws<DataParsingException>(() =>
     {
         var result = parser.Parse(data);
     });
 }
Пример #4
0
 public void Test_DataParser_OK()
 {
     var data = new string[] { "Joe", "123.123", "1000" };
     var parser = new DataParser();
     var result = parser.Parse(data);
     Assert.NotNull(result);
     Assert.Equal("Joe", result.Name);
     Assert.Equal(123.123m, result.Rate);
     Assert.Equal(1000m, result.Available);
 }
Пример #5
0
 public List<Lender> Collect(string readerParameter)
 {
     var lenders = new List<Lender>();
     var parser = new DataParser();
     _reader.Open(readerParameter);
     string[] data;
     while ((data = _reader.ReadData()) != null)
     {
         var lender = parser.Parse(data);
         if (lender != null) lenders.Add(lender);
     }
     return lenders;
 }