@@ -81,13 +81,8 @@ public void should_not_install_a_package_in_the_lib_directory()
81
81
[ Fact ]
82
82
public void should_contain_a_message_that_it_would_have_used_Nuget_to_install_a_package ( )
83
83
{
84
- bool expectedMessage = false ;
85
- foreach ( var message in MockLogger . MessagesFor ( LogLevel . Info ) . or_empty_list_if_null ( ) )
86
- {
87
- if ( message . Contains ( "would have used NuGet to install packages" ) ) expectedMessage = true ;
88
- }
89
-
90
- expectedMessage . Should ( ) . BeTrue ( ) ;
84
+ MockLogger . Messages . Should ( ) . ContainKey ( LogLevel . Info . to_string ( ) )
85
+ . WhoseValue . Should ( ) . Contain ( "would have used NuGet to install packages" ) ;
91
86
}
92
87
93
88
[ Fact ]
@@ -130,25 +125,15 @@ public void should_not_install_a_package_in_the_lib_directory()
130
125
[ Fact ]
131
126
public void should_contain_a_message_that_it_would_have_used_Nuget_to_install_a_package ( )
132
127
{
133
- bool expectedMessage = false ;
134
- foreach ( var message in MockLogger . MessagesFor ( LogLevel . Info ) . or_empty_list_if_null ( ) )
135
- {
136
- if ( message . Contains ( "would have used NuGet to install packages" ) ) expectedMessage = true ;
137
- }
138
-
139
- expectedMessage . Should ( ) . BeTrue ( ) ;
128
+ MockLogger . Messages . Should ( ) . ContainKey ( LogLevel . Info . to_string ( ) )
129
+ . WhoseValue . Should ( ) . Contain ( "would have used NuGet to install packages" ) ;
140
130
}
141
131
142
132
[ Fact ]
143
133
public void should_contain_a_message_that_it_was_unable_to_find_package ( )
144
134
{
145
- bool expectedMessage = false ;
146
- foreach ( var message in MockLogger . MessagesFor ( LogLevel . Error ) . or_empty_list_if_null ( ) )
147
- {
148
- if ( message . Contains ( "somethingnonexisting not installed. The package was not found with the source(s) listed" ) ) expectedMessage = true ;
149
- }
150
-
151
- expectedMessage . Should ( ) . BeTrue ( ) ;
135
+ MockLogger . Messages . Should ( ) . ContainKey ( LogLevel . Error . to_string ( ) )
136
+ . WhoseValue . Should ( ) . Contain ( "somethingnonexisting not installed. The package was not found with the source(s) listed" ) ;
152
137
}
153
138
}
154
139
@@ -450,13 +435,8 @@ public void should_contain_a_warning_message_that_it_installed_4_out_of_5_packag
450
435
[ Fact ]
451
436
public void should_contain_a_message_that_upgradepackage_with_an_expected_specified_version_was_installed ( )
452
437
{
453
- bool expectedMessage = false ;
454
- foreach ( var message in MockLogger . MessagesFor ( LogLevel . Info ) . or_empty_list_if_null ( ) )
455
- {
456
- if ( message . Contains ( "upgradepackage v1.0.0" ) ) expectedMessage = true ;
457
- }
458
-
459
- expectedMessage . Should ( ) . BeTrue ( ) ;
438
+ MockLogger . Messages . Should ( ) . ContainKey ( LogLevel . Info . to_string ( ) )
439
+ . WhoseValue . Should ( ) . Contain ( "upgradepackage v1.0.0" ) ;
460
440
}
461
441
462
442
[ Fact ]
@@ -502,25 +482,15 @@ public void should_not_have_warning_package_result()
502
482
[ Fact ]
503
483
public void should_specify_config_file_is_being_used_in_message ( )
504
484
{
505
- bool expectedMessage = false ;
506
- foreach ( var message in MockLogger . MessagesFor ( LogLevel . Info ) . or_empty_list_if_null ( ) )
507
- {
508
- if ( message . Contains ( "Installing from config file:" ) ) expectedMessage = true ;
509
- }
510
-
511
- expectedMessage . Should ( ) . BeTrue ( ) ;
485
+ MockLogger . Messages . Should ( ) . ContainKey ( LogLevel . Info . to_string ( ) )
486
+ . WhoseValue . Should ( ) . Contain ( "Installing from config file:" ) ;
512
487
}
513
488
514
489
[ Fact ]
515
490
public void should_print_out_package_from_config_file_in_message ( )
516
491
{
517
- bool expectedMessage = false ;
518
- foreach ( var message in MockLogger . MessagesFor ( LogLevel . Info ) . or_empty_list_if_null ( ) )
519
- {
520
- if ( message . Contains ( "installpackage" ) ) expectedMessage = true ;
521
- }
522
-
523
- expectedMessage . Should ( ) . BeTrue ( ) ;
492
+ MockLogger . Messages . Should ( ) . ContainKey ( LogLevel . Info . to_string ( ) )
493
+ . WhoseValue . Should ( ) . Contain ( "installpackage" ) ;
524
494
}
525
495
}
526
496
@@ -849,13 +819,8 @@ public void should_not_be_able_delete_the_rollback()
849
819
[ Fact ]
850
820
public void should_contain_a_message_that_it_installed_successfully ( )
851
821
{
852
- bool expectedMessage = false ;
853
- foreach ( var message in MockLogger . MessagesFor ( LogLevel . Warn ) . or_empty_list_if_null ( ) )
854
- {
855
- if ( message . Contains ( "1/1" ) ) expectedMessage = true ;
856
- }
857
-
858
- expectedMessage . Should ( ) . BeTrue ( ) ;
822
+ MockLogger . Messages . Should ( ) . ContainKey ( LogLevel . Warn . to_string ( ) )
823
+ . WhoseValue . Should ( ) . Contain ( "1/1" ) ;
859
824
}
860
825
861
826
[ Fact ]
@@ -947,13 +912,8 @@ public void should_delete_the_rollback()
947
912
[ Fact ]
948
913
public void should_contain_a_message_that_it_was_unable_to_reinstall_successfully ( )
949
914
{
950
- bool expectedMessage = false ;
951
- foreach ( var message in MockLogger . MessagesFor ( LogLevel . Warn ) . or_empty_list_if_null ( ) )
952
- {
953
- if ( message . Contains ( "0/1" ) ) expectedMessage = true ;
954
- }
955
-
956
- expectedMessage . Should ( ) . BeTrue ( ) ;
915
+ MockLogger . Messages . Should ( ) . ContainKey ( LogLevel . Warn . to_string ( ) )
916
+ . WhoseValue . Should ( ) . Contain ( "0/1" ) ;
957
917
}
958
918
959
919
[ Fact ]
@@ -1989,13 +1949,8 @@ public void should_install_the_expected_version_of_the_dependency()
1989
1949
[ Fact ]
1990
1950
public void should_contain_a_message_that_everything_installed_successfully ( )
1991
1951
{
1992
- bool expectedMessage = false ;
1993
- foreach ( var message in MockLogger . MessagesFor ( LogLevel . Warn ) . or_empty_list_if_null ( ) )
1994
- {
1995
- if ( message . Contains ( "3/3" ) ) expectedMessage = true ;
1996
- }
1997
-
1998
- expectedMessage . Should ( ) . BeTrue ( ) ;
1952
+ MockLogger . Messages . Should ( ) . ContainKey ( LogLevel . Warn . to_string ( ) )
1953
+ . WhoseValue . Should ( ) . Contain ( "3/3" ) ;
1999
1954
}
2000
1955
2001
1956
[ Fact ]
@@ -2103,13 +2058,8 @@ public void should_not_upgrade_the_dependency()
2103
2058
[ Fact ]
2104
2059
public void should_contain_a_message_that_it_installed_successfully ( )
2105
2060
{
2106
- bool expectedMessage = false ;
2107
- foreach ( var message in MockLogger . MessagesFor ( LogLevel . Warn ) . or_empty_list_if_null ( ) )
2108
- {
2109
- if ( message . Contains ( "1/1" ) ) expectedMessage = true ;
2110
- }
2111
-
2112
- expectedMessage . Should ( ) . BeTrue ( ) ;
2061
+ MockLogger . Messages . Should ( ) . ContainKey ( LogLevel . Warn . to_string ( ) )
2062
+ . WhoseValue . Should ( ) . Contain ( "1/1" ) ;
2113
2063
}
2114
2064
2115
2065
[ Fact ]
0 commit comments