~halega/+junk/sharpdevelop

« back to all changes in this revision

Viewing changes to src/AddIns/Analysis/UnitTesting/Test/Tree/OpenUnitTestsPadWithSolutionOpenTestFixture.cs

  • Committer: sk
  • Date: 2011-09-10 05:17:57 UTC
  • Revision ID: halega@halega.com-20110910051757-qfouz1llya9m6boy
4.1.0.7915 Release Candidate 1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
 
2
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
 
3
 
 
4
using System;
 
5
using System.Windows.Forms;
 
6
using ICSharpCode.SharpDevelop.Dom;
 
7
using ICSharpCode.SharpDevelop.Project;
 
8
using ICSharpCode.UnitTesting;
 
9
using NUnit.Framework;
 
10
using UnitTesting.Tests.Utils;
 
11
 
 
12
namespace UnitTesting.Tests.Tree
 
13
{
 
14
        /// <summary>
 
15
        /// Tests that if the parser is still running then we do not
 
16
        /// add the solution to the unit tests tree.
 
17
        /// </summary>
 
18
        [TestFixture]
 
19
        public class OpenUnitTestsPadWithSolutionOpenTestFixture
 
20
        {
 
21
                DerivedUnitTestsPad pad;
 
22
                
 
23
                [TestFixtureSetUp]
 
24
                public void SetUp()
 
25
                {
 
26
                        Solution solution = new Solution(new MockProjectChangeWatcher());
 
27
                        MockCSharpProject project = new MockCSharpProject();
 
28
                        MockProjectContent projectContent = new MockProjectContent();
 
29
                        projectContent.Project = project;
 
30
                        projectContent.Language = LanguageProperties.None;
 
31
                        ReferenceProjectItem refProjectItem = new ReferenceProjectItem(project);
 
32
                        refProjectItem.Include = "NUnit.Framework";
 
33
                        ProjectService.AddProjectItem(project, refProjectItem);
 
34
                        solution.Folders.Add(project);
 
35
                        
 
36
                        pad = new DerivedUnitTestsPad(solution);
 
37
                }
 
38
                
 
39
                [TestFixtureTearDown]
 
40
                public void TearDown()
 
41
                {
 
42
                        pad.Dispose();
 
43
                }
 
44
                
 
45
                [Test]
 
46
                public void NoSolutionAddedToTree()
 
47
                {
 
48
                        Assert.AreEqual(0, pad.TestTreeView.GetProjects().Length);
 
49
                }
 
50
                
 
51
                /// <summary>
 
52
                /// The LoadSolutionProjectsThreadEnded event handler needs to be
 
53
                /// added before the unit tests pad checks the 
 
54
                /// LoadSolutionProjectsThreadRunning flag so we do not miss the
 
55
                /// event.
 
56
                /// </summary>
 
57
                [Test]
 
58
                public void ParserServiceLoadSolutionProjectsThreadEndedHandled()
 
59
                {
 
60
                        Assert.IsTrue(pad.LoadSolutionProjectsThreadEndedHandled);
 
61
                }
 
62
        }
 
63
}