@@ -1538,7 +1538,7 @@ mod tests {
15381538 #[ rstest]
15391539 #[ case:: early_decommission_within_lifetime( 2024 , 2024 ) ]
15401540 #[ case:: decommission_at_maximum_year( 2026 , 2025 ) ]
1541- fn test_asset_decommission (
1541+ fn test_asset_decommission_with_process_lifetime (
15421542 #[ case] requested_decommission_year : u32 ,
15431543 #[ case] expected_decommission_year : u32 ,
15441544 process : Process ,
@@ -1563,6 +1563,35 @@ mod tests {
15631563 assert_eq ! ( asset. decommission_year( ) , Some ( expected_decommission_year) ) ;
15641564 }
15651565
1566+ #[ rstest]
1567+ #[ case:: early_decommission_within_lifetime( 2024 , 2024 ) ]
1568+ #[ case:: decommission_at_maximum_year( 2026 , 2025 ) ]
1569+ fn test_asset_decommission_with_predefined_decommission_year (
1570+ #[ case] requested_decommission_year : u32 ,
1571+ #[ case] expected_decommission_year : u32 ,
1572+ process : Process ,
1573+ ) {
1574+ // Test successful commissioning of Future asset
1575+ let process_rc = Rc :: new ( process) ;
1576+ let mut asset = Asset :: new_future_with_max_decommission (
1577+ "agent1" . into ( ) ,
1578+ Rc :: clone ( & process_rc) ,
1579+ "GBR" . into ( ) ,
1580+ Capacity ( 1.0 ) ,
1581+ 2020 ,
1582+ Some ( 2025 ) ,
1583+ )
1584+ . unwrap ( ) ;
1585+ asset. commission ( AssetID ( 1 ) , "" ) ;
1586+ assert ! ( asset. is_commissioned( ) ) ;
1587+ assert_eq ! ( asset. id( ) , Some ( AssetID ( 1 ) ) ) ;
1588+
1589+ // Test successful decommissioning
1590+ asset. decommission ( requested_decommission_year, "" ) ;
1591+ assert ! ( !asset. is_commissioned( ) ) ;
1592+ assert_eq ! ( asset. decommission_year( ) , Some ( expected_decommission_year) ) ;
1593+ }
1594+
15661595 #[ rstest]
15671596 #[ should_panic( expected = "Assets with state Candidate cannot be commissioned" ) ]
15681597 fn test_commission_wrong_states ( process : Process ) {
0 commit comments