Browse Source

Add LocalImageFile tests

pull/240/head
Ionite 1 year ago
parent
commit
a04ef6e8c4
No known key found for this signature in database
  1. 33
      StabilityMatrix.Tests/Models/LocalImageFileTests.cs

33
StabilityMatrix.Tests/Models/LocalImageFileTests.cs

@ -0,0 +1,33 @@
using StabilityMatrix.Core.Models;
using StabilityMatrix.Core.Models.Database;
namespace StabilityMatrix.Tests.Models;
[TestClass]
public class LocalImageFileTests
{
[TestMethod]
public void TestComparer()
{
var comparer = LocalImageFile.Comparer;
var file1 = new LocalImageFile
{
AbsolutePath = "same",
GenerationParameters = new GenerationParameters { Width = 10 }
};
var file2 = new LocalImageFile
{
AbsolutePath = "same",
GenerationParameters = new GenerationParameters { Width = 10 }
};
var file3 = new LocalImageFile { AbsolutePath = "different" };
Assert.IsTrue(comparer.Equals(file1, file2));
Assert.AreEqual(comparer.GetHashCode(file1), comparer.GetHashCode(file2));
Assert.IsFalse(comparer.Equals(file1, file3));
Assert.AreNotEqual(comparer.GetHashCode(file1), comparer.GetHashCode(file3));
}
}
Loading…
Cancel
Save