public TestFile GetTestFileByPath(string path) { if (_testFilesByPath == null) { TestFilesByPath testFilesByPath = new TestFilesByPath(); GetSourceFilePaths(Model, testFilesByPath); _testFilesByPath = testFilesByPath; } if (_testFilesByPath.TryGetValue(path, out TestFile testFile)) { return(testFile); } return(null); }
private void GetSourceFilePaths(TestModel model, TestFilesByPath testFilesByPath) { foreach (TestModel item in model.Items) { if (item is TestFile file) { if (!testFilesByPath.ContainsKey(file.Path)) { testFilesByPath.Add(file.Path, file); } } else { GetSourceFilePaths(item, testFilesByPath); } } }
protected void CleartestFilesByPath() { _testFilesByPath = null; }