Add integration test that proves the crash is fixed

This commit is contained in:
David Wengier 2024-08-28 14:21:14 +10:00
Родитель 4b69790d1a
Коммит 5bc34898ac
2 изменённых файлов: 108 добавлений и 0 удалений

Просмотреть файл

@ -0,0 +1,54 @@
@page
@model Model
@{
ViewBag.Title = "This is a title";
ViewBag.HeaderTitle = "This is a header title";
ViewBag.HeaderBackground = "#003459";
ViewBag.HeaderForeground = "#FFFFFF";
if (Model.ChartName.Length == 0)
{
ViewBag.ShowChart = false;
}
}
@section Scripts {
<script type="text/javascript">
document.getElementById("form").onformdata = function(e) {
let formData = e.formData;
for (let [name, value] of Array.from(formData.entries())) {
if (value === '') {
formData.delete(name);
}
}
};
</script>
<script type="text/javascript">
window.onload = function() {
new Page({
connection: "no-connection",
urlOne: "@Request.PathBase/one",
urlTwo: "@Request.PathBase/two",
data: [@Html.Raw(string.Join(", ", Model.Data.Select(l => "\"" + l + "\"")))],
@(Model.IncludeData1.HasValue ? FormattableString.Invariant($"data1: {Model.Data1},") : null)
@(Model.IncludeData2.HasValue ? FormattableString.Invariant($"data2: {Model.Data2},") : null)
@(Model.IncludeData3.HasValue ? FormattableString.Invariant($"data3: {(Model.Data3.Value ? "true" : "false")},") : null)
@(Model.IncludeData4.HasValue ? FormattableString.Invariant($"data4: {Model.Data4},") : null)
@(Model.IncludeData5.HasValue ? FormattableString.Invariant($"data5: {Model.Data5},") : null)
@(Model.IncludeData6.HasValue ? FormattableString.Invariant($"data6: {(Model.Data6.Value ? "true" : "false")},") : null)
@(Model.IncludeData7.HasValue ? FormattableString.Invariant($"data7: {Model.Data7},") : null)
@(Model.IncludeData8.HasValue ? FormattableString.Invariant($"data8: {Model.Data8},") : null)
@(Model.IncludeData9.HasValue ? FormattableString.Invariant($"data9: {(Model.Data9.Value ? "true" : "false")},") : null)
@(Model.IncludeData10.HasValue ? FormattableString.Invariant($"data10: {Model.Data10},") : null)
@(Model.IncludeData11.HasValue ? FormattableString.Invariant($"data11: {(Model.Data11.Value ? "true" : "false")},") : null)
@(Model.IncludeData12.HasValue ? FormattableString.Invariant($"data12: {Model.Data12},") : null)
@(Model.IncludeData13.HasValue ? FormattableString.Invariant($"data13: {(Model.Data13.Value ? "true" : "false")},") : null)
@(Model.IncludeData14.HasValue ? FormattableString.Invariant($"data14: {(Model.Data14.Value ? "true" : "false")},") : null)
@(Model.IncludeData15.HasValue ? FormattableString.Invariant($"data15: {(Model.Data15.Value ? "true" : "false")},") : null)
@(Model.IncludeData16.HasValue ? FormattableString.Invariant($"data16: {(Model.Data16.Value ? "true" : "false")},") : null)
@(Model.IncludeData17.Length > 0 ? Html.Raw(FormattableString.Invariant($"static: {{ data1: {Json.Serialize(Model.Data1)}, data2: {Json.Serialize(Model.Data2)}, data3: {Json.Serialize(Model.Data3)}, data4: {Json.Serialize(Model.Data4)} }},")) : null)
}).start();
};
</script>
}

Просмотреть файл

@ -0,0 +1,54 @@
@page
@model Model
@{
ViewBag.Title = "This is a title";
ViewBag.HeaderTitle = "This is a header title";
ViewBag.HeaderBackground = "#003459";
ViewBag.HeaderForeground = "#FFFFFF";
if (Model.ChartName.Length == 0)
{
ViewBag.ShowChart = false;
}
}
@section Scripts {
<script type="text/javascript">
document.getElementById("form").onformdata = function(e) {
let formData = e.formData;
for (let [name, value] of Array.from(formData.entries())) {
if (value === '') {
formData.delete(name);
}
}
};
</script>
<script type="text/javascript">
window.onload = function() {
new Page({
connection: "no-connection",
urlOne: "@Request.PathBase/one",
urlTwo: "@Request.PathBase/two",
data: [@Html.Raw(string.Join(", ", Model.Data.Select(l => "\"" + l + "\"")))],
@(Model.IncludeData1.HasValue ? FormattableString.Invariant($"data1: {Model.Data1},") : null)
@(Model.IncludeData2.HasValue ? FormattableString.Invariant($"data2: {Model.Data2},") : null)
@(Model.IncludeData3.HasValue ? FormattableString.Invariant($"data3: {(Model.Data3.Value ? "true" : "false")},") : null)
@(Model.IncludeData4.HasValue ? FormattableString.Invariant($"data4: {Model.Data4},") : null)
@(Model.IncludeData5.HasValue ? FormattableString.Invariant($"data5: {Model.Data5},") : null)
@(Model.IncludeData6.HasValue ? FormattableString.Invariant($"data6: {(Model.Data6.Value ? "true" : "false")},") : null)
@(Model.IncludeData7.HasValue ? FormattableString.Invariant($"data7: {Model.Data7},") : null)
@(Model.IncludeData8.HasValue ? FormattableString.Invariant($"data8: {Model.Data8},") : null)
@(Model.IncludeData9.HasValue ? FormattableString.Invariant($"data9: {(Model.Data9.Value ? "true" : "false")},") : null)
@(Model.IncludeData10.HasValue ? FormattableString.Invariant($"data10: {Model.Data10},") : null)
@(Model.IncludeData11.HasValue ? FormattableString.Invariant($"data11: {(Model.Data11.Value ? "true" : "false")},") : null)
@(Model.IncludeData12.HasValue ? FormattableString.Invariant($"data12: {Model.Data12},") : null)
@(Model.IncludeData13.HasValue ? FormattableString.Invariant($"data13: {(Model.Data13.Value ? "true" : "false")},") : null)
@(Model.IncludeData14.HasValue ? FormattableString.Invariant($"data14: {(Model.Data14.Value ? "true" : "false")},") : null)
@(Model.IncludeData15.HasValue ? FormattableString.Invariant($"data15: {(Model.Data15.Value ? "true" : "false")},") : null)
@(Model.IncludeData16.HasValue ? FormattableString.Invariant($"data16: {(Model.Data16.Value ? "true" : "false")},") : null)
@(Model.IncludeData17.Length > 0 ? Html.Raw(FormattableString.Invariant($"static: {{ data1: {Json.Serialize(Model.Data1)}, data2: {Json.Serialize(Model.Data2)}, data3: {Json.Serialize(Model.Data3)}, data4: {Json.Serialize(Model.Data4)} }},")) : null)
}).start();
};
</script>
}