-
Notifications
You must be signed in to change notification settings - Fork 137
/
AutocompleteProviderTest.cs
43 lines (37 loc) · 1.35 KB
/
AutocompleteProviderTest.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
using System.Collections.Generic;
using FluentAssertions;
using SwqlStudio.Autocomplete;
using Xunit;
namespace SwqlStudio.Tests
{
public class AutocompleteProviderTest
{
[Theory]
[MemberData(nameof(DoTheParsing_TestCases))]
public void DoTheParsing_IdentifiesAliases(string query, Dictionary<string, string> expected)
{
var provider = new AutocompleteProvider(query);
var aliases = new Dictionary<string, string>();
provider.DoTheParsing(9, aliases);
aliases.Should().BeEquivalentTo(expected);
}
public static IEnumerable<object[]> DoTheParsing_TestCases()
{
yield return new object[]
{
"select n. from Orion.Nodes n inner join Orion.Interfaces as i",
new Dictionary<string, string> {["n"] = "Orion.Nodes", ["i"] = "Orion.Interfaces"}
};
yield return new object[]
{
"SELECT n. FROM Orion.Nodes n INNER JOIN Orion.Interfaces AS i",
new Dictionary<string, string> {["n"] = "Orion.Nodes", ["i"] = "Orion.Interfaces"}
};
yield return new object[]
{
"select n. from Orion.Nodes n",
new Dictionary<string, string> {["n"] = "Orion.Nodes"}
};
}
}
}