Microsoft.Silverlight.Testing.Client.DataManager.GetClassModel C# (CSharp) Method

GetClassModel() public method

Gets or creates the data model object for a test class.
public GetClassModel ( ITestClass testClass ) : TestClassData
testClass ITestClass The test class.
return TestClassData
        public TestClassData GetClassModel(ITestClass testClass)
        {
            TestClassData data;
            if (!_classData.TryGetValue(testClass, out data))
            {
                TestAssemblyData tad = GetAssemblyModel(testClass.Assembly);
                data = new TestClassData(testClass, tad);
                _classData.Add(testClass, data);

                // Make sure in parent collection
                tad.TestClasses.Add(data);
            }

            return data;
        }

Usage Example

        /// <summary>
        /// Starts the test run.
        /// </summary>
        private void StartTestRun()
        {
            _model = DataManager.Create(_harness);
            _model.Hook();

            DataContext = _model.Data;

            ScrollViewer sv = resultsTreeView.GetScrollHost();

            // Keep the current test visible in the tree view control
            _harness.TestClassStarting += (x, xe) =>
            {
                if (resultsTreeView != null)
                {
                    resultsTreeView.SelectItem(_model.GetClassModel(xe.TestClass));
                }
                ;
            };
            _harness.TestMethodStarting += (x, xe) =>
            {
                if (sv != null)
                {
                    sv.ScrollToBottom();
                }
            };
            _harness.TestMethodCompleted  += OnTestMethodCompleted;
            _harness.TestHarnessCompleted += OnTestHarnessCompleted;
            _harness.TestAssemblyStarting += OnTestAssemblyStarting;

            _harness.Run();
        }
All Usage Examples Of Microsoft.Silverlight.Testing.Client.DataManager::GetClassModel