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

Commit

Permalink
Migrated the Unit test to PackageReference and remove AlphaFS
Browse files Browse the repository at this point in the history
  • Loading branch information
erri120 committed Feb 14, 2020
1 parent 9ed8882 commit e2ece88
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 57 deletions.
2 changes: 0 additions & 2 deletions OMODFramework.Test/ATest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@
using ICSharpCode.SharpZipLib.Zip;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Pathoschild.FluentNexus;
using File = Alphaleonis.Win32.Filesystem.File;
using Path = Alphaleonis.Win32.Filesystem.Path;

namespace OMODFramework.Test
{
Expand Down
23 changes: 18 additions & 5 deletions OMODFramework.Test/CompressionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,10 @@
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using Alphaleonis.Win32.Security;
using System.Runtime.InteropServices;
using System.Security.Cryptography;
using ICSharpCode.SharpZipLib.Zip;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using File = Alphaleonis.Win32.Filesystem.File;
using Path = Alphaleonis.Win32.Filesystem.Path;

namespace OMODFramework.Test
{
Expand Down Expand Up @@ -61,8 +60,22 @@ public void TestWriteStreamToZip()
zf.GetInputStream(zf.GetEntry("hello.txt")).CopyTo(fs);
}

Assert.AreEqual(File.GetSize("hello.txt"), File.GetSize("hello_out.txt"));
Assert.AreEqual(File.GetHash("hello.txt", HashType.CRC32), File.GetHash("hello_out.txt", HashType.CRC32));
byte[] hash1;
byte[] hash2;

using (var md5 = MD5.Create())
{
using (var stream = File.OpenRead("hello.txt"))
hash1 = md5.ComputeHash(stream);
using (var stream = File.OpenRead("hello_out.txt"))
hash2 = md5.ComputeHash(stream);
}

var f1 = new FileInfo("hello.txt");
var f2 = new FileInfo("hello_out.txt");

Assert.AreEqual(hash1, hash2);
Assert.AreEqual(f1.Length, f2.Length);
}

[TestMethod]
Expand Down
3 changes: 0 additions & 3 deletions OMODFramework.Test/EndToEndTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@
using System.Reflection;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using OMODFramework.Scripting;
using Directory = Alphaleonis.Win32.Filesystem.Directory;
using File = Alphaleonis.Win32.Filesystem.File;
using Path = Alphaleonis.Win32.Filesystem.Path;

namespace OMODFramework.Test
{
Expand Down
46 changes: 12 additions & 34 deletions OMODFramework.Test/OMODFramework.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -39,33 +39,9 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="AlphaFS, Version=2.2.0.0, Culture=neutral, PublicKeyToken=4d31a58f7d7ad5c9, processorArchitecture=MSIL">
<HintPath>$(SolutionDir)\packages\AlphaFS.2.2.6\lib\net452\AlphaFS.dll</HintPath>
</Reference>
<Reference Include="FluentNexus, Version=0.8.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>$(SolutionDir)\packages\Pathoschild.FluentNexus.0.8.0\lib\net471\FluentNexus.dll</HintPath>
</Reference>
<Reference Include="ICSharpCode.SharpZipLib, Version=1.2.0.246, Culture=neutral, PublicKeyToken=1b03e6acf1164f73, processorArchitecture=MSIL">
<HintPath>$(SolutionDir)\packages\SharpZipLib.1.2.0\lib\net45\ICSharpCode.SharpZipLib.dll</HintPath>
</Reference>
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>$(SolutionDir)\packages\MSTest.TestFramework.2.0.0\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll</HintPath>
</Reference>
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>$(SolutionDir)\packages\MSTest.TestFramework.2.0.0\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>$(SolutionDir)\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="Pathoschild.Http.Client, Version=3.3.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>$(SolutionDir)\packages\Pathoschild.Http.FluentClient.3.3.1\lib\net45\Pathoschild.Http.Client.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Net.Http.Formatting, Version=5.2.7.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>$(SolutionDir)\packages\Microsoft.AspNet.WebApi.Client.5.2.7\lib\net45\System.Net.Http.Formatting.dll</HintPath>
</Reference>
<Reference Include="System.Transactions" />
</ItemGroup>
<ItemGroup>
Expand All @@ -81,28 +57,30 @@
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="$(SolutionDir)\OMODFramework\OMODFramework.csproj">
<Project>{715a10c0-cac4-49b2-8a1d-0d6dd2e31f45}</Project>
<Name>OMODFramework</Name>
</ProjectReference>
<ProjectReference Include="..\OMODFramework.Scripting\OMODFramework.Scripting.csproj">
<ProjectReference Include="$(SolutionDir)\OMODFramework.Scripting\OMODFramework.Scripting.csproj">
<Project>{f53b7974-2131-4907-b503-80562ea3dd39}</Project>
<Name>OMODFramework.Scripting</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<PackageReference Include="MSTest.TestAdapter">
<Version>2.1.0</Version>
</PackageReference>
<PackageReference Include="MSTest.TestFramework">
<Version>2.1.0</Version>
</PackageReference>
<PackageReference Include="Pathoschild.FluentNexus">
<Version>0.8.0</Version>
</PackageReference>
</ItemGroup>
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('$(SolutionDir)\packages\MSTest.TestAdapter.2.0.0\build\net45\MSTest.TestAdapter.props')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\packages\MSTest.TestAdapter.2.0.0\build\net45\MSTest.TestAdapter.props'))" />
<Error Condition="!Exists('$(SolutionDir)\packages\MSTest.TestAdapter.2.0.0\build\net45\MSTest.TestAdapter.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\packages\MSTest.TestAdapter.2.0.0\build\net45\MSTest.TestAdapter.targets'))" />
</Target>
<Import Project="$(SolutionDir)\packages\MSTest.TestAdapter.2.0.0\build\net45\MSTest.TestAdapter.targets" Condition="Exists('$(SolutionDir)\packages\MSTest.TestAdapter.2.0.0\build\net45\MSTest.TestAdapter.targets')" />
<PropertyGroup>
<PostBuildEvent>xcopy /s/e /y $(ProjectDir)omod_files $(ProjectDir)$(OutDir).</PostBuildEvent>
</PropertyGroup>
Expand Down
2 changes: 0 additions & 2 deletions OMODFramework.Test/OMODTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
using System.Collections.Generic;
using System.IO;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using File = Alphaleonis.Win32.Filesystem.File;
using Path = Alphaleonis.Win32.Filesystem.Path;

namespace OMODFramework.Test
{
Expand Down
11 changes: 0 additions & 11 deletions OMODFramework.Test/packages.config

This file was deleted.

0 comments on commit e2ece88

Please sign in to comment.