示例#1
0
        public static void Init(VisualAssertionsConfig config)
        {
            if (config == null)
            {
                throw new ArgumentNullException(nameof(config));
            }

            if (config.ScreenshotComparisonStrategy == null)
            {
                throw new InvalidOperationException($"{nameof(config.ScreenshotComparisonStrategy)} must be specified");
            }

            var testOutputWriter   = config.TestOutputWriter ?? Console.WriteLine;
            var testRunnerAdapter  = TestRunnerAdapterFactory.CreateForCurrentEnvironment(testOutputWriter);
            var sessionContext     = PersistanceEngine.GetSessionContext();
            var projectRepository  = new Repository <Project>(sessionContext);
            var comparisonStrategy = config.ScreenshotComparisonStrategy;

            _visualAssertionsService?.Dispose();
            _visualAssertionsService = new VisualAssertionsService(projectRepository, testRunnerAdapter, config.ProcessScreenshotsAsynchronously, comparisonStrategy)
            {
                ProjectName        = config.ProjectName,
                ScreenshotCategory = config.ScreenshotCategory,
                BrowserName        = config.BrowserName
            };
        }
        private void Init(VisualAssertionsConfig config)
        {
            var sessionContext    = PersistanceEngine.GetSessionContext();
            var projectRepository = new Repository <Project>(sessionContext);

            _visualAssertionsService?.Dispose();
            _visualAssertionsService = new VisualAssertionsService(projectRepository, TestRunnerAdapter, config.ProcessScreenshotsAsynchronously, ScreenshotComparisonStrategy)
            {
                ProjectName        = config.ProjectName,
                ScreenshotCategory = config.ScreenshotCategory,
                BrowserName        = config.BrowserName
            };
        }
示例#3
0
        public static void Init(VisualAssertionsConfig config)
        {
            var testOutputWriter  = config.TestOutputWriter ?? Console.WriteLine;
            var testRunnerAdapter = TestRunnerAdapterFactory.CreateForCurrentEnvironment(testOutputWriter);
            var projectRepository = new Repository <Project>(PersistanceEngine.GetSessionContext());

            visualAssertionsService = new VisualAssertionsService(projectRepository, testRunnerAdapter)
            {
                ProjectName        = config.ProjectName,
                ScreenshotCategory = config.ScreenshotCategory,
                BrowserName        = config.BrowserName
            };
        }