Skip to content

Commit

Permalink
Remove test resources because we download them now on runtime
Browse files Browse the repository at this point in the history
  • Loading branch information
Luzifix committed Jul 19, 2024
1 parent c9b6bb7 commit 78773c1
Show file tree
Hide file tree
Showing 21 changed files with 96 additions and 183 deletions.
2 changes: 1 addition & 1 deletion Warcraft.NET.Tests/Files/ADT/Chunks/MVERTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace Warcraft.NET.Tests.Files.ADT.Chunks
[TestClass]
public class MVERTests
{
protected byte[] adt = File.ReadAllBytes("Resources/ADT/Northrend_37_25.adt");
protected byte[] adt = TestResource.Download(820891, "9.2.7.45746");

[TestMethod]
public void LoadBinaryData()
Expand Down
20 changes: 20 additions & 0 deletions Warcraft.NET.Tests/Files/TestResource.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using System.Net;

namespace Warcraft.NET.Tests.Files.ADT
{
internal class TestResource
{
/// <summary>
/// Thx to Wago for hosting the CASC API <3
/// </summary>
private const string BASE_URL_CASC_API = "https://wago.tools/api/casc";

internal static byte[] Download(uint fileId, string version)
{
#pragma warning disable SYSLIB0014
using (var client = new WebClient())
return client.DownloadData($"{BASE_URL_CASC_API}/{fileId}?download&version={version}");
#pragma warning restore SYSLIB0014
}
}
}
65 changes: 0 additions & 65 deletions Warcraft.NET.Tests/Files/Tests.cs

This file was deleted.

38 changes: 25 additions & 13 deletions Warcraft.NET.Tests/Files/WMO/Chunks/BfA/MOHDTests.cs
Original file line number Diff line number Diff line change
@@ -1,36 +1,48 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Warcraft.NET.Tests.Files.ADT;
using BfAWMO = Warcraft.NET.Files.WMO.WorldMapObject.BfA.WorldMapObjectRoot;

namespace Warcraft.NET.Tests.Files.WMO.Chunks.BfA
{
[TestClass]
public class MOHDTests
{
public BfAWMO BfAWMO;
public BfAWMO BfAWrittenWMO;

public MOHDTests()
{
// 8or_pvp_warsongbg_tower01.wmo
BfAWMO = new BfAWMO(TestResource.Download(2395014, "8.3.7.35662"));
BfAWrittenWMO = new BfAWMO(BfAWMO.Serialize());
}

[TestMethod]
public void TestLoadBinaryData()
{
Assert.AreEqual(Tests.BfAWMO.Header.Materials, Tests.BfAWrittenWMO.Header.Materials);
Assert.AreEqual(Tests.BfAWMO.Header.Portals, Tests.BfAWrittenWMO.Header.Portals);
Assert.AreEqual(Tests.BfAWMO.Header.Lights, Tests.BfAWrittenWMO.Header.Lights);
Assert.AreEqual(Tests.BfAWMO.Header.DoodadNames, Tests.BfAWrittenWMO.Header.DoodadNames);
Assert.AreEqual(Tests.BfAWMO.Header.DoodadDefinitions, Tests.BfAWrittenWMO.Header.DoodadDefinitions);
Assert.AreEqual(Tests.BfAWMO.Header.DoodadSets, Tests.BfAWrittenWMO.Header.DoodadSets);
Assert.AreEqual(Tests.BfAWMO.Header.Color, Tests.BfAWrittenWMO.Header.Color);
Assert.AreEqual(Tests.BfAWMO.Header.WMOId, Tests.BfAWrittenWMO.Header.WMOId);
Assert.AreEqual(Tests.BfAWMO.Header.BoundingBox, Tests.BfAWrittenWMO.Header.BoundingBox);
Assert.AreEqual(Tests.BfAWMO.Header.Flags, Tests.BfAWrittenWMO.Header.Flags);
Assert.AreEqual(Tests.BfAWMO.Header.Groups, Tests.BfAWrittenWMO.Header.Groups);
Assert.AreEqual(BfAWMO.Header.Materials, BfAWrittenWMO.Header.Materials);
Assert.AreEqual(BfAWMO.Header.Portals, BfAWrittenWMO.Header.Portals);
Assert.AreEqual(BfAWMO.Header.Lights, BfAWrittenWMO.Header.Lights);
Assert.AreEqual(BfAWMO.Header.DoodadNames, BfAWrittenWMO.Header.DoodadNames);
Assert.AreEqual(BfAWMO.Header.DoodadDefinitions, BfAWrittenWMO.Header.DoodadDefinitions);
Assert.AreEqual(BfAWMO.Header.DoodadSets, BfAWrittenWMO.Header.DoodadSets);
Assert.AreEqual(BfAWMO.Header.Color, BfAWrittenWMO.Header.Color);
Assert.AreEqual(BfAWMO.Header.WMOId, BfAWrittenWMO.Header.WMOId);
Assert.AreEqual(BfAWMO.Header.BoundingBox, BfAWrittenWMO.Header.BoundingBox);
Assert.AreEqual(BfAWMO.Header.Flags, BfAWrittenWMO.Header.Flags);
Assert.AreEqual(BfAWMO.Header.Groups, BfAWrittenWMO.Header.Groups);
}

[TestMethod]
public void TestGetSignature()
{
Assert.AreEqual(Tests.BfAWMO.Header.GetSignature(), Tests.BfAWrittenWMO.Header.GetSignature());
Assert.AreEqual(BfAWMO.Header.GetSignature(), BfAWrittenWMO.Header.GetSignature());
}

[TestMethod]
public void TestGetSize()
{
Assert.AreEqual(Tests.BfAWMO.Header.GetSize(), Tests.BfAWrittenWMO.Header.GetSize());
Assert.AreEqual(BfAWMO.Header.GetSize(), BfAWrittenWMO.Header.GetSize());
}
}
}
38 changes: 25 additions & 13 deletions Warcraft.NET.Tests/Files/WMO/Chunks/Legion/MOHDTests.cs
Original file line number Diff line number Diff line change
@@ -1,36 +1,48 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Warcraft.NET.Tests.Files.ADT;
using LegionWMO = Warcraft.NET.Files.WMO.WorldMapObject.Legion.WorldMapObjectRoot;

namespace Warcraft.NET.Tests.Files.WMO.Chunks.Legion
{
[TestClass]
public class MOHDTests
{
public LegionWMO LegionWMO;
public LegionWMO LegionWrittenWMO;

public MOHDTests()
{
// 7du_violethold_trapdoor_transport.wmo
LegionWMO = new LegionWMO(TestResource.Download(1326805, "7.3.5.26972"));
LegionWrittenWMO = new LegionWMO(LegionWMO.Serialize());
}

[TestMethod]
public void TestLoadBinaryData()
{
Assert.AreEqual(Tests.LegionWMO.Header.Materials, Tests.LegionWrittenWMO.Header.Materials);
Assert.AreEqual(Tests.LegionWMO.Header.Portals, Tests.LegionWrittenWMO.Header.Portals);
Assert.AreEqual(Tests.LegionWMO.Header.Lights, Tests.LegionWrittenWMO.Header.Lights);
Assert.AreEqual(Tests.LegionWMO.Header.DoodadNames, Tests.LegionWrittenWMO.Header.DoodadNames);
Assert.AreEqual(Tests.LegionWMO.Header.DoodadDefinitions, Tests.LegionWrittenWMO.Header.DoodadDefinitions);
Assert.AreEqual(Tests.LegionWMO.Header.DoodadSets, Tests.LegionWrittenWMO.Header.DoodadSets);
Assert.AreEqual(Tests.LegionWMO.Header.Color, Tests.LegionWrittenWMO.Header.Color);
Assert.AreEqual(Tests.LegionWMO.Header.WMOId, Tests.LegionWrittenWMO.Header.WMOId);
Assert.AreEqual(Tests.LegionWMO.Header.BoundingBox, Tests.LegionWrittenWMO.Header.BoundingBox);
Assert.AreEqual(Tests.LegionWMO.Header.Flags, Tests.LegionWrittenWMO.Header.Flags);
Assert.AreEqual(Tests.LegionWMO.Header.Groups, Tests.LegionWrittenWMO.Header.Groups);
Assert.AreEqual(LegionWMO.Header.Materials, LegionWrittenWMO.Header.Materials);
Assert.AreEqual(LegionWMO.Header.Portals, LegionWrittenWMO.Header.Portals);
Assert.AreEqual(LegionWMO.Header.Lights, LegionWrittenWMO.Header.Lights);
Assert.AreEqual(LegionWMO.Header.DoodadNames, LegionWrittenWMO.Header.DoodadNames);
Assert.AreEqual(LegionWMO.Header.DoodadDefinitions, LegionWrittenWMO.Header.DoodadDefinitions);
Assert.AreEqual(LegionWMO.Header.DoodadSets, LegionWrittenWMO.Header.DoodadSets);
Assert.AreEqual(LegionWMO.Header.Color, LegionWrittenWMO.Header.Color);
Assert.AreEqual(LegionWMO.Header.WMOId, LegionWrittenWMO.Header.WMOId);
Assert.AreEqual(LegionWMO.Header.BoundingBox, LegionWrittenWMO.Header.BoundingBox);
Assert.AreEqual(LegionWMO.Header.Flags, LegionWrittenWMO.Header.Flags);
Assert.AreEqual(LegionWMO.Header.Groups, LegionWrittenWMO.Header.Groups);
}

[TestMethod]
public void TestGetSignature()
{
Assert.AreEqual(Tests.LegionWMO.Header.GetSignature(), Tests.LegionWrittenWMO.Header.GetSignature());
Assert.AreEqual(LegionWMO.Header.GetSignature(), LegionWrittenWMO.Header.GetSignature());
}

[TestMethod]
public void TestGetSize()
{
Assert.AreEqual(Tests.LegionWMO.Header.GetSize(), Tests.LegionWrittenWMO.Header.GetSize());
Assert.AreEqual(LegionWMO.Header.GetSize(), LegionWrittenWMO.Header.GetSize());
}
}
}
38 changes: 25 additions & 13 deletions Warcraft.NET.Tests/Files/WMO/Chunks/WoD/MOHDTests.cs
Original file line number Diff line number Diff line change
@@ -1,36 +1,48 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Warcraft.NET.Tests.Files.ADT;
using WoDWMO = Warcraft.NET.Files.WMO.WorldMapObject.WoD.WorldMapObjectRoot;

namespace Warcraft.NET.Tests.Files.WMO.Chunks.WoD
{
[TestClass]
public class MOHDTests
{
public WoDWMO WoDWMO;
public WoDWMO WoDWrittenWMO;

public MOHDTests()
{
// duskwood_lumbermill.wmo
WoDWMO = new WoDWMO(TestResource.Download(106759, "6.2.4.21742"));
WoDWrittenWMO = new WoDWMO(WoDWMO.Serialize());
}

[TestMethod]
public void TestLoadBinaryData()
{
Assert.AreEqual(Tests.WoDWMO.Header.Materials, Tests.WoDWrittenWMO.Header.Materials);
Assert.AreEqual(Tests.WoDWMO.Header.Portals, Tests.WoDWrittenWMO.Header.Portals);
Assert.AreEqual(Tests.WoDWMO.Header.Lights, Tests.WoDWrittenWMO.Header.Lights);
Assert.AreEqual(Tests.WoDWMO.Header.DoodadNames, Tests.WoDWrittenWMO.Header.DoodadNames);
Assert.AreEqual(Tests.WoDWMO.Header.DoodadDefinitions, Tests.WoDWrittenWMO.Header.DoodadDefinitions);
Assert.AreEqual(Tests.WoDWMO.Header.DoodadSets, Tests.WoDWrittenWMO.Header.DoodadSets);
Assert.AreEqual(Tests.WoDWMO.Header.Color, Tests.WoDWrittenWMO.Header.Color);
Assert.AreEqual(Tests.WoDWMO.Header.WMOId, Tests.WoDWrittenWMO.Header.WMOId);
Assert.AreEqual(Tests.WoDWMO.Header.BoundingBox, Tests.WoDWrittenWMO.Header.BoundingBox);
Assert.AreEqual(Tests.WoDWMO.Header.Flags, Tests.WoDWrittenWMO.Header.Flags);
Assert.AreEqual(Tests.WoDWMO.Header.Groups, Tests.WoDWrittenWMO.Header.Groups);
Assert.AreEqual(WoDWMO.Header.Materials, WoDWrittenWMO.Header.Materials);
Assert.AreEqual(WoDWMO.Header.Portals, WoDWrittenWMO.Header.Portals);
Assert.AreEqual(WoDWMO.Header.Lights, WoDWrittenWMO.Header.Lights);
Assert.AreEqual(WoDWMO.Header.DoodadNames, WoDWrittenWMO.Header.DoodadNames);
Assert.AreEqual(WoDWMO.Header.DoodadDefinitions, WoDWrittenWMO.Header.DoodadDefinitions);
Assert.AreEqual(WoDWMO.Header.DoodadSets, WoDWrittenWMO.Header.DoodadSets);
Assert.AreEqual(WoDWMO.Header.Color, WoDWrittenWMO.Header.Color);
Assert.AreEqual(WoDWMO.Header.WMOId, WoDWrittenWMO.Header.WMOId);
Assert.AreEqual(WoDWMO.Header.BoundingBox, WoDWrittenWMO.Header.BoundingBox);
Assert.AreEqual(WoDWMO.Header.Flags, WoDWrittenWMO.Header.Flags);
Assert.AreEqual(WoDWMO.Header.Groups, WoDWrittenWMO.Header.Groups);
}

[TestMethod]
public void TestGetSignature()
{
Assert.AreEqual(Tests.WoDWMO.Header.GetSignature(), Tests.WoDWrittenWMO.Header.GetSignature());
Assert.AreEqual(WoDWMO.Header.GetSignature(), WoDWrittenWMO.Header.GetSignature());
}

[TestMethod]
public void TestGetSize()
{
Assert.AreEqual(Tests.WoDWMO.Header.GetSize(), Tests.WoDWrittenWMO.Header.GetSize());
Assert.AreEqual(WoDWMO.Header.GetSize(), WoDWrittenWMO.Header.GetSize());
}
}
}
36 changes: 0 additions & 36 deletions Warcraft.NET.Tests/Files/WMO/Chunks/Wotlk/MOHDTests.cs

This file was deleted.

Binary file removed Warcraft.NET.Tests/Resources/ADT/Northrend_37_25.adt
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
42 changes: 0 additions & 42 deletions Warcraft.NET.Tests/Warcraft.NET.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,46 +24,4 @@
<ProjectReference Include="..\Warcraft.NET\Warcraft.NET.csproj" />
</ItemGroup>

<ItemGroup>
<None Update="Resources\ADT\Northrend_37_25.adt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Resources\WMO\7du_violethold_trapdoor_transport.wmo">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Resources\WMO\7du_violethold_trapdoor_transport_000.wmo">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Resources\WMO\8or_pvp_warsongbg_tower01.wmo">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Resources\WMO\8or_pvp_warsongbg_tower01_000.wmo">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Resources\WMO\8or_pvp_warsongbg_tower01_000_lod1.wmo">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Resources\WMO\8or_pvp_warsongbg_tower01_000_lod2.wmo">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Resources\WMO\duskwood_lumbermill.wmo">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Resources\WMO\duskwood_lumbermill_000.wmo">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Resources\WMO\prisonHQ_Redridge.wmo">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Resources\WMO\prisonHQ_Redridge_000.wmo">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Resources\WMO\prisonHQ_Redridge_001.wmo">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Resources\WMO\prisonHQ_Redridge_002.wmo">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>

</Project>

0 comments on commit 78773c1

Please sign in to comment.