コード例 #1
0
        public void Resize_IgnoreSmallerImage()
        {
            using var bitmap = new Bitmap(5, 10);

            var testResult = ImageResizer.MaintainRatio(bitmap, 100);

            Assert.AreEqual(5, testResult.Width);
            Assert.AreEqual(10, testResult.Height);
        }
コード例 #2
0
        public void Resize_IgnoreInvalidRequest()
        {
            using var bitmap = new Bitmap(10, 100);

            var testResult = ImageResizer.MaintainRatio(bitmap, 9); //Can't maintain ratio with these parameters

            Assert.AreEqual(10, testResult.Width);
            Assert.AreEqual(100, testResult.Height);
        }
コード例 #3
0
        public void Resize_MaintainsRatio()
        {
            using var bitmap = new Bitmap(500, 1000);

            var testResult = ImageResizer.MaintainRatio(bitmap, 100);

            Assert.AreEqual(50, testResult.Width);
            Assert.AreEqual(100, testResult.Height);
        }
コード例 #4
0
        public void Resize_NullReturnsNull()
        {
            var testResult = ImageResizer.MaintainRatio(null, 100);

            Assert.IsNull(testResult);
        }