Skip to content

Commit e9c503a

Browse files
committed
Respond to PR feedback
* Move WaitForUtcNowToAdvance to reusable place and reuse it appropriately * Add comment explaining ".." in path * Remove unnecessary TestLibrary restore
1 parent 299fc50 commit e9c503a

File tree

3 files changed

+13
-12
lines changed

3 files changed

+13
-12
lines changed

src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantBuildsToBeIncremental.cs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -80,15 +80,5 @@ public void ResolvePackageAssets_runs_incrementally()
8080
var cacheWriteTime4 = File.GetLastWriteTimeUtc(assetsCachePath);
8181
cacheWriteTime4.Should().NotBe(cacheWriteTime3);
8282
}
83-
84-
private static void WaitForUtcNowToAdvance()
85-
{
86-
var start = DateTime.UtcNow;
87-
88-
while (DateTime.UtcNow <= start)
89-
{
90-
Thread.Sleep(millisecondsTimeout: 1);
91-
}
92-
}
9383
}
9484
}

src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishAProjectWithAllFeatures.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ public void It_does_not_build_when_nobuild_is_set(string targetFramework, string
114114

115115
// capture modification time of all binaries before publish
116116
var modificationTimes = GetLastWriteTimesUtc(buildCommand, "*.exe", "*.dll", "*.resources", "*.pdb");
117+
WaitForUtcNowToAdvance();
117118

118119
// publish (with NoBuild set)
119120
publishCommand.Execute("/p:NoBuild=true").Should().Pass();
@@ -140,7 +141,7 @@ private static IEnumerable<string> EnumerateFiles(MSBuildCommand command, params
140141
{
141142
return searchPatterns.SelectMany(
142143
pattern => Directory.EnumerateFiles(
143-
Path.Combine(command.ProjectRootPath, ".."),
144+
Path.Combine(command.ProjectRootPath, ".."), // up one level from TestApp to also get TestLibrary P2P files
144145
pattern,
145146
SearchOption.AllDirectories));
146147
}
@@ -162,7 +163,6 @@ private PublishCommand GetPublishCommand(string targetFramework, [CallerMemberNa
162163
});
163164

164165
testAsset.Restore(Log, "TestApp");
165-
testAsset.Restore(Log, "TestLibrary");
166166

167167
var appProjectDirectory = Path.Combine(testAsset.TestRoot, "TestApp");
168168

src/Tests/Microsoft.NET.TestFramework/SdkTest.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using System.Reflection;
55
using System.Runtime.InteropServices;
66
using System.Text;
7+
using System.Threading;
78
using Xunit.Abstractions;
89

910
namespace Microsoft.NET.TestFramework
@@ -20,5 +21,15 @@ protected SdkTest(ITestOutputHelper log)
2021
{
2122
Log = log;
2223
}
24+
25+
protected static void WaitForUtcNowToAdvance()
26+
{
27+
var start = DateTime.UtcNow;
28+
29+
while (DateTime.UtcNow <= start)
30+
{
31+
Thread.Sleep(millisecondsTimeout: 1);
32+
}
33+
}
2334
}
2435
}

0 commit comments

Comments
 (0)