Skip to content

Commit edb771c

Browse files
committed
Update ReadLineTests
1 parent 31e569c commit edb771c

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

test/ReadLine.Tests/ReadLineTests.cs

+14-12
Original file line numberDiff line numberDiff line change
@@ -2,43 +2,45 @@
22
using System.Linq;
33
using Xunit;
44

5-
namespace Tests
5+
using static System.ReadLine;
6+
7+
namespace ReadLine.Tests
68
{
7-
public class Tests : IDisposable
9+
public class ReadLineTests : IDisposable
810
{
9-
public Tests()
11+
public ReadLineTests()
1012
{
1113
string[] history = new string[] { "ls -a", "dotnet run", "git init" };
12-
ReadLine.AddHistory(history);
14+
AddHistory(history);
1315
}
1416

1517
[Fact]
1618
public void TestNoInitialHistory()
1719
{
18-
Assert.Equal(3, ReadLine.GetHistory().Count);
20+
Assert.Equal(3, GetHistory().Count);
1921
}
2022

2123
[Fact]
2224
public void TestUpdatesHistory()
2325
{
24-
ReadLine.AddHistory("mkdir");
25-
Assert.Equal(4, ReadLine.GetHistory().Count);
26+
AddHistory("mkdir");
27+
Assert.Equal(4, GetHistory().Count);
28+
Assert.Equal("mkdir", GetHistory().Last());
2629
}
2730

2831
[Fact]
2932
public void TestGetCorrectHistory()
3033
{
31-
var history = ReadLine.GetHistory();
32-
33-
Assert.Equal(3, history.Count);
34-
Assert.Equal("git init", history.Last());
34+
Assert.Equal("ls -a", GetHistory()[0]);
35+
Assert.Equal("dotnet run", GetHistory()[1]);
36+
Assert.Equal("git init", GetHistory()[2]);
3537
}
3638

3739
public void Dispose()
3840
{
3941
// If all above tests pass
4042
// clear history works
41-
ReadLine.ClearHistory();
43+
ClearHistory();
4244
}
4345
}
4446
}

0 commit comments

Comments
 (0)