// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) using System; using System.Windows.Forms; using ICSharpCode.SharpDevelop.Project; using ICSharpCode.UnitTesting; using NUnit.Framework; using UnitTesting.Tests.Utils; namespace UnitTesting.Tests.Tree { /// /// Tests that if the parser is still running then we do not /// add the solution to the unit tests tree. /// [TestFixture] public class OpenUnitTestsPadWithSolutionOpenTestFixture { DerivedUnitTestsPad pad; [TestFixtureSetUp] public void SetUp() { Solution solution = new Solution(new MockProjectChangeWatcher()); MockCSharpProject project = new MockCSharpProject(); MockProjectContent projectContent = new MockProjectContent(); projectContent.Project = project; projectContent.Language = LanguageProperties.None; ReferenceProjectItem refProjectItem = new ReferenceProjectItem(project); refProjectItem.Include = "NUnit.Framework"; ProjectService.AddProjectItem(project, refProjectItem); solution.Folders.Add(project); pad = new DerivedUnitTestsPad(solution); } [TestFixtureTearDown] public void TearDown() { pad.Dispose(); } [Test] public void NoSolutionAddedToTree() { Assert.AreEqual(0, pad.TestTreeView.GetProjects().Length); } /// /// The LoadSolutionProjectsThreadEnded event handler needs to be /// added before the unit tests pad checks the /// LoadSolutionProjectsThreadRunning flag so we do not miss the /// event. /// [Test] public void ParserServiceLoadSolutionProjectsThreadEndedHandled() { Assert.IsTrue(pad.LoadSolutionProjectsThreadEndedHandled); } } }