@@ -5461,5 +5461,104 @@ public override void Context()
5461
5461
Configuration . Version = NonNormalizedVersion ;
5462
5462
}
5463
5463
}
5464
+
5465
+ public class when_installing_a_package_that_requires_updating_a_dependency : ScenariosBase
5466
+ {
5467
+ private const string TargetPackageName = "hasdependencywithbeforemodify" ;
5468
+ private const string DependencyName = "isdependencywithbeforemodify" ;
5469
+
5470
+ public override void Context ( )
5471
+ {
5472
+ base . Context ( ) ;
5473
+
5474
+ Scenario . add_packages_to_source_location ( Configuration , "{0}.*" . format_with ( TargetPackageName ) + NuGetConstants . PackageExtension ) ;
5475
+ Scenario . add_packages_to_source_location ( Configuration , "{0}.*" . format_with ( DependencyName ) + NuGetConstants . PackageExtension ) ;
5476
+ Scenario . install_package ( Configuration , DependencyName , "1.0.0" ) ;
5477
+
5478
+ Configuration . PackageNames = Configuration . Input = TargetPackageName ;
5479
+ }
5480
+
5481
+ public override void Because ( )
5482
+ {
5483
+ Results = Service . install_run ( Configuration ) ;
5484
+ }
5485
+
5486
+ [ Fact ]
5487
+ public void should_install_the_package ( )
5488
+ {
5489
+ var packageFile = Path . Combine ( Scenario . get_top_level ( ) , "lib" , TargetPackageName , "{0}.nupkg" . format_with ( TargetPackageName ) ) ;
5490
+ using ( var packageReader = new PackageArchiveReader ( packageFile ) )
5491
+ {
5492
+ packageReader . NuspecReader . GetVersion ( ) . to_string ( ) . ShouldEqual ( "2.0.0" ) ;
5493
+ }
5494
+ }
5495
+
5496
+ [ Fact ]
5497
+ public void should_upgrade_the_minimum_version_dependency ( )
5498
+ {
5499
+ var packageFile = Path . Combine ( Scenario . get_top_level ( ) , "lib" , DependencyName , "{0}.nupkg" . format_with ( DependencyName ) ) ;
5500
+ using ( var packageReader = new PackageArchiveReader ( packageFile ) )
5501
+ {
5502
+ packageReader . NuspecReader . GetVersion ( ) . to_string ( ) . ShouldEqual ( "2.0.0" ) ;
5503
+ }
5504
+ }
5505
+
5506
+ [ Fact ]
5507
+ public void should_contain_a_message_that_everything_installed_successfully ( )
5508
+ {
5509
+ MockLogger . contains_message ( "installed 2/2" , LogLevel . Warn ) . ShouldBeTrue ( ) ;
5510
+ }
5511
+
5512
+ [ Fact ]
5513
+ [ WindowsOnly ]
5514
+ [ Platform ( Exclude = "Mono" ) ]
5515
+ public void should_not_run_target_package_beforeModify_for_upgraded_version ( )
5516
+ {
5517
+ MockLogger . contains_message ( "Ran BeforeModify: {0} {1}" . format_with ( TargetPackageName , "2.0.0" ) , LogLevel . Info ) . ShouldBeFalse ( ) ;
5518
+ }
5519
+
5520
+ [ Fact ]
5521
+ [ WindowsOnly ]
5522
+ [ Platform ( Exclude = "Mono" ) ]
5523
+ public void should_run_already_installed_dependency_package_beforeModify ( )
5524
+ {
5525
+ MockLogger . contains_message ( "Ran BeforeModify: {0} {1}" . format_with ( DependencyName , "1.0.0" ) , LogLevel . Info ) . ShouldBeTrue ( ) ;
5526
+ }
5527
+
5528
+ [ Fact ]
5529
+ [ WindowsOnly ]
5530
+ [ Platform ( Exclude = "Mono" ) ]
5531
+ public void should_not_run_dependency_package_beforeModify_for_upgraded_version ( )
5532
+ {
5533
+ MockLogger . contains_message ( "Ran BeforeModify: {0} {1}" . format_with ( DependencyName , "2.0.0" ) , LogLevel . Info ) . ShouldBeFalse ( ) ;
5534
+ }
5535
+
5536
+ [ Fact ]
5537
+ public void should_have_a_successful_package_result ( )
5538
+ {
5539
+ foreach ( var packageResult in Results )
5540
+ {
5541
+ packageResult . Value . Success . ShouldBeTrue ( ) ;
5542
+ }
5543
+ }
5544
+
5545
+ [ Fact ]
5546
+ public void should_not_have_inconclusive_package_result ( )
5547
+ {
5548
+ foreach ( var packageResult in Results )
5549
+ {
5550
+ packageResult . Value . Inconclusive . ShouldBeFalse ( ) ;
5551
+ }
5552
+ }
5553
+
5554
+ [ Fact ]
5555
+ public void should_not_have_warning_package_result ( )
5556
+ {
5557
+ foreach ( var packageResult in Results )
5558
+ {
5559
+ packageResult . Value . Warning . ShouldBeFalse ( ) ;
5560
+ }
5561
+ }
5562
+ }
5464
5563
}
5465
5564
}
0 commit comments