Skip to content

Commit

Permalink
Fixed unit tests to run in the order used in VS
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasherceg committed Oct 22, 2023
1 parent 9b3a689 commit 3734023
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ static class DotvvmPropertySerializableList
{
public static SortedDictionary<string, SortedDictionary<string, DotvvmPropertyInfo>> Properties =>
DotvvmProperty.AllProperties
.Where(p => !p.DeclaringType.Assembly.IsDynamic)
.Where(p => p is not DotvvmCapabilityProperty)
.Select(p =>
new {
Expand Down Expand Up @@ -46,6 +47,7 @@ static class DotvvmPropertySerializableList

public static SortedDictionary<string, SortedDictionary<string, DotvvmPropertyInfo>> Capabilities =>
DotvvmProperty.AllProperties
.Where(p => !p.DeclaringType.Assembly.IsDynamic)
.OfType<DotvvmCapabilityProperty>()
.Select(p =>
new {
Expand All @@ -65,6 +67,7 @@ static class DotvvmPropertySerializableList

public static SortedDictionary<string, SortedDictionary<string, DotvvmPropertyGroupInfo>> PropertyGroups =>
DotvvmPropertyGroup.AllGroups
.Where(p => !p.DeclaringType.Assembly.IsDynamic)
.Select(p =>
new {
declaringType = p.DeclaringType,
Expand All @@ -91,7 +94,7 @@ static class DotvvmPropertySerializableList
public static SortedDictionary<string, DotvvmControlInfo> GetControls(CompiledAssemblyCache assemblies)
{
var result = new SortedDictionary<string, DotvvmControlInfo>(StringComparer.OrdinalIgnoreCase);
foreach (var a in assemblies.GetAllAssemblies())
foreach (var a in assemblies.GetAllAssemblies().Where(a => !a.IsDynamic))
{
foreach (var c in a.GetLoadableTypes())
{
Expand Down
20 changes: 14 additions & 6 deletions src/Tests/Binding/JavascriptCompilationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,17 +63,24 @@ public string CompileBinding(Func<Dictionary<string, Expression>, Expression> ex
[DataRow("'Local' == _this", "\"Local\"==$data")]
[DataRow("_this == 2", "$data==\"Local\"")]
[DataRow("2 == _this", "\"Local\"==$data")]
[DataRow("_this & 'Local'", "dotvvm.translations.enums.fromInt(dotvvm.translations.enums.toInt($data,\"G0/GAE51KlQlMR5T\")&2,\"G0/GAE51KlQlMR5T\")")]
[DataRow("'Local' & _this", "dotvvm.translations.enums.fromInt(2&dotvvm.translations.enums.toInt($data,\"G0/GAE51KlQlMR5T\"),\"G0/GAE51KlQlMR5T\")")]
[DataRow("_this | 'Local'", "dotvvm.translations.enums.fromInt(dotvvm.translations.enums.toInt($data,\"G0/GAE51KlQlMR5T\")|2,\"G0/GAE51KlQlMR5T\")")]
[DataRow("_this & 1", "dotvvm.translations.enums.fromInt(dotvvm.translations.enums.toInt($data,\"G0/GAE51KlQlMR5T\")&1,\"G0/GAE51KlQlMR5T\")")]
[DataRow("1 & _this", "dotvvm.translations.enums.fromInt(1&dotvvm.translations.enums.toInt($data,\"G0/GAE51KlQlMR5T\"),\"G0/GAE51KlQlMR5T\")")]
[DataRow("_this & 'Local'", "dotvvm.translations.enums.fromInt(dotvvm.translations.enums.toInt($data,\"bmCpvOUHn4NxUNdc\")&2,\"bmCpvOUHn4NxUNdc\")")]
[DataRow("'Local' & _this", "dotvvm.translations.enums.fromInt(2&dotvvm.translations.enums.toInt($data,\"bmCpvOUHn4NxUNdc\"),\"bmCpvOUHn4NxUNdc\")")]
[DataRow("_this | 'Local'", "dotvvm.translations.enums.fromInt(dotvvm.translations.enums.toInt($data,\"bmCpvOUHn4NxUNdc\")|2,\"bmCpvOUHn4NxUNdc\")")]
[DataRow("_this & 1", "dotvvm.translations.enums.fromInt(dotvvm.translations.enums.toInt($data,\"bmCpvOUHn4NxUNdc\")&1,\"bmCpvOUHn4NxUNdc\")")]
[DataRow("1 & _this", "dotvvm.translations.enums.fromInt(1&dotvvm.translations.enums.toInt($data,\"bmCpvOUHn4NxUNdc\"),\"bmCpvOUHn4NxUNdc\")")]
public void JavascriptCompilation_EnumOperators(string expr, string expectedJs)
{
var js = CompileBinding(expr, typeof(DateTimeKind));
var js = CompileBinding(expr, typeof(OurDateTimeKind));
Assert.AreEqual(expectedJs, js);
}

enum OurDateTimeKind
{
Unspecified = 0,
Utc = 1,
Local = 2,
}

[DataTestMethod]
[DataRow("StringProp + StringProp", "(StringProp()??\"\")+(StringProp()??\"\")")]
[DataRow("StringProp + null", "StringProp()??\"\"")]
Expand Down Expand Up @@ -1282,6 +1289,7 @@ public void JavascriptCompilation_ApiRefreshOn()
[TestMethod]
public void JavascriptCompilation_MarkupControlProperty()
{
_ = TestMarkupControl.SomePropertyProperty;
var dataContext = bindingHelper.CreateDataContext(new [] { typeof(object) }, markupControl: typeof(TestMarkupControl));
var result = bindingHelper.ValueBindingToJs("_control.SomeProperty + 'aa'", dataContext, niceMode: false);
Assert.AreEqual("($control.SomeProperty()??\"\")+\"aa\"", result);
Expand Down
2 changes: 1 addition & 1 deletion src/Tests/DotVVM.Framework.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net6.0'">
<ProjectReference Include="../Framework/Hosting.AspNetCore/DotVVM.Framework.Hosting.AspNetCore.csproj" />
<PackageReference Include="CheckTestOutput" Version="0.5.1" />
<PackageReference Include="CheckTestOutput" Version="0.6.3" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="AngleSharp" Version="0.17.0" />
Expand Down

0 comments on commit 3734023

Please sign in to comment.