public async Task RendererCreatesNecessaryDirectories() { var input = await SvgUtilities.CreateTempImage(); var output = Path.Combine( Path.GetDirectoryName(input), Guid.NewGuid().ToString(), Path.ChangeExtension(Path.GetFileNameWithoutExtension(input), ".png")); Renderer.Render(input, output); }
public async Task SvgBuildTaskThrowsArgumentExceptionIfOnlyOneDimensionIfDefined() { var path = await SvgUtilities.CreateTempImage(); var output = Path.ChangeExtension(Path.GetTempFileName(), "png"); var task = new SvgBuildTask { InputPath = path, OutputPath = output, Width = "123" }; Assert.Throws <ArgumentException>(() => task.Execute()); }
private async Task AssertRenderedImageFormat(string outputFileExtension, ImageFormat format) { var input = await SvgUtilities.CreateTempImage(); var output = Path.ChangeExtension(Path.GetTempFileName(), outputFileExtension); Renderer.Render(input, output); var image = Image.FromFile(output); Assert.Equal(format, image.RawFormat); }
public async Task SavedImageHasRequiredSize() { var input = await SvgUtilities.CreateTempImage(); var output = Path.ChangeExtension(Path.GetTempFileName(), "png"); var size = new Size(32, 32); Renderer.Render(input, output, size); var image = Image.FromFile(output); Assert.Equal(size, image.Size); }
public async Task SvgBuildTaskRendersTheProperSize() { var path = await SvgUtilities.CreateTempImage(); var output = Path.ChangeExtension(Path.GetTempFileName(), "png"); var task = new SvgBuildTask { InputPath = path, OutputPath = output, Width = "32", Height = "32" }; Assert.True(task.Execute()); var image = Image.FromFile(output); Assert.Equal(32, image.Width); Assert.Equal(32, image.Height); }
public async Task SvgBuildTaskRendersTheFileWithDefaultSize() { var path = await SvgUtilities.CreateTempImage(); var output = Path.ChangeExtension(Path.GetTempFileName(), "png"); var task = new SvgBuildTask { InputPath = path, OutputPath = output }; Assert.True(task.Execute()); var image = Image.FromFile(output); Assert.IsType <Bitmap>(image); Assert.Equal(101, image.Height); Assert.Equal(101, image.Width); }