#develop (short for SharpDevelop) is a free IDE for .NET programming languages.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

49 lines
1.3 KiB

// 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.Collections.Generic;
using System.Windows.Input;
using System.Threading;
using Microsoft.Scripting.Hosting.Shell;
using ICSharpCode.RubyBinding;
using NUnit.Framework;
using RubyBinding.Tests.Utils;
namespace RubyBinding.Tests.Console
{
/// <summary>
/// The Home Key should return the user to the start of the line after the prompt.
/// </summary>
[TestFixture]
public class RubyConsoleHomeKeyTestFixture : RubyConsoleTestsBase
{
string prompt = ">>> ";
[SetUp]
public void Init()
{
base.CreateRubyConsole();
TestableRubyConsole.Write(prompt, Style.Prompt);
}
[Test]
public void HomeKeyPressedWhenNoUserTextInConsole()
{
MockConsoleTextEditor.RaisePreviewKeyDownEventForDialogKey(Key.Home);
int expectedColumn = prompt.Length;
Assert.AreEqual(expectedColumn, MockConsoleTextEditor.Column);
}
[Test]
public void HomeKeyPressedWhenTextInConsole()
{
MockConsoleTextEditor.RaisePreviewKeyDownEvent(Key.A);
MockConsoleTextEditor.RaisePreviewKeyDownEventForDialogKey(Key.Home);
int expectedColumn = prompt.Length;
Assert.AreEqual(expectedColumn, MockConsoleTextEditor.Column);
}
}
}