Skip to content

Commit

Permalink
Merge pull request #1720 from riganti/fix/unit-tests-vs
Browse files Browse the repository at this point in the history
Unit tests now work even in Visual Studio
  • Loading branch information
tomasherceg authored Oct 22, 2023
2 parents 09d893c + 62565f3 commit b64cf79
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 68 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.2" />
<PackageReference Include="MSTest.TestFramework" Version="2.2.10" />
<PackageReference Include="MSTest.TestAdapter" Version="2.2.10" />
<PackageReference Include="CheckTestOutput" Version="0.6.0" />
<PackageReference Include="CheckTestOutput" Version="0.6.3" />
<PackageReference Include="GitHubActionsTestLogger" Version="2.0.0" PrivateAssets="all" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.1" />
<PackageReference Include="MSTest.TestAdapter" Version="2.2.6" />
<PackageReference Include="MSTest.TestFramework" Version="2.2.3" />
<PackageReference Include="MSTest.TestFramework" Version="2.2.10" />
<PackageReference Include="MSTest.TestAdapter" Version="2.2.10" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.1.5" />
</ItemGroup>

Expand Down
3 changes: 1 addition & 2 deletions src/DotVVM.Crossplatform.slnf
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@
"Tracing\\ApplicationInsights.AspNetCore\\DotVVM.Tracing.ApplicationInsights.AspNetCore.csproj",
"Tracing\\ApplicationInsights\\DotVVM.Tracing.ApplicationInsights.csproj",
"Tracing\\MiniProfiler.AspNetCore\\DotVVM.Tracing.MiniProfiler.AspNetCore.csproj",
"Tracing\\MiniProfiler.Shared\\DotVVM.Tracing.MiniProfiler.Shared.shproj",
"Tracing\\MiniProfiler.Tests\\DotVVM.Tracing.MiniProfiler.Tests.csproj"
"Tracing\\MiniProfiler.Shared\\DotVVM.Tracing.MiniProfiler.Shared.shproj"
]
}
}
15 changes: 0 additions & 15 deletions src/DotVVM.sln
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DotVVM.Tracing.MiniProfiler
EndProject
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "DotVVM.Tracing.MiniProfiler.Shared", "Tracing\MiniProfiler.Shared\DotVVM.Tracing.MiniProfiler.Shared.shproj", "{407D8620-72C2-454C-945D-840130D80D0B}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DotVVM.Tracing.MiniProfiler.Tests", "Tracing\MiniProfiler.Tests\DotVVM.Tracing.MiniProfiler.Tests.csproj", "{5C30A2AD-1921-4E71-A449-BDC75F4017B5}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DotVVM.Tracing.ApplicationInsights.Owin", "Tracing\ApplicationInsights.Owin\DotVVM.Tracing.ApplicationInsights.Owin.csproj", "{9FD298FC-CB6D-4C61-B266-742B66F15A85}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DotVVM.Samples.ApplicationInsights.AspNetCore", "Samples\ApplicationInsights.AspNetCore\DotVVM.Samples.ApplicationInsights.AspNetCore.csproj", "{C988A081-663F-4F4B-9302-50735C07FD18}"
Expand Down Expand Up @@ -527,18 +525,6 @@ Global
{35F3D396-E702-4ACB-BE7E-301E52561559}.Release|x64.Build.0 = Release|Any CPU
{35F3D396-E702-4ACB-BE7E-301E52561559}.Release|x86.ActiveCfg = Release|Any CPU
{35F3D396-E702-4ACB-BE7E-301E52561559}.Release|x86.Build.0 = Release|Any CPU
{5C30A2AD-1921-4E71-A449-BDC75F4017B5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5C30A2AD-1921-4E71-A449-BDC75F4017B5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5C30A2AD-1921-4E71-A449-BDC75F4017B5}.Debug|x64.ActiveCfg = Debug|Any CPU
{5C30A2AD-1921-4E71-A449-BDC75F4017B5}.Debug|x64.Build.0 = Debug|Any CPU
{5C30A2AD-1921-4E71-A449-BDC75F4017B5}.Debug|x86.ActiveCfg = Debug|Any CPU
{5C30A2AD-1921-4E71-A449-BDC75F4017B5}.Debug|x86.Build.0 = Debug|Any CPU
{5C30A2AD-1921-4E71-A449-BDC75F4017B5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5C30A2AD-1921-4E71-A449-BDC75F4017B5}.Release|Any CPU.Build.0 = Release|Any CPU
{5C30A2AD-1921-4E71-A449-BDC75F4017B5}.Release|x64.ActiveCfg = Release|Any CPU
{5C30A2AD-1921-4E71-A449-BDC75F4017B5}.Release|x64.Build.0 = Release|Any CPU
{5C30A2AD-1921-4E71-A449-BDC75F4017B5}.Release|x86.ActiveCfg = Release|Any CPU
{5C30A2AD-1921-4E71-A449-BDC75F4017B5}.Release|x86.Build.0 = Release|Any CPU
{9FD298FC-CB6D-4C61-B266-742B66F15A85}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9FD298FC-CB6D-4C61-B266-742B66F15A85}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9FD298FC-CB6D-4C61-B266-742B66F15A85}.Debug|x64.ActiveCfg = Debug|Any CPU
Expand Down Expand Up @@ -770,7 +756,6 @@ Global
{C474EF4C-8D49-4983-8D20-5BEFF46F2A19} = {C68603A3-5E43-46CF-AE6C-1463BDDF7948}
{35F3D396-E702-4ACB-BE7E-301E52561559} = {C68603A3-5E43-46CF-AE6C-1463BDDF7948}
{407D8620-72C2-454C-945D-840130D80D0B} = {C68603A3-5E43-46CF-AE6C-1463BDDF7948}
{5C30A2AD-1921-4E71-A449-BDC75F4017B5} = {C68603A3-5E43-46CF-AE6C-1463BDDF7948}
{9FD298FC-CB6D-4C61-B266-742B66F15A85} = {C68603A3-5E43-46CF-AE6C-1463BDDF7948}
{C988A081-663F-4F4B-9302-50735C07FD18} = {DC6E006E-EE9D-481D-B94C-8A53331BCBC1}
{2ACC89F1-F7CA-4406-ACD7-3B62DE20686F} = {DC6E006E-EE9D-481D-B94C-8A53331BCBC1}
Expand Down
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
19 changes: 13 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
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

This file was deleted.

18 changes: 0 additions & 18 deletions src/Tracing/MiniProfiler.Tests/WidgetTests.cs

This file was deleted.

0 comments on commit b64cf79

Please sign in to comment.