Beispiel #1
0
        public void Resize_Should_Resize_Width_To_Expected()
        {
            var expectedWidth    = 220;
            var actualDimensions = ImageResizeUtility.ResizeWidthMaintainAspectRatio(new Dimensions(300, 122), 220);

            Assert.AreEqual(expectedWidth, actualDimensions.Width);
        }
Beispiel #2
0
        public void Resize_Should_Maintain_AspectRatio_After_Width_Resize()
        {
            var expectedWidth  = 220;
            var originalHeight = 299;
            var originalWidth  = 214;

            var expectedAspectRatio = (float)originalWidth / (float)originalHeight;
            var actualDimensions    = ImageResizeUtility.ResizeWidthMaintainAspectRatio(new Dimensions(originalWidth, originalHeight), expectedWidth);

            Assert.AreEqual(expectedAspectRatio, actualDimensions.AspectRatio);
        }