示例#1
0
        public Bitmap GetScreenshot(long testId, ScreenshotType screenshotType)
        {
            var testResult    = this.testRepository.Get(testId);
            var patternBitmap = testResult.Pattern.PatternScreenshot.Image.ToBitmap();

            switch (screenshotType)
            {
            case ScreenshotType.Pattern:
                return(patternBitmap);

            case ScreenshotType.Error:
            {
                var errorBitmap = testResult.ErrorScreenshot.ToBitmap();
                return(ImageHelpers.CreateImageDiff(patternBitmap, errorBitmap, testResult.BlindRegionsSnapshot.AsReadonly()));
            }

            case ScreenshotType.Diff:
            {
                var errorBitmap = testResult.ErrorScreenshot.ToBitmap();
                return(ImageHelpers.CreateImagesXor(patternBitmap, errorBitmap, testResult.BlindRegionsSnapshot.AsReadonly()));
            }

            default:
                throw new ArgumentOutOfRangeException("screenshotType", screenshotType, null);
            }
        }