public void OpenOKPPriceTest() { var pricesDirectory = "prices"; var priceFile = "okp.xml"; var path = Settings.Default.TestDirectoryPath + pricesDirectory + Path.DirectorySeparatorChar + priceFile; var tables = PriceFileHelper.OpenPriceFile(Path.GetFullPath(path), PriceFormat.FarmaimpeksOKPFormalizer, PriceEncode.Cp1251, "tab", null); Assert.That(tables, Is.Not.Null); }
public void Open_price_file() { var pricesDirectory = "prices"; var invalidPricesDirectory = "invalid_prices"; var pricesFiles = new string[3] { "1.txt", "2.xls", "3.dbf" }; var countsTables = new int[3] { 1, 2, 1 }; var pricesFormats = new PriceFormat[4] { PriceFormat.DelimWIN, PriceFormat.XLS, PriceFormat.NativeDbf, PriceFormat.UniversalFormalizer }; var indvalidPricesFiles = new string[3] { "1.xls", "2.xls", "3.txt" }; var index = 0; foreach (var filename in pricesFiles) { var path = Settings.Default.TestDirectoryPath + pricesDirectory + Path.DirectorySeparatorChar + filename; var tables = PriceFileHelper.OpenPriceFile(Path.GetFullPath(path), pricesFormats[index], PriceEncode.Cp1251, "tab", null); Assert.That(tables.Count, Is.EqualTo(countsTables[index++])); Assert.That(tables[0].Rows.Count, Is.GreaterThan(0)); } index = 0; foreach (var filename in indvalidPricesFiles) { var path = Settings.Default.TestDirectoryPath + invalidPricesDirectory + Path.DirectorySeparatorChar + filename; var tables = PriceFileHelper.OpenPriceFile(Path.GetFullPath(path), pricesFormats[index++], PriceEncode.Cp1251, "tab", null); if (tables != null) { Assert.That(tables.Count, Is.EqualTo(1)); Assert.That(tables[0].Rows.Count, Is.EqualTo(0)); } } }