Esempio n. 1
0
        private bool DisplayNameMatch(UtItemViewModel itemViewModel, string text)
        {
            if (String.IsNullOrEmpty(text) || String.IsNullOrEmpty(itemViewModel.DisplayName))
            {
                return(false);
            }

            return(itemViewModel.DisplayName.IndexOf(text, StringComparison.InvariantCultureIgnoreCase) > -1);
        }
Esempio n. 2
0
        public UtTreeViewModel(UtItem root)
        {
            myTreeRoot = new UtItemViewModel(root)
            {
                IsExpanded = true
            };

            myUtProjects = new ReadOnlyCollection <UtItemViewModel>(new[] { myTreeRoot });

            mySearchCommand = new SearchTreeCommand(this);
        }
Esempio n. 3
0
        private UtItemViewModel(UtItem item, UtItemViewModel parent)
        {
            myItem   = item;
            myParent = parent;

            myChildren = new ReadOnlyCollection <UtItemViewModel>(
                (from child in myItem.Children
                 select new UtItemViewModel(child, this))
                .ToList <UtItemViewModel>());

            myRunTestCommand = new RunTestCommand(this);
        }
Esempio n. 4
0
        private IEnumerable <UtItemViewModel> FindMatches(string searchText, UtItemViewModel utItemViewModel)
        {
            if (DisplayNameMatch(utItemViewModel, searchText))
            {
                yield return(utItemViewModel);
            }

            foreach (UtItemViewModel child in utItemViewModel.Children)
            {
                foreach (UtItemViewModel match in FindMatches(searchText, child))
                {
                    yield return(match);
                }
            }
        }
Esempio n. 5
0
        private void ExecuteTestRecusively(UtItemViewModel vm)
        {
            if (vm.ItemType == ItemType.TestMethod || vm.ItemType == ItemType.TestCaseMethod)
            {
                var instance = vm.Parent.ClassInstance;

                var methodInfo     = vm.TestMethod;
                var arguments      = vm.InnerItem.Arguments;
                var setupMethod    = vm.InnerItem.SetUpMethod;
                var teardownMethod = vm.InnerItem.TearDownMethod;

                try
                {
                    if (setupMethod != null)
                    {
                        setupMethod.Invoke(instance, null);
                    }

                    methodInfo.Invoke(instance, arguments);

                    if (teardownMethod != null)
                    {
                        teardownMethod.Invoke(instance, null);
                    }

                    vm.TestPassed = TestResult.Passed;
                }
                catch (Exception e)
                {
                    vm.TestPassed       = TestResult.Failed;
                    vm.FailedStackTrace = e.InnerException.StackTrace;
                }
            }

            foreach (var child in vm.Children)
            {
                ExecuteTestRecusively(child);
            }
        }
Esempio n. 6
0
 public RunTestCommand(UtItemViewModel utItemViewModel)
 {
     myUtItemViewModel = utItemViewModel;
 }