a28883aad2
Use explicit Razor interpolation for create and edit URLs and cover the rendered link syntax with a regression test. Ref: IT-1039
33 lines
1.0 KiB
C#
33 lines
1.0 KiB
C#
namespace HrynCo.NotificationService.Web.IntegrationTests;
|
|
|
|
public sealed class AdminTemplatesIndexViewTests
|
|
{
|
|
[Fact]
|
|
public void CreateAndEditLinks_UseExplicitFilterQueryInterpolation()
|
|
{
|
|
string view = File.ReadAllText(FindIndexView());
|
|
|
|
Assert.Contains("/admin/templates/create@(filterQuery)", view);
|
|
Assert.Contains("@t.LanguageCode@(filterQuery)", view);
|
|
Assert.DoesNotContain("create@filterQuery", view);
|
|
Assert.DoesNotContain("LanguageCode@filterQuery", view);
|
|
}
|
|
|
|
private static string FindIndexView()
|
|
{
|
|
DirectoryInfo? directory = new(AppContext.BaseDirectory);
|
|
while (directory is not null && !File.Exists(Path.Combine(directory.FullName, "HrynCo.NotificationService.slnx")))
|
|
{
|
|
directory = directory.Parent;
|
|
}
|
|
|
|
Assert.NotNull(directory);
|
|
return Path.Combine(
|
|
directory.FullName,
|
|
"HrynCo.NotificationService.Web",
|
|
"Views",
|
|
"AdminTemplates",
|
|
"Index.cshtml");
|
|
}
|
|
}
|