~halega/+junk/sharpdevelop

« back to all changes in this revision

Viewing changes to src/AddIns/BackendBindings/Scripting/Test/Console/OneItemCommandLineHistoryTestFixture.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 ICSharpCode.Scripting;
 
6
using NUnit.Framework;
 
7
 
 
8
namespace ICSharpCode.Scripting.Tests.Console
 
9
{
 
10
        [TestFixture]
 
11
        public class OneItemCommandLineHistoryTestFixture
 
12
        {
 
13
                CommandLineHistory history;
 
14
                
 
15
                [SetUp]
 
16
                public void Init()
 
17
                {
 
18
                        history = new CommandLineHistory();
 
19
                        history.Add("a");
 
20
                }
 
21
                
 
22
                [Test]
 
23
                public void Current()
 
24
                {
 
25
                        Assert.AreEqual(null, history.Current);
 
26
                }
 
27
                
 
28
                [Test]
 
29
                public void MovePrevious()
 
30
                {
 
31
                        Assert.IsTrue(history.MovePrevious());
 
32
                }
 
33
                
 
34
                [Test]
 
35
                public void MovePreviousTwice()
 
36
                {
 
37
                        history.MovePrevious();
 
38
                        Assert.IsFalse(history.MovePrevious());
 
39
                }
 
40
                
 
41
                [Test]
 
42
                public void MoveNextFails()
 
43
                {
 
44
                        Assert.IsFalse(history.MoveNext());
 
45
                }
 
46
                
 
47
                [Test]
 
48
                public void CurrentAfterMovePrevious()
 
49
                {
 
50
                        history.MovePrevious();
 
51
                        Assert.AreEqual("a", history.Current);
 
52
                }
 
53
                
 
54
                [Test]
 
55
                public void CurrentAfterMovePreviousTwice()
 
56
                {
 
57
                        history.MovePrevious();
 
58
                        history.MovePrevious();
 
59
                        Assert.AreEqual("a", history.Current);
 
60
                }               
 
61
                
 
62
                [Test]
 
63
                public void MovePreviousThenBack()
 
64
                {
 
65
                        history.MovePrevious();
 
66
                        Assert.IsFalse(history.MoveNext());
 
67
                }
 
68
 
 
69
                [Test]
 
70
                public void CurrentAfterMovePreviousThenBack()
 
71
                {
 
72
                        history.MovePrevious();
 
73
                        history.MoveNext();
 
74
                        Assert.AreEqual("a", history.Current);
 
75
                }
 
76
                                
 
77
                [Test]
 
78
                public void CurrentAfterMovePreviousTwiceThenBack()
 
79
                {
 
80
                        history.MovePrevious();
 
81
                        history.MovePrevious();
 
82
                        history.MoveNext();
 
83
                        Assert.AreEqual("a", history.Current);
 
84
                }
 
85
                
 
86
                [Test]
 
87
                public void MoveNextTwiceThenBack()
 
88
                {
 
89
                        history.MoveNext();
 
90
                        history.MoveNext();
 
91
                        Assert.IsTrue(history.MovePrevious());
 
92
                }
 
93
                
 
94
                [Test]
 
95
                public void CurrentAfterMoveNextTwiceThenBack()
 
96
                {
 
97
                        MoveNextTwiceThenBack();
 
98
                        Assert.AreEqual("a", history.Current);
 
99
                }
 
100
                
 
101
                [Test]
 
102
                public void IgnoreSameCommandLineEntered()
 
103
                {
 
104
                        history.Add("a");
 
105
                        history.MovePrevious();
 
106
                        Assert.IsFalse(history.MovePrevious());
 
107
                }
 
108
        }
 
109
}