Add DimensionTest to test project

A new test class, DimensionTest, is created and added to the test project. This class specifically tests the functionality of the Dimension object's validity and equality methods, thus enhancing our suite of unit tests.

Signed-off-by: Ivandro Jao <ivandrofly@gmail.com>
This commit is contained in:
Ivandro Jao 2024-04-30 13:10:10 +01:00
parent 6323937c30
commit 042dfa14e5
2 changed files with 35 additions and 0 deletions

View File

@ -0,0 +1,34 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Nikse.SubtitleEdit.Core.Common;
namespace Test.Logic
{
[TestClass]
public class DimensionTest
{
[TestMethod]
public void InvalidTest()
{
var dimension = new Dimension();
Assert.AreEqual(0, dimension.Width);
Assert.AreEqual(0, dimension.Height);
Assert.IsTrue(!dimension.IsValid());
}
[TestMethod]
public void ValidTest()
{
var dimension = new Dimension(10, 10);
Assert.IsTrue(dimension.IsValid());
}
[TestMethod]
public void EqualityTest()
{
var dimensionOne = new Dimension();
var dimensionTwo = new Dimension();
Assert.AreEqual(dimensionOne, dimensionTwo);
Assert.IsTrue(dimensionOne == dimensionTwo);
}
}
}

View File

@ -76,6 +76,7 @@
<Compile Include="Logic\BeautifyTimeCodesTest.cs" /> <Compile Include="Logic\BeautifyTimeCodesTest.cs" />
<Compile Include="Logic\ConvertColorsToDialogTest.cs" /> <Compile Include="Logic\ConvertColorsToDialogTest.cs" />
<Compile Include="Core\LanguageAutoDetectLanguagesTest.cs" /> <Compile Include="Core\LanguageAutoDetectLanguagesTest.cs" />
<Compile Include="Logic\DimensionTest.cs" />
<Compile Include="Logic\NetflixHelperTest.cs" /> <Compile Include="Logic\NetflixHelperTest.cs" />
<Compile Include="Logic\SubtitleFormats\EbuStlTest.cs" /> <Compile Include="Logic\SubtitleFormats\EbuStlTest.cs" />
<Compile Include="Logic\SubtitleFormats\NetflixTimedTextTest.cs" /> <Compile Include="Logic\SubtitleFormats\NetflixTimedTextTest.cs" />