ScreenshotCapturer MakeScreenshot Method Delta Engine Documentation

Namespace: DeltaEngine.Graphics
Assembly: DeltaEngine.Graphics (in DeltaEngine.Graphics.dll) Version: 1.1.1.0 (1.1.1)
Syntax

void MakeScreenshot(
	string fileName
)
Remarks

Tests: DeltaEngine.Graphics.Tests.ScreenshotCapturerTests
Examples

1 unit tests call DeltaEngine.Graphics.ScreenshotCapturer.MakeScreenshot(System.String)
[Test, CloseAfterFirstFrame]
public void MakeScreenshotOfYellowBackground()
{
    Resolve<Window>().BackgroundColor = Color.Yellow;
    new DrawingTests.Line(Vector2D.Zero, new Vector2D(1280, 720), Color.Red);
    RunAfterFirstFrame(() =>
    {
        var capturer = Resolve<ScreenshotCapturer>();
        capturer.MakeScreenshot(ScreenshotFileName);
        if (!StackTraceExtensions.StartedFromNCrunchOrNunitConsole)
            Process.Start(ScreenshotFileName); //ncrunch: no coverage 
        else if (capturer is MockScreenshotCapturer)
            Assert.AreEqual(ScreenshotFileName, (capturer as MockScreenshotCapturer).LastFilename);
    });
}
See Also