Skip to content

Commit

Permalink
Merge pull request #19 from BoBoBaSs84/dependabot/nuget/MSTest.TestAd…
Browse files Browse the repository at this point in the history
…apter-3.1.1

Bump MSTest.TestAdapter from 2.2.8 to 3.1.1
  • Loading branch information
BoBoBaSs84 authored Sep 20, 2023
2 parents 29f68d8 + 0b982d2 commit 23622e7
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 29 deletions.
29 changes: 15 additions & 14 deletions tests/Shared.LibraryTests/Classes/Images/DDSImageTests.cs
Original file line number Diff line number Diff line change
@@ -1,26 +1,29 @@
using Shared.Library.Factories;
using Shared.Library.Interfaces;

using TC = Shared.LibraryTests.TestConstants;

namespace Shared.LibraryTests.Classes.Images;

[TestClass]
[SuppressMessage("Style", "IDE0058", Justification = "UnitTest")]
[DeploymentItem(TestConstants.DdsImage, TestConstants.SourceFolder)]
public class DDSImageTests
{
private readonly string _sourcePath;
private readonly string _targetPath;

public DDSImageTests()
{
Directory.CreateDirectory(TC.SourceFolder);
Directory.CreateDirectory(TC.TargetFolder);
_sourcePath = Path.Combine(AppContext.BaseDirectory, TestConstants.SourceFolder);
_targetPath = Path.Combine(AppContext.BaseDirectory, TestConstants.TargetFolder);

Directory.CreateDirectory(_sourcePath);
Directory.CreateDirectory(_targetPath);
}

[TestMethod]
[DeploymentItem(TC.DdsImage, TC.SourceFolder)]
public void SaveTest()
{
string sourceFolder = $"{TC.SourceFolder}\\{TC.DdsImage}";
string targetFolder = $"{TC.TargetFolder}\\{TC.PngImageSave}";
string sourceFolder = Path.Combine(_sourcePath, TestConstants.DdsImage);
string targetFolder = Path.Combine(_targetPath, TestConstants.PngImageSave);

IImage image = ImageFactory.CreateDdsImage(sourceFolder);
image.Save(targetFolder);
Expand All @@ -36,25 +39,23 @@ public void SaveTest()
}

[TestMethod]
[DeploymentItem(TC.DdsImage, TC.SourceFolder)]
[ExpectedException(typeof(ArgumentOutOfRangeException))]
public void SaveWithCompressionExceptionTest()
{
int compressionLevel = 99;
string sourceFolder = $"{TC.SourceFolder}\\{TC.DdsImage}";
string targetFolder = $"{TC.TargetFolder}\\{TC.PngImageSave}";
string sourceFolder = Path.Combine(_sourcePath, TestConstants.DdsImage);
string targetFolder = Path.Combine(_targetPath, TestConstants.PngImageSave);

IImage image = ImageFactory.CreateDdsImage(sourceFolder);
image.Save(targetFolder, compressionLevel);
}

[TestMethod]
[DeploymentItem(TC.DdsImage, TC.SourceFolder)]
public void SaveWithCompressionTest()
{
int compressionLevel = 9;
string sourceFolder = $"{TC.SourceFolder}\\{TC.DdsImage}";
string targetFolder = $"{TC.TargetFolder}\\{compressionLevel}_{TC.PngImageSave}";
string sourceFolder = Path.Combine(_sourcePath, TestConstants.DdsImage);
string targetFolder = Path.Combine(_targetPath, $"{compressionLevel}_{TestConstants.PngImageSave}");

IImage image = ImageFactory.CreateDdsImage(sourceFolder);
image.Save(targetFolder, compressionLevel);
Expand Down
32 changes: 18 additions & 14 deletions tests/Shared.LibraryTests/Classes/Images/PNGImageTests.cs
Original file line number Diff line number Diff line change
@@ -1,26 +1,30 @@
using Shared.Library.Factories;
using Shared.Library.Interfaces;

using TC = Shared.LibraryTests.TestConstants;

namespace Shared.LibraryTests.Classes.Images;

[TestClass]
[SuppressMessage("Style", "IDE0058", Justification = "UnitTest")]
[DeploymentItem(TestConstants.PngImage, TestConstants.SourceFolder)]
public class PNGImageTests
{
private readonly string _sourcePath;
private readonly string _targetPath;

public PNGImageTests()
{
Directory.CreateDirectory(TC.SourceFolder);
Directory.CreateDirectory(TC.TargetFolder);
_sourcePath = Path.Combine(AppContext.BaseDirectory, TestConstants.SourceFolder);
_targetPath = Path.Combine(AppContext.BaseDirectory, TestConstants.TargetFolder);

Directory.CreateDirectory(_sourcePath);
Directory.CreateDirectory(_targetPath);
}

[TestMethod]
[DeploymentItem(TC.PngImage, TC.SourceFolder)]
[DeploymentItem(TestConstants.PngImage, TestConstants.SourceFolder)]
public void SaveTest()
{
string sourceFolder = $"{TC.SourceFolder}\\{TC.PngImage}";
string targetFolder = $"{TC.TargetFolder}\\{TC.DdsImageSave}";
string sourceFolder = Path.Combine(_sourcePath, TestConstants.PngImage);
string targetFolder = Path.Combine(_targetPath, TestConstants.DdsImageSave);

IImage image = ImageFactory.CreatePngImage(sourceFolder);
image.Save(targetFolder);
Expand All @@ -36,25 +40,25 @@ public void SaveTest()
}

[TestMethod]
[DeploymentItem(TC.PngImage, TC.SourceFolder)]
[DeploymentItem(TestConstants.PngImage, TestConstants.SourceFolder)]
[ExpectedException(typeof(ArgumentOutOfRangeException))]
public void SaveWithCompressionExceptionTest()
{
int compressionLevel = 99;
string sourceFolder = $"{TC.SourceFolder}\\{TC.PngImage}";
string targetFolder = $"{TC.TargetFolder}\\{TC.DdsImageSave}";
string sourceFolder = Path.Combine(_sourcePath, TestConstants.PngImage);
string targetFolder = Path.Combine(_targetPath, TestConstants.DdsImageSave);

IImage image = ImageFactory.CreatePngImage(sourceFolder);
image.Save(targetFolder, compressionLevel);
}

[TestMethod]
[DeploymentItem(TC.PngImage, TC.SourceFolder)]
[DeploymentItem(TestConstants.PngImage, TestConstants.SourceFolder)]
public void SaveWithCompressionTest()
{
int compressionLevel = 0;
string sourceFolder = $"{TC.SourceFolder}\\{TC.PngImage}";
string targetFolder = $"{TC.TargetFolder}\\{compressionLevel}_{TC.DdsImageSave}";
string sourceFolder = Path.Combine(_sourcePath, TestConstants.PngImage);
string targetFolder = Path.Combine(_targetPath, $"{compressionLevel}_{TestConstants.DdsImageSave}");

IImage image = ImageFactory.CreatePngImage(sourceFolder);
image.Save(targetFolder, compressionLevel);
Expand Down
2 changes: 1 addition & 1 deletion tests/Shared.LibraryTests/Shared.LibraryTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.2" />
<PackageReference Include="MSTest.TestAdapter" Version="2.2.8" />
<PackageReference Include="MSTest.TestAdapter" Version="3.1.1" />
<PackageReference Include="MSTest.TestFramework" Version="3.1.1" />
<PackageReference Include="coverlet.collector" Version="6.0.0" />
</ItemGroup>
Expand Down

0 comments on commit 23622e7

Please sign in to comment.