~halega/+junk/sharpdevelop

« back to all changes in this revision

Viewing changes to src/AddIns/BackendBindings/WixBinding/Test/Utils/Tests/MockWorkbenchTests.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 NUnit.Framework;
 
6
using WixBinding.Tests.Utils;
 
7
 
 
8
namespace WixBinding.Tests.Utils.Tests
 
9
{
 
10
        [TestFixture]
 
11
        public class MockWorkbenchTests
 
12
        {
 
13
                MockWorkbench workbench;
 
14
                
 
15
                [SetUp]
 
16
                public void Init()
 
17
                {
 
18
                        workbench = new MockWorkbench();
 
19
                }
 
20
                
 
21
                [Test]
 
22
                public void ViewPassedToShowViewMethodIsAddedToViewContentsCollection()
 
23
                {
 
24
                        MockViewContent view = new MockViewContent();
 
25
                        workbench.ShowView(view);
 
26
                        Assert.IsTrue(workbench.ViewContentCollection.Contains(view));
 
27
                }
 
28
                
 
29
                [Test]
 
30
                public void ActiveContentIsSaved()
 
31
                {
 
32
                        MockViewContent view = new MockViewContent();
 
33
                        workbench.ActiveContent = view;
 
34
                        Assert.AreSame(view, workbench.ActiveContent);
 
35
                }
 
36
                
 
37
                [Test]
 
38
                public void ActiveViewContentIsSaved()
 
39
                {
 
40
                        MockViewContent view = new MockViewContent();
 
41
                        workbench.ActiveViewContent = view;
 
42
                        Assert.AreSame(view, workbench.ActiveViewContent);
 
43
                }
 
44
                
 
45
                [Test]
 
46
                public void RaiseActiveViewContentChangedMethodFiresActiveViewContentChangedEvent()
 
47
                {
 
48
                        bool eventFired = false;
 
49
                        workbench.ActiveViewContentChanged += delegate (object source, EventArgs e)
 
50
                                { eventFired = true; };
 
51
                        
 
52
                        workbench.RaiseActiveViewContentChangedEvent();
 
53
                        
 
54
                        Assert.IsTrue(eventFired);
 
55
                }
 
56
                
 
57
                [Test]
 
58
                public void RaiseActiveViewContentChangedMethodDoesNotThrowNullReferenceExceptionWhenNoEventHandlersConfigured()
 
59
                {
 
60
                        Assert.DoesNotThrow(delegate { workbench.RaiseActiveViewContentChangedEvent(); });
 
61
                }
 
62
        }
 
63
}