Files
Terminal.Gui/UnitTests/Input/EscSeqReqTests.cs
Tig 574ed8fec7 Fixes #2469 - Revamp file structure and namespace (#2471)
* initial commit

* All tests pass

* Updated readme

* Revert "All tests pass"

This reverts commit 94ac462350.

* Revert "initial commit"

This reverts commit 36d92cc4e5.

* Moved Terminal.Gui files around

* Nuked .Graphs namespace

* Nuked .Graphs namespace

* Nuked .Trees namespace

* Nuked .Configuration namespace

* Nuked .Configuration namespace

* All tests pass

* tweaked tests

* removed unneeded usings

* re-enabled scrollview tests

* move scrollview test to ScrollViewTests

* Moved view navigation related tests to separate cs file

* Moved view scrollbarview related tests ScrollBarTestse

* Refactored View tests into smaller files

* Refactored driver tests

* Fixed a ton of BUGBUGs
2023-04-06 10:09:21 -06:00

79 lines
2.3 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xunit;
namespace Terminal.Gui.InputTests {
public class EscSeqReqTests {
[Fact]
public void Constructor_Defaults ()
{
var escSeqReq = new EscSeqReqProc ();
Assert.NotNull (escSeqReq.EscSeqReqStats);
Assert.Empty (escSeqReq.EscSeqReqStats);
}
[Fact]
public void Add_Tests ()
{
var escSeqReq = new EscSeqReqProc ();
escSeqReq.Add ("t");
Assert.Single (escSeqReq.EscSeqReqStats);
Assert.Equal ("t", escSeqReq.EscSeqReqStats [^1].Terminating);
Assert.Equal (1, escSeqReq.EscSeqReqStats [^1].NumRequests);
Assert.Equal (1, escSeqReq.EscSeqReqStats [^1].NumOutstanding);
escSeqReq.Add ("t", 2);
Assert.Single (escSeqReq.EscSeqReqStats);
Assert.Equal ("t", escSeqReq.EscSeqReqStats [^1].Terminating);
Assert.Equal (1, escSeqReq.EscSeqReqStats [^1].NumRequests);
Assert.Equal (1, escSeqReq.EscSeqReqStats [^1].NumOutstanding);
escSeqReq = new EscSeqReqProc ();
escSeqReq.Add ("t", 2);
Assert.Single (escSeqReq.EscSeqReqStats);
Assert.Equal ("t", escSeqReq.EscSeqReqStats [^1].Terminating);
Assert.Equal (2, escSeqReq.EscSeqReqStats [^1].NumRequests);
Assert.Equal (2, escSeqReq.EscSeqReqStats [^1].NumOutstanding);
escSeqReq.Add ("t", 3);
Assert.Single (escSeqReq.EscSeqReqStats);
Assert.Equal ("t", escSeqReq.EscSeqReqStats [^1].Terminating);
Assert.Equal (2, escSeqReq.EscSeqReqStats [^1].NumRequests);
Assert.Equal (2, escSeqReq.EscSeqReqStats [^1].NumOutstanding);
}
[Fact]
public void Remove_Tests ()
{
var escSeqReq = new EscSeqReqProc ();
escSeqReq.Add ("t");
escSeqReq.Remove ("t");
Assert.Empty (escSeqReq.EscSeqReqStats);
escSeqReq.Add ("t", 2);
escSeqReq.Remove ("t");
Assert.Single (escSeqReq.EscSeqReqStats);
Assert.Equal ("t", escSeqReq.EscSeqReqStats [^1].Terminating);
Assert.Equal (2, escSeqReq.EscSeqReqStats [^1].NumRequests);
Assert.Equal (1, escSeqReq.EscSeqReqStats [^1].NumOutstanding);
escSeqReq.Remove ("t");
Assert.Empty (escSeqReq.EscSeqReqStats);
}
[Fact]
public void Requested_Tests ()
{
var escSeqReq = new EscSeqReqProc ();
Assert.False (escSeqReq.Requested ("t"));
escSeqReq.Add ("t");
Assert.False (escSeqReq.Requested ("r"));
Assert.True (escSeqReq.Requested ("t"));
}
}
}