jeudi 4 octobre 2018

Converting "Microsoft.Office.Interop.Excel.WorkSheet" to "Microsoft.Office.Tools.Excel.WorkSheet", or alternative ways to test VSTO project

I have a VSTO project that allows a user to provide some input and also provides the user with a button. When the user clicks the button all the input is read, some calculation is done, and the output is pasted on a dedicated sheet.

I was trying to create an application-level test for the project as follows: the test is run with a given Excel file, which contains the inputs in the same format as the VSTO project's Excel file. Furthermore the test file will also have the expected outputs in the result sheet. The test process will read the inputs, generate actual outputs from code and compare to the outputs present in the test file.

To read this test file I was trying to use the same methods that I'm using to read the VSTO project's Excel file. However, since placing buttons in VSTO require using Microsoft.Office.Tools.Excel.WorkSheet, I'm unable to use Microsoft.Office.Interop.Excel.WorkSheet with my existing code. I'm using Interop.Excel to read in the test file. Casting "Microsoft.Office.Interop.Excel.WorkSheet" to "Microsoft.Office.Tools.Excel.WorkSheet" doesn't work.

I'm also open to any alternative ways to test this application. The goal of this test is to compare output generated by the app with expected output. Any help regarding this issue is much appreciated!

Aucun commentaire:

Enregistrer un commentaire