public TestSuiteDialog(bool isCreate, TestSuiteVm baseTestSuite, Settings settings) { _baseTestSuite = baseTestSuite; _assembliesChangedTimer = new DispatcherTimer(); _assembliesChangedTimer.Interval = TimeSpan.FromSeconds(1.3); _assembliesChangedTimer.Tick += _assembliesEdit_timer_Tick; _libsChangedTimer = new DispatcherTimer(); _libsChangedTimer.Interval = TimeSpan.FromSeconds(1.3); _libsChangedTimer.Tick += _libsEdit_timer_Tick; DataContext = _model = new TestSuiteCreateOrEditModel(settings, isCreate, baseTestSuite?.DisableSemanticAnalysis ?? false); InitializeComponent(); if (baseTestSuite != null) { _model.RootFolder = baseTestSuite.Solution.RootFolder; _model.SuiteName = baseTestSuite.Name; _model.NormalizedAssemblies = baseTestSuite.Assemblies; _model.NormalizedLibs = baseTestSuite.Libs; if (baseTestSuite.Language != Nitra.Language.Instance) _model.SelectedLanguage = baseTestSuite.Language; } _assemblies.Text = _model.NormalizedAssembliesText; _assemblies.TextChanged += _assemblies_TextChanged; _libs.Text = _model.NormalizedLibsText; _libs.TextChanged += _libs_TextChanged; }
//public ObservableCollection<IAst> CompilationUnits { get; private set; } public TestFolderVm(string testPath, TestSuiteVm testSuite) : base(testSuite, testPath) { var solution = new FsSolution<IAst>(); this.Project = new FsProject<IAst>(solution, testPath, testSuite.Libs.Select( lib => { var file = lib as FileLibReference; if (file == null || Path.IsPathRooted(file.Path)) return lib; return new FileLibReference(Path.Combine(@"..", file.Path)); })); Statistics = new StatisticsTask.Container("Total"); ParsingStatistics = Statistics.ReplaceContainerSubtask("Parsing"); ParseTreeStatistics = Statistics.ReplaceContainerSubtask("ParseTree"); AstStatistics = Statistics.ReplaceContainerSubtask("Ast", "AST Creation"); DependPropsStatistics = Statistics.ReplaceContainerSubtask("DependProps", "Dependent properties"); TestPath = testPath; TestSuite = testSuite; if (TestSuite.TestState == TestState.Ignored) TestState = TestState.Ignored; string testSuitePath = base.FullPath; var tests = new ObservableCollection<TestVm>(); var paths = Directory.GetFiles(testSuitePath, "*.test"); foreach (var path in paths.OrderBy(f => f)) tests.Add(new TestVm(path, this)); Tests = tests; }
public SolutionVm(string solutinFilePath, string selectePath, string config) { var isSolutinFileExists = solutinFilePath != null && File.Exists(solutinFilePath); if (!isSolutinFileExists) { var message = "The '" + solutinFilePath + "' not exists."; Debug.Assert(isSolutinFileExists, message); // ReSharper disable once HeuristicUnreachableCode throw new ApplicationException(message); } SolutinFilePath = solutinFilePath; RootFolder = Path.GetDirectoryName(solutinFilePath); var suits = File.ReadAllLines(solutinFilePath); var rootDir = Path.GetDirectoryName(solutinFilePath); Debug.Assert(rootDir != null, "rootDir != null"); TestSuites = new ObservableCollection <TestSuiteVm>(); foreach (var aSuite in suits) { var suite = aSuite.Trim(); if (string.IsNullOrEmpty(suite)) { continue; } var testSuite = new TestSuiteVm(this, suite, config); if (selectePath != null) { if (testSuite.FullPath == selectePath) { testSuite.IsSelected = true; // Прикольно что по другому фокус не изменить! } else { foreach (var test in testSuite.Tests) { if (test.FullPath == selectePath) { test.IsSelected = true; } } } } } TestSuites.CollectionChanged += TestSuites_CollectionChanged; IsDirty = false; }
//public ObservableCollection<IAst> CompilationUnits { get; private set; } public TestFolderVm(string testPath, TestSuiteVm testSuite) : base(testSuite, testPath) { var solution = new FsSolution <IAst>(); this.Project = new FsProject <IAst>(solution, testPath, testSuite.Libs.Select( lib => { var file = lib as FileLibReference; if (file == null || Path.IsPathRooted(file.Path)) { return(lib); } return(new FileLibReference(Path.Combine(@"..", file.Path))); })); Statistics = new StatisticsTask.Container("Total"); ParsingStatistics = Statistics.ReplaceContainerSubtask("Parsing"); ParseTreeStatistics = Statistics.ReplaceContainerSubtask("ParseTree"); AstStatistics = Statistics.ReplaceContainerSubtask("Ast", "AST Creation"); DependPropsStatistics = Statistics.ReplaceContainerSubtask("DependProps", "Dependent properties"); TestPath = testPath; TestSuite = testSuite; if (TestSuite.TestState == TestState.Ignored) { TestState = TestState.Ignored; } string testSuitePath = base.FullPath; var tests = new ObservableCollection <TestVm>(); var paths = Directory.GetFiles(testSuitePath, "*.test"); var id = 0; foreach (var path in paths.OrderBy(f => f)) { tests.Add(new TestVm(path, id, this)); id++; } Tests = tests; }
public SolutionVm(string solutinFilePath, string selectePath, string config) { var isSolutinFileExists = solutinFilePath != null && File.Exists(solutinFilePath); if (!isSolutinFileExists) { var message = "The '" + solutinFilePath + "' not exists."; Debug.Assert(isSolutinFileExists, message); // ReSharper disable once HeuristicUnreachableCode throw new ApplicationException(message); } SolutinFilePath = solutinFilePath; RootFolder = Path.GetDirectoryName(solutinFilePath); var suits = File.ReadAllLines(solutinFilePath); var rootDir = Path.GetDirectoryName(solutinFilePath); Debug.Assert(rootDir != null, "rootDir != null"); TestSuites = new ObservableCollection<TestSuiteVm>(); foreach (var aSuite in suits) { var suite = aSuite.Trim(); if (string.IsNullOrEmpty(suite)) continue; var testSuite = new TestSuiteVm(this, suite, config); if (selectePath != null) { if (testSuite.FullPath == selectePath) testSuite.IsSelected = true; // Прикольно что по другому фокус не изменить! else foreach (var test in testSuite.Tests) if (test.FullPath == selectePath) test.IsSelected = true; } } TestSuites.CollectionChanged += TestSuites_CollectionChanged; IsDirty = false; }
void item_Click(object sender, RoutedEventArgs e) { var name = (string)((MenuItem)e.Source).Header; var testSuite = new TestSuiteVm(_solution, name, _settings.Config); testSuite.IsSelected = true; _solution.Save(); }
private void ChangeCurrentTest(TestSuiteVm newTestSuite, TestFolderVm newTestFolder, TestVm newTest, string code) { if (newTestSuite != _currentTestSuite && newTestSuite != null) { _highlightingStyles.Clear(); foreach (var spanClass in newTestSuite.Language.GetSpanClasses()) _highlightingStyles.Add(spanClass.FullName, MakeHighlightingColor(spanClass)); } _currentTestSuite = newTestSuite; _currentTestFolder = newTestFolder; _currentTest = newTest; _text.Text = code; }
private void EditTestSuite(bool create) { if (_solution == null) return; var currentTestSuite = _currentTestSuite; var dialog = new TestSuiteDialog(create, currentTestSuite, _settings) { Owner = this }; if (dialog.ShowDialog() ?? false) { if (currentTestSuite != null) _solution.TestSuites.Remove(currentTestSuite); var testSuite = new TestSuiteVm(_solution, dialog.TestSuiteName, _settings.Config); testSuite.IsSelected = true; _solution.Save(); } }