@@ -37,42 +37,47 @@ suite("InformationMessageObserver", () => {
3737 } ) ;
3838 } ) ;
3939
40- suite ( 'OmnisharpServerUnresolvedDependencies' , ( ) => {
41- let event = getUnresolvedDependenices ( "someFile" ) ;
42-
43- suite ( 'Suppress Dotnet Restore Notification is true' , ( ) => {
44- setup ( ( ) => updateConfig ( vscode , 'csharp' , 'suppressDotnetRestoreNotification' , true ) ) ;
45-
46- test ( 'The information message is not shown' , ( ) => {
47- observer . post ( event ) ;
48- expect ( infoMessage ) . to . be . undefined ;
49- } ) ;
50- } ) ;
51-
52- suite ( 'Suppress Dotnet Restore Notification is false' , ( ) => {
53- setup ( ( ) => updateConfig ( vscode , 'csharp' , 'suppressDotnetRestoreNotification' , false ) ) ;
54-
55- test ( 'The information message is shown' , async ( ) => {
56- observer . post ( event ) ;
57- expect ( relativePath ) . to . not . be . empty ;
58- expect ( infoMessage ) . to . not . be . empty ;
59- doClickOk ( ) ;
60- await commandDone ;
61- expect ( invokedCommand ) . to . be . equal ( 'dotnet.restore' ) ;
62- } ) ;
63-
64- test ( 'Given an information message if the user clicks Restore, the command is executed' , async ( ) => {
65- observer . post ( event ) ;
66- doClickOk ( ) ;
67- await commandDone ;
68- expect ( invokedCommand ) . to . be . equal ( 'dotnet.restore' ) ;
40+ [
41+ {
42+ event : getUnresolvedDependenices ( "someFile" ) ,
43+ expectedCommand : "dotnet.restore"
44+ }
45+ ] . forEach ( ( elem ) => {
46+ suite ( elem . event . constructor . name , ( ) => {
47+ suite ( 'Suppress Dotnet Restore Notification is true' , ( ) => {
48+ setup ( ( ) => updateConfig ( vscode , 'csharp' , 'suppressDotnetRestoreNotification' , true ) ) ;
49+
50+ test ( 'The information message is not shown' , ( ) => {
51+ observer . post ( elem . event ) ;
52+ expect ( infoMessage ) . to . be . undefined ;
53+ } ) ;
6954 } ) ;
7055
71- test ( 'Given an information message if the user clicks cancel, the command is not executed' , async ( ) => {
72- observer . post ( event ) ;
73- doClickCancel ( ) ;
74- await expect ( Observable . fromPromise ( commandDone ) . timeout ( 1 ) . toPromise ( ) ) . to . be . rejected ;
75- expect ( invokedCommand ) . to . be . undefined ;
56+ suite ( 'Suppress Dotnet Restore Notification is false' , ( ) => {
57+ setup ( ( ) => updateConfig ( vscode , 'csharp' , 'suppressDotnetRestoreNotification' , false ) ) ;
58+
59+ test ( 'The information message is shown' , async ( ) => {
60+ observer . post ( elem . event ) ;
61+ expect ( relativePath ) . to . not . be . empty ;
62+ expect ( infoMessage ) . to . not . be . empty ;
63+ doClickOk ( ) ;
64+ await commandDone ;
65+ expect ( invokedCommand ) . to . be . equal ( elem . expectedCommand ) ;
66+ } ) ;
67+
68+ test ( 'Given an information message if the user clicks Restore, the command is executed' , async ( ) => {
69+ observer . post ( elem . event ) ;
70+ doClickOk ( ) ;
71+ await commandDone ;
72+ expect ( invokedCommand ) . to . be . equal ( elem . expectedCommand ) ;
73+ } ) ;
74+
75+ test ( 'Given an information message if the user clicks cancel, the command is not executed' , async ( ) => {
76+ observer . post ( elem . event ) ;
77+ doClickCancel ( ) ;
78+ await expect ( Observable . fromPromise ( commandDone ) . timeout ( 1 ) . toPromise ( ) ) . to . be . rejected ;
79+ expect ( invokedCommand ) . to . be . undefined ;
80+ } ) ;
7681 } ) ;
7782 } ) ;
7883 } ) ;
0 commit comments