From 85e94715d5a120d0f1ab61d4bcc698c37130e4cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Standa=20Luke=C5=A1?= Date: Fri, 29 Nov 2024 17:16:31 +0100 Subject: [PATCH] Print message with timestamp to see what the hell is the GA filesystem doing --- src/Tests/Runtime/MarkupLoaderTests.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Tests/Runtime/MarkupLoaderTests.cs b/src/Tests/Runtime/MarkupLoaderTests.cs index 25fc987a6..a4bb7daf0 100644 --- a/src/Tests/Runtime/MarkupLoaderTests.cs +++ b/src/Tests/Runtime/MarkupLoaderTests.cs @@ -61,24 +61,28 @@ public void FileReloading(bool debug) var directory = MakeTempDir(); var file = Path.Combine(directory, "test.dotcontrol"); File.WriteAllText(file, "@viewModel string\n\n"); + var changedTime1 = File.GetLastWriteTimeUtc(file); var config = debug ? DotvvmTestHelper.DebugConfig : DotvvmTestHelper.DefaultConfig; var controlBuilder = config.ServiceProvider.GetRequiredService(); var builder0 = controlBuilder.GetControlBuilder(file); Assert.AreEqual(typeof(string), builder0.descriptor.DataContextType); - + var builderUnchanged = controlBuilder.GetControlBuilder(file); Assert.AreSame(builder0.builder, builderUnchanged.builder); // same Lazy instance File.WriteAllText(file, "@viewModel int\n\n"); - Thread.Sleep(1000); var builderChanged = controlBuilder.GetControlBuilder(file); var control = builderChanged.builder.Value.BuildControl(config.ServiceProvider.GetRequiredService(), config.ServiceProvider); if (debug) { + var changedTime2 = File.GetLastWriteTimeUtc(file); + if (changedTime1 == changedTime2) + Assert.Fail($"File system resolution is probably too low ({changedTime1:o} == {changedTime2:o}), ignores changes or something."); + Assert.AreEqual(typeof(int), builderChanged.descriptor.DataContextType); Assert.AreNotSame(builder0.builder, builderChanged.builder); // different Lazy instance XAssert.Equal(["Changed"], control.GetThisAndAllDescendants().OfType().Select(c => c.Text));