public void The_dimensions_of_the_resulting_image_equal_the_specified_dimensions_if_the_image_dimensions_are_bigger_than_the_specified_ones() { Image image = Resizer .CreateImageFrom(ImageBytes300x200, ImageFormat.Png) .CropFrom <Center>(75, 60) .CreateImage(); image.Width.Should().Equal(75); image.Height.Should().Equal(60); }
public void The_dimensions_of_the_resulting_image_equal_the_image_dimensions_if_the_image_dimensions_are_smaller_than_the_specified_ones() { Image image = Resizer .CreateImageFrom(IconBytes16x16, ImageFormat.Png) .CropFrom <Center>(75, 60) .CreateImage(); image.Width.Should().Equal(16); image.Height.Should().Equal(16); }
public void The_image_property_items_are_retained() { using (var memoryStream = new MemoryStream(ImageBytes300x200)) { var image = Image.FromStream(memoryStream); var imageToResize = Resizer.CreateImageFrom(ImageBytes200x300, ImageFormat.Png); var resizedImage = imageToResize.ResizeTo <Fill>(100, 200).CreateImage(); MakeSureAllPropertyItemsArePresent(image, resizedImage); } }
public void The_resulting_dimensions_are_calculated_correctly_for_a_portrait_image(int viewportWidth, int viewportHeight, int expectedImageWidth, int expectedImageHeight) { var resizedImage = Resizer .CreateImageFrom(ImageBytes200x300, ImageFormat.Png) .ResizeTo <Fit>(viewportWidth, viewportHeight) .CreateImage(); resizedImage.Width.Should().Equal(expectedImageWidth); resizedImage.Height.Should().Equal(expectedImageHeight); }
public void The_resulting_image_dimensions_equal_the_specified_ones(int width, int height) { var landscapeImage = Resizer.CreateImageFrom(ImageBytes300x200, ImageFormat.Png).ResizeTo <Fill>(width, height).CreateImage(); landscapeImage.Size.Should().Equal(new Size { Width = width, Height = height }); var portraitImage = Resizer.CreateImageFrom(ImageBytes200x300, ImageFormat.Png).ResizeTo <Fill>(width, height).CreateImage(); portraitImage.Size.Should().Equal(new Size { Width = width, Height = height }); }