Add test for Convert-AspectRatio

pull/33/head
Pat Hartl 2023-11-16 15:36:45 -06:00
parent e723a5345b
commit 7649e63195
1 changed files with 28 additions and 0 deletions

View File

@ -32,5 +32,33 @@ namespace LANCommander.PowerShell.Tests
Assert.AreEqual(1, encodingResults.Count); Assert.AreEqual(1, encodingResults.Count);
Assert.AreEqual(testPhrase, decodingResults.First()); Assert.AreEqual(testPhrase, decodingResults.First());
} }
[TestMethod]
[DataRow(640, 480, 640, 360, 16, 9)]
[DataRow(1024, 768, 1024, 576, 16, 9)]
[DataRow(1600, 1200, 1600, 900, 16, 9)]
[DataRow(1920, 1080, 1440, 1080, 4, 3)]
[DataRow(1366, 1024, 1024, 768, 4, 3)]
[DataRow(854, 480, 640, 480, 4, 3)]
public void ConvertAspectRatioShouldReturnCorrectBounds(int x1, int y1, int x2, int y2, int ratioX, int ratioY)
{
var aspectRatio = (double)ratioX / (double)ratioY;
var cmdlet = new ConvertAspectRatioCmdlet()
{
AspectRatio = aspectRatio,
Width = x1,
Height = y1
};
var output = cmdlet.Invoke().OfType<DisplayResolution>().ToList();
Assert.AreEqual(1, output.Count);
var bounds = output.First();
Assert.AreEqual(x2, bounds.Width);
Assert.AreEqual(y2, bounds.Height);
}
} }
} }