Repository: dotnet/runtime
File: src/mono/wasm/Wasm.Build.Tests/Templates/WasmTemplateTests.cs (C#)

Code before:
            // Build to trigger the _EnsureDotnetTypeScriptDefinitions target during the build phase
            BuildProject(info, config, new BuildOptions());

            // Verify dotnet.d.ts presence in the project's wwwroot directory after build
            bool fileExists = File.Exists(dotnetDtsWwwrootPath);
            if (emitTypeScriptDts)
            {
                Assert.True(fileExists, $"dotnet.d.ts should be created at {dotnetDtsWwwrootPath} after the build with WasmEmitTypeScriptDefinitions={shouldEmit}");
            }
            else
            {
                Assert.False(fileExists, $"dotnet.d.ts should not exist at {dotnetDtsWwwrootPath} after the build with WasmEmitTypeScriptDefinitions={shouldEmit}");
            }
        }

        [Theory]
        [InlineData("true", false)]
        [InlineData("false", true)]
        [InlineData("", false)] // Default case
        public void UseMonoRuntimeParameter(string useMonoRuntimeArg, bool expectUseMonoRuntimeProperty)
        {
            Configuration config = Configuration.Debug;
            string extraArgs = string.IsNullOrEmpty(useMonoRuntimeArg) ? "" : $"--UseMonoRuntime {useMonoRuntimeArg}";
            ProjectInfo info = CreateWasmTemplateProject(Template.WasmBrowser, config, aot: false, "usemonoruntime", extraArgs: extraArgs);

            string projectDirectory = Path.GetDirectoryName(info.ProjectFilePath)!;
            string projectFile = File.ReadAllText(info.ProjectFilePath);

            // Verify UseMonoRuntime presence in the project file
            bool containsUseMonoRuntime = projectFile.Contains("<UseMonoRuntime>false</UseMonoRuntime>");
            if (expectUseMonoRuntimeProperty)
            {
                Assert.True(containsUseMonoRuntime, $"Expected <UseMonoRuntime>false</UseMonoRuntime> to be present in the project file when --UseMonoRuntime {useMonoRuntimeArg}");
            }
            else
            {
                Assert.False(containsUseMonoRuntime, $"Expected <UseMonoRuntime>false</UseMonoRuntime> to not be present in the project file when --UseMonoRuntime {useMonoRuntimeArg}");
            }
        }
    }
}


Review comment (suggestion):
The variable `projectDirectory` is declared but never used in this test method. Consider removing this unused variable declaration.
```suggestion

```

Code after:
            // Build to trigger the _EnsureDotnetTypeScriptDefinitions target during the build phase
            BuildProject(info, config, new BuildOptions());

            // Verify dotnet.d.ts presence in the project's wwwroot directory after build
            bool fileExists = File.Exists(dotnetDtsWwwrootPath);
            if (emitTypeScriptDts)
            {
                Assert.True(fileExists, $"dotnet.d.ts should be created at {dotnetDtsWwwrootPath} after the build with WasmEmitTypeScriptDefinitions={shouldEmit}");
            }
            else
            {
                Assert.False(fileExists, $"dotnet.d.ts should not exist at {dotnetDtsWwwrootPath} after the build with WasmEmitTypeScriptDefinitions={shouldEmit}");
            }
        }

        [Theory]
        [InlineData("true", false)]
        [InlineData("false", true)]
        [InlineData("", false)] // Default case
        public void UseMonoRuntimeParameter(string useMonoRuntimeArg, bool expectUseMonoRuntimeProperty)
        {
            Configuration config = Configuration.Debug;
            string extraArgs = string.IsNullOrEmpty(useMonoRuntimeArg) ? "" : $"--UseMonoRuntime {useMonoRuntimeArg}";
            ProjectInfo info = CreateWasmTemplateProject(Template.WasmBrowser, config, aot: false, "usemonoruntime", extraArgs: extraArgs);

            string projectFile = File.ReadAllText(info.ProjectFilePath);

            // Verify UseMonoRuntime presence in the project file
            bool containsUseMonoRuntime = projectFile.Contains("<UseMonoRuntime>false</UseMonoRuntime>");
            if (expectUseMonoRuntimeProperty)
            {
                Assert.True(containsUseMonoRuntime, $"Expected <UseMonoRuntime>false</UseMonoRuntime> to be present in the project file when --UseMonoRuntime {useMonoRuntimeArg}");
            }
            else
            {
                Assert.False(containsUseMonoRuntime, $"Expected <UseMonoRuntime>false</UseMonoRuntime> to not be present in the project file when --UseMonoRuntime {useMonoRuntimeArg}");
            }
        }
    }
}