private void AssertContainsIconSize(string fullImagePath, int expectedSize)
        {
            ImageInfo info = _imageResizer.GetInfo(fullImagePath);

            Assert.AreEqual(expectedSize, info.Height);
            Assert.AreEqual(expectedSize, info.Width);
        }
Exemplo n.º 2
0
        public void TestResize()
        {
            const int    scaleFactor = 4;
            ImageResizer resizer     = new ImageResizer();

            ImageInfo info = resizer.GetInfo(TestImage);

            int expectedWidth  = info.Width / scaleFactor;
            int expectedHeight = info.Height / scaleFactor;

            resizer.Resize(TestImage, DestinationImage, expectedWidth, expectedHeight);

            ImageInfo resizedInfo = resizer.GetInfo(DestinationImage);

            Assert.AreEqual(expectedWidth, resizedInfo.Width);
            Assert.AreEqual(expectedHeight, resizedInfo.Height);
        }
Exemplo n.º 3
0
        private void AssertContainsIconSize(int expectedSize, string folderPath, string iconName)
        {
            string fullImagePath = Path.Combine(folderPath, iconName);

            Assert.True(File.Exists(fullImagePath));

            ImageInfo info = _imageResizer.GetInfo(fullImagePath);

            Assert.AreEqual(expectedSize, info.Height);
            Assert.AreEqual(expectedSize, info.Width);

            string jsonContentsPath = Path.Combine(folderPath, "Contents.json");

            string jsonContent = File.ReadAllText(jsonContentsPath);

            Assert.True(jsonContent.Contains(iconName));
        }