public static void Initialization(TestContext context) { excel = new oExcel(DataTests.GetFullPathExcelFile); dtExcel = excel.ImportDataForExcel(); listField = excel.ListField("kmat"); // Functions.ListFieldKmatForExcel(dtExcel, "kmat"); dictionaryGroupBy = excel._groupByFieldAndCount("kmat"); //DictionaryResourceAndCount(listField); listUnique = excel.ListUniqueField("kmat"); //new List<string>(); // Functions.ListUniqueFieldResource(dictionaryGroupBy); // = DoubleKmat.ToArray(); }
//[DataSource( //"System.Data.OleDb", //@"Provider=Microsoft.ACE.OLEDB.12.0; // Data Source=..\..\DataTests\001 - 1301 - 1222333 - LastName - test_01.xlsx; // Persist Security Info=False; // Extended Properties='Excel 12.0 Xml; HDR=YES'", //"Sheet$", //DataAccessMethod.Sequential)] public void ListUniqueFieldResource_Test() { HashSet <string> hashSetUnique = new HashSet <string>(); // arrange var expendetListUnique = excel.ListField("kmat_double"); foreach (var row in expendetListUnique) { hashSetUnique.Add(row); } //act var actualListUnique = excel.ListUniqueField("kmat"); CollectionAssert.AreEqual(expendetListUnique, actualListUnique); //Assert.IsTrue(hashSetUnique.SetEquals(actualListUnique)); }