Skip to content
This repository has been archived by the owner on Aug 7, 2022. It is now read-only.

Commit

Permalink
Created OMODExtractionTest
Browse files Browse the repository at this point in the history
  • Loading branch information
erri120 committed Nov 28, 2019
1 parent 915269e commit a405914
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 2 deletions.
46 changes: 46 additions & 0 deletions OMODFramework.Test/OMODExtractionTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
using System.Collections.Generic;
using System.Reflection;
using Alphaleonis.Win32.Filesystem;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace OMODFramework.Test
{
[TestClass]
public class OMODExtractionTest : ATest
{
public override HashSet<NexusFile> Files { get; set; } = new HashSet<NexusFile>
{
new NexusFile // https://www.nexusmods.com/oblivion/mods/15619
{
DownloadFileName = "Oblivion XP v415 - OMOD-15619.omod",
FileName = "Oblivion XP v415 - OMOD-15619.omod",
ModID = 15619,
FileID = 46662
},
};

[TestMethod]
public void TestExtraction()
{
OMODExtraction.Framework.TempDir = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "TestTempDir");

if (!Directory.Exists(OMODExtraction.Framework.TempDir))
Directory.CreateDirectory(OMODExtraction.Framework.TempDir);
else
OMODExtraction.Framework.CleanTempDir();

Files.Do(f =>
{
var omod = new OMODExtraction.OMOD(f.FileName);

Assert.IsNotNull(omod);

var data = omod.ExtractDataFiles();
var plugins = omod.ExtractPlugins();

Assert.IsTrue(string.IsNullOrWhiteSpace(data));
Assert.IsTrue(string.IsNullOrWhiteSpace(plugins));
});
}
}
}
5 changes: 5 additions & 0 deletions OMODFramework.Test/OMODFramework.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
<Compile Include="ATest.cs" />
<Compile Include="EndToEndTest.cs" />
<Compile Include="NexusFile.cs" />
<Compile Include="OMODExtractionTest.cs" />
<Compile Include="OMODTests.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ScriptFunctions.cs" />
Expand All @@ -87,6 +88,10 @@
<Project>{715a10c0-cac4-49b2-8a1d-0d6dd2e31f45}</Project>
<Name>OMODFramework</Name>
</ProjectReference>
<ProjectReference Include="..\OMODExtraction\OMODExtraction.csproj">
<Project>{7422e5ce-f7d8-4229-ace6-249231d8669c}</Project>
<Name>OMODExtraction</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
Expand Down
2 changes: 0 additions & 2 deletions OMODFramework.Test/OMODTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ public class OMODTests : ATest
}
};

public virtual bool DeleteOnFinish { get; set; } = true;

[TestMethod]
public void TestOMOD()
{
Expand Down

0 comments on commit a405914

Please sign in to comment.