/
CommandNameTest.cs
54 lines (48 loc) · 1.88 KB
/
CommandNameTest.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
using System.Linq;
using Xunit;
using Vim.Extensions;
namespace Vim.UnitTest
{
public class CommandNameTest
{
private KeyInputSet CreateOne(char c)
{
return KeyInputSet.NewOneKeyInput(KeyInputUtil.CharToKeyInput(c));
}
private KeyInputSet CreateTwo(char c1, char c2)
{
return KeyInputSet.NewTwoKeyInputs(KeyInputUtil.CharToKeyInput(c1), KeyInputUtil.CharToKeyInput(c2));
}
private KeyInputSet CreateMany(params char[] all)
{
return KeyInputSet.NewManyKeyInputs(all.Select(KeyInputUtil.CharToKeyInput).ToFSharpList());
}
[Fact]
public void Add1()
{
var name1 = KeyInputSet.NewOneKeyInput(KeyInputUtil.CharToKeyInput('c'));
var name2 = name1.Add(KeyInputUtil.CharToKeyInput('a'));
Assert.Equal("ca", name2.Name);
}
[Fact]
public void Name1()
{
var name1 = KeyInputSet.NewOneKeyInput(KeyInputUtil.CharToKeyInput('c'));
Assert.Equal("c", name1.Name);
}
[Fact]
public void Equality()
{
EqualityUtil.RunAll(
(left, right) => left == right,
(left, right) => left != right,
false,
true,
EqualityUnit.Create(CreateOne('a')).WithEqualValues(CreateOne('a')),
EqualityUnit.Create(CreateOne('a')).WithNotEqualValues(CreateOne('b')),
EqualityUnit.Create(CreateOne('a')).WithEqualValues(CreateMany('a')),
EqualityUnit.Create(CreateOne('D')).WithEqualValues(KeyNotationUtil.StringToKeyInputSet("D")),
EqualityUnit.Create(KeyInputSet.NewOneKeyInput(KeyInputUtil.CharToKeyInput('D'))).WithEqualValues(KeyNotationUtil.StringToKeyInputSet("D")));
}
}
}