public static KarmaSettings Read(string path, IKarmaLogger logger) { logger.Info("Reading settings from {0}", path); KarmaSettings settings = null; if (PathUtils.PathHasFileName(path, Globals.SettingsFilename) && File.Exists(path)) { try { settings = JsonConvert.DeserializeObject <KarmaSettings>(File.ReadAllText(path, Encoding.UTF8)); settings.SettingsFile = path; } catch (Exception ex) { logger.Error(ex.Message); } } else { settings = new KarmaSettings { KarmaConfigFile = Path.GetFileName(path) }; } settings.Directory = Path.GetDirectoryName(path); return(settings); }
public KarmaTestContainerDiscoverer( [Import(typeof(SVsServiceProvider))] IServiceProvider serviceProvider, ILogger logger, ISolutionListener solutionListener, ITestFilesUpdateWatcher testFilesUpdateWatcher, ITestFileAddRemoveListener testFilesAddRemoveListener) { Logger = KarmaLogger.Create(logger: logger); _serviceProvider = serviceProvider; _solutionListener = solutionListener; _testFilesUpdateWatcher = testFilesUpdateWatcher; _testFilesUpdateWatcher.Changed += OnProjectItemChanged; _testFilesAddRemoveListener = testFilesAddRemoveListener; _testFilesAddRemoveListener.Changed += OnProjectItemChanged; _testFilesAddRemoveListener.StartListening(); _solutionListener.SolutionUnloaded += SolutionListenerOnSolutionUnloaded; _solutionListener.ProjectChanged += OnSolutionProjectChanged; _solutionListener.StartListening(); Logger.Info("KarmaTestContainerDiscoverer created"); }