File tree Expand file tree Collapse file tree 2 files changed +9
-6
lines changed
GithubActionsHelloWorldTests Expand file tree Collapse file tree 2 files changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -13,14 +13,14 @@ public static async Task Main(string[] args)
1313 CreateExcelDocument ( ) ;
1414 }
1515
16- private static void CreateExcelDocument ( )
16+ public static string CreateExcelDocument ( )
1717 {
18- Microsoft . Office . Interop . Excel . Application excelApplication = null ;
18+ Application excelApplication = null ;
1919
2020 try
2121 {
2222 excelApplication = new
23- Microsoft . Office . Interop . Excel . Application ( ) ;
23+ Application ( ) ;
2424 Workbook excelWorkBook = excelApplication . Workbooks . Add ( ) ;
2525 Worksheet worksheet = ( Worksheet ) excelWorkBook . Worksheets [ 1 ] ;
2626 worksheet . Cells [ 1 , 1 ] = "Product Id" ;
@@ -32,10 +32,12 @@ private static void CreateExcelDocument()
3232 var path = Path . GetTempFileName ( ) + ".xlsx" ;
3333 Console . WriteLine ( path ) ;
3434 excelWorkBook . SaveAs ( Path . Combine ( path ) ) ;
35+ return path ;
3536 }
3637 catch ( Exception ex )
3738 {
3839 Console . WriteLine ( ex . Message ) ;
40+ return ex . Message ;
3941 }
4042 finally
4143 {
Original file line number Diff line number Diff line change 11using GithubActionsHelloWorld ;
2- using System . Threading . Tasks ;
32using Xunit ;
43
54namespace GithubActionsHelloWorldTests
65{
76 public class GithubActionsHelloWorldTest
87 {
98 [ Fact ]
10- public async Task Main_ShouldRunWithoutError ( )
9+ public void Main_ShouldRunWithoutError ( )
1110 {
1211 var args = new string [ ] { "WrongParameterCount" } ;
13- await Program . Main ( args ) ;
12+ var path = Program . CreateExcelDocument ( ) ;
13+
14+ Assert . True ( System . IO . File . Exists ( path ) ) ;
1415 }
1516 }
1617}
You can’t perform that action at this time.
0 commit comments