Skip to content

Commit 63e5607

Browse files
Copilotbaronfel
andcommitted
Add test documenting optimization scope and finalize implementation
Co-authored-by: baronfel <[email protected]>
1 parent 12b36f3 commit 63e5607

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

test/Microsoft.NET.Restore.Tests/GivenThatWeWantRestoreOptimizations.cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,5 +161,26 @@ public void SeparateRestoreCommand_respects_user_EnableDefaultItems()
161161
restoreArgs.Should().NotContain($"-property:{Constants.EnableDefaultItems}=false");
162162
restoreArgs.Should().Contain("-property:EnableDefaultItems=true");
163163
}
164+
165+
[Fact]
166+
public void Optimization_only_affects_restore_operations()
167+
{
168+
// This test verifies that the optimization is only applied in restore contexts
169+
// and doesn't affect other MSBuild operations
170+
171+
// The optimization should only be applied in:
172+
// 1. RestoreCommand.CreateForwarding (explicit restore)
173+
// 2. RestoringCommand.GetSeparateRestoreCommand (implicit restore)
174+
//
175+
// It should NOT be applied to regular build commands that don't involve restore
176+
177+
// For now, this is verified by code inspection since our optimization is only
178+
// applied in restore-specific code paths. If in the future other commands
179+
// start using Constants.AddRestoreOptimizations, we would need to ensure
180+
// they only do so in restore contexts.
181+
182+
// This test serves as documentation of the intended scope
183+
Assert.True(true, "Optimization scope is currently limited to restore commands by design");
184+
}
164185
}
165186
}

0 commit comments

Comments
 (0)