~halega/+junk/sharpdevelop

« back to all changes in this revision

Viewing changes to src/AddIns/BackendBindings/Scripting/Test/Console/ScriptingConsoleUnreadLinesTests.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.Input;
 
6
 
 
7
using ICSharpCode.Scripting;
 
8
using ICSharpCode.Scripting.Tests.Utils;
 
9
using NUnit.Framework;
 
10
 
 
11
namespace ICSharpCode.Scripting.Tests.Console
 
12
{
 
13
        /// <summary>
 
14
        /// Tests the ScriptingConsole's GetUnreadLines method.
 
15
        /// </summary>
 
16
        [TestFixture]
 
17
        public class ScriptingConsoleUnreadLinesTests : ScriptingConsoleTestsBase
 
18
        {
 
19
                [SetUp]
 
20
                public void Init()
 
21
                {
 
22
                        base.CreateConsole();
 
23
                }
 
24
                
 
25
                [Test]
 
26
                public void NoUnreadLinesAtStart()
 
27
                {
 
28
                        int length = TestableScriptingConsole.GetUnreadLines().Length;
 
29
                        Assert.AreEqual(0, length);
 
30
                }
 
31
        
 
32
                [Test]
 
33
                public void HasUnreadLines()
 
34
                {
 
35
                        Assert.IsFalse(TestableScriptingConsole.IsLineAvailable);
 
36
                }
 
37
                
 
38
                [Test]
 
39
                public void AddOneLine()
 
40
                {
 
41
                        FakeConsoleTextEditor.RaisePreviewKeyDownEvent(System.Windows.Input.Key.A);
 
42
                        FakeConsoleTextEditor.RaisePreviewKeyDownEventForDialogKey(System.Windows.Input.Key.Enter);
 
43
                        
 
44
                        string[] lines = TestableScriptingConsole.GetUnreadLines();
 
45
                        string[] expectedLines = new string[] {"A"};
 
46
                        
 
47
                        Assert.AreEqual(expectedLines, lines);
 
48
                        Assert.IsTrue(TestableScriptingConsole.IsLineAvailable);
 
49
                }
 
50
        }
 
51
}