/// <summary> /// Handler to react to test file Add/remove/rename andcontents changed events /// </summary> private void OnProjectItemChanged(object sender, TestFileChangedEventArgs e) { ChutzpahTracer.TraceInformation("Begin OnProjectItemChanged"); if (e != null) { // If a chutzpah.json file changed then we set the flag to // ensure next time get if (fileProbe.IsChutzpahSettingsFile(e.File.Path)) { forceFullContainerRefresh = true; return; } // Don't do anything for files we are sure can't be test files if (!HasTestFileExtension(e.File.Path)) { return; } logger.Log(string.Format("Changed detected for {0} with change type of {1}", e.File, e.ChangedReason), "ChutzpahTestContainerDiscoverer", LogType.Information); switch (e.ChangedReason) { case TestFileChangedReason.Added: ChutzpahTracer.TraceInformation("Adding watch on {0}", e.File.Path); testFilesUpdateWatcher.AddWatch(e.File.Path); AddTestContainerIfTestFile(e.File); break; case TestFileChangedReason.Removed: ChutzpahTracer.TraceInformation("Removing watch on {0}", e.File.Path); testFilesUpdateWatcher.RemoveWatch(e.File.Path); RemoveTestContainer(e.File); break; case TestFileChangedReason.Changed: AddTestContainerIfTestFile(e.File); break; } OnTestContainersChanged(); } ChutzpahTracer.TraceInformation("End OnProjectItemChanged"); }