troubleshooting Question

c# linqToExcel covert to string objects

Avatar of victoriaharry
victoriaharry asked on
C#.NET ProgrammingProgramming
8 Comments1 Solution892 ViewsLast Modified:
Hi Guys,

I have a NUnit test in which I'm trying to read the testdata from rows in an excel file. My NUnit test is quite simple for this example and is below

 [Test, TestCaseSource("linqTesting2")]
        public void CompleteFormTestDataSource4(String username, String password)

            LoginPageObject pageLogin = new LoginPageObject();
            EAPageObject pageEA = pageLogin.Login(username, password);


My method to read the excel rows using linqToExcel is below

public static IQueryable<LinqToExcel.Row> linqTesting2()
            var excel = new ExcelQueryFactory(Constants.testDataPath4);
            var testcases = from c in excel.Worksheet("Sheet1")
                            where c["UserName"] == "SonjaB"
                            select c;
            return testcases;

To use the row data in my unit test do I need to somehow convert it to a IEnumerable<string[]> before it gets returned to the test. If so any ideas on how to do this would be appreciated. When I ran the test the only error I get is I need to pass the correct amount of parameters.

Join our community to see this answer!
Unlock 1 Answer and 8 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 8 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros