Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/Blocktavius.AppDQB2/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System.Runtime.CompilerServices;
using System.Windows;

[assembly: ThemeInfo(
Expand All @@ -8,3 +9,5 @@
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]

[assembly: InternalsVisibleTo("Blocktavius.AppDQB2Tests")]
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,11 @@ private static IEnumerable<HillDesignerType> DiscoverHillDesignerTypes() =>

private static IEnumerable<(Type type, TAttr attr)> DiscoverTypes<TAttr>(Type interfaceType) where TAttr : System.Attribute
{
// Filter out Microsoft to avoid this error in unit tests:
// Could not load file or assembly 'Microsoft.Build.Utilities.Core, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
// See also https://github.com/microsoft/testfx/issues/2609
var types = AppDomain.CurrentDomain.GetAssemblies()
.Where(a => a.FullName?.StartsWith("Microsoft") == false)
.SelectMany(asm => asm.GetTypes())
.Where(t => t.IsClass && !t.IsAbstract && interfaceType.IsAssignableFrom(t))
.ToList();
Expand Down
19 changes: 19 additions & 0 deletions src/Blocktavius.AppDQB2Tests/Blocktavius.AppDQB2Tests.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<Project Sdk="MSTest.Sdk/3.6.4">

<PropertyGroup>
<TargetFramework>net9.0-windows7.0</TargetFramework>
<LangVersion>latest</LangVersion>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<!--
Displays error on console in addition to the log file. Note that this feature comes with a performance impact.
For more information, visit https://learn.microsoft.com/dotnet/core/testing/unit-testing-platform-integration-dotnet-test#show-failure-per-test
-->
<TestingPlatformShowTestsFailure>true</TestingPlatformShowTestsFailure>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\Blocktavius.AppDQB2\Blocktavius.AppDQB2.csproj" />
</ItemGroup>

</Project>
1 change: 1 addition & 0 deletions src/Blocktavius.AppDQB2Tests/MSTestSettings.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[assembly: Parallelize(Scope = ExecutionScope.MethodLevel)]
54 changes: 54 additions & 0 deletions src/Blocktavius.AppDQB2Tests/Test1.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
using Blocktavius.AppDQB2.Persistence.V1;

namespace Blocktavius.AppDQB2Tests;

[TestClass]
public sealed class Test1
{
[TestMethod]
public void TestMethod1()
{
const string json =
"""
{
"ProfileVerificationHash": "SwsLltjL\u002B/NQCgJQGj9kgJhDXTrXlTXHz7cI/fgxuII=",
"SourceSlot": {
"SlotNumber": 3,
"SlotName": "Slot 3 (B02)"
},
"DestSlot": {
"SlotNumber": 1,
"SlotName": "Slot 1 (B00)"
},
"SourceStgdatFilename": "STGDAT16.BIN",
"ChunkExpansion": [],
"Notes": "",
"Images": [],
"MinimapVisible": true,
"ChunkGridVisible": true,
"Scripts": [
{
"ScriptName": "Script 1",
"ScriptNodes": [
{
"$type": "bad discriminator",
"Elevation": 74,
"HillDesigner": {
"$type": "WinsomeHill-4380",
"Steepness": 2
},
"AreaPersistId": "IMG:export\\plateaus\\p1.png",
"BlockPersistId": "BLK:12",
"LockRandomSeed": false
}
]
}
],
"SelectedScriptIndex": 11
}
""";

var project = ProjectV1.Load(json);
Assert.IsNotNull(project);
}
}
6 changes: 6 additions & 0 deletions src/Blocktavius.sln
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Antipasta", "Antipasta\Antipasta.csproj", "{098197E3-A33F-4D06-B6ED-FA61032DE307}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Blocktavius.AppDQB2Tests", "Blocktavius.AppDQB2Tests\Blocktavius.AppDQB2Tests.csproj", "{DA50C9A5-B158-4162-9C81-DB1086B55D16}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -44,6 +46,10 @@ Global
{098197E3-A33F-4D06-B6ED-FA61032DE307}.Debug|Any CPU.Build.0 = Debug|Any CPU
{098197E3-A33F-4D06-B6ED-FA61032DE307}.Release|Any CPU.ActiveCfg = Release|Any CPU
{098197E3-A33F-4D06-B6ED-FA61032DE307}.Release|Any CPU.Build.0 = Release|Any CPU
{DA50C9A5-B158-4162-9C81-DB1086B55D16}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DA50C9A5-B158-4162-9C81-DB1086B55D16}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DA50C9A5-B158-4162-9C81-DB1086B55D16}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DA50C9A5-B158-4162-9C81-DB1086B55D16}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down