Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit a1fdeb2

Browse files
Restoring AutoCompleteSuggestionTests
1 parent 2f4482a commit a1fdeb2

File tree

2 files changed

+38
-40
lines changed

2 files changed

+38
-40
lines changed
Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,58 @@
11
using System.Reactive.Linq;
22
using System.Windows.Media.Imaging;
3-
using GitHub.UI;
3+
using GitHub.Models;
44
using NUnit.Framework;
5-
using Xunit;
65

7-
public class AutoCompleteSuggestionTests
6+
namespace GitHub.UI.UnitTests.Controls
87
{
9-
public class TheToStringMethod
8+
public class AutoCompleteSuggestionTests
109
{
11-
[Theory]
12-
[InlineData(":", ":", ":foo:")]
13-
[InlineData("@", "", "@foo")]
14-
[InlineData("#", "", "#foo")]
15-
[InlineData("@", null, "@foo")]
16-
public void ReturnsWordSurroundedByPrefixAndSuffix(string prefix, string suffix, string expected)
10+
public class TheToStringMethod
1711
{
18-
var obs = Observable.Return(new BitmapImage());
19-
var suggestion = new AutoCompleteSuggestion("foo", obs, prefix, suffix);
20-
Assert.Equal(expected, suggestion.ToString());
12+
[TestCase(":", ":", ":foo:")]
13+
[TestCase("@", "", "@foo")]
14+
[TestCase("#", "", "#foo")]
15+
[TestCase("@", null, "@foo")]
16+
public void ReturnsWordSurroundedByPrefixAndSuffix(string prefix, string suffix, string expected)
17+
{
18+
var obs = Observable.Return(new BitmapImage());
19+
var suggestion = new AutoCompleteSuggestion("foo", obs, prefix, suffix);
20+
Assert.AreEqual(expected, suggestion.ToString());
21+
}
2122
}
22-
}
2323

24-
public class TheGetSortRankMethod
25-
{
26-
[Theory]
27-
[InlineData("pat", "full name", 1)]
28-
[InlineData("yosemite", "pat name", 0)]
29-
[InlineData("minnie", "full pat", 0)]
30-
[InlineData("patrick", "full name", 1)]
31-
[InlineData("groot", "patrick name", 0)]
32-
[InlineData("driver", "danica patrick", 0)]
33-
[InlineData("patricka", "pat name", 1)]
34-
[InlineData("nomatch", "full name", -1)]
35-
public void ReturnsCorrectScoreForSuggestions(string login, string name, int expectedRank)
24+
public class TheGetSortRankMethod
3625
{
37-
var obs = Observable.Return(new BitmapImage());
26+
[TestCase("pat", "full name", 1)]
27+
[TestCase("yosemite", "pat name", 0)]
28+
[TestCase("minnie", "full pat", 0)]
29+
[TestCase("patrick", "full name", 1)]
30+
[TestCase("groot", "patrick name", 0)]
31+
[TestCase("driver", "danica patrick", 0)]
32+
[TestCase("patricka", "pat name", 1)]
33+
[TestCase("nomatch", "full name", -1)]
34+
public void ReturnsCorrectScoreForSuggestions(string login, string name, int expectedRank)
35+
{
36+
var obs = Observable.Return(new BitmapImage());
3837

39-
var suggestion = new AutoCompleteSuggestion(login, name, obs, "@", "");
38+
var suggestion = new AutoCompleteSuggestion(login, name, obs, "@", "");
4039

41-
int rank = suggestion.GetSortRank("pat");
40+
int rank = suggestion.GetSortRank("pat");
4241

43-
Assert.Equal(expectedRank, rank);
44-
}
42+
Assert.AreEqual(expectedRank, rank);
43+
}
4544

46-
[Fact]
47-
public void ReturnsOneForEmptyString()
48-
{
49-
var obs = Observable.Return(new BitmapImage());
45+
[Test]
46+
public void ReturnsOneForEmptyString()
47+
{
48+
var obs = Observable.Return(new BitmapImage());
5049

51-
var suggestion = new AutoCompleteSuggestion("joe", "namathe", obs, "@", "");
50+
var suggestion = new AutoCompleteSuggestion("joe", "namathe", obs, "@", "");
5251

53-
int rank = suggestion.GetSortRank("");
52+
int rank = suggestion.GetSortRank("");
5453

55-
Assert.Equal(1, rank);
54+
Assert.AreEqual(1, rank);
55+
}
5656
}
5757
}
5858
}

test/GitHub.UI.UnitTests/GitHub.UI.UnitTests.csproj

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
<TargetFramework>net46</TargetFramework>
44
</PropertyGroup>
55
<ItemGroup>
6-
<Compile Remove="Controls\AutoCompleteSuggestionTests.cs" />
76
<Compile Remove="Controls\AutoCompleteTextInputExtensionsTests.cs" />
87
<Compile Remove="Helpers\AutoCompleteAdvisorTests.cs" />
98
<Compile Remove="Helpers\AutoCompleteSourceTests.cs" />
@@ -32,7 +31,6 @@
3231
</ItemGroup>
3332

3433
<ItemGroup>
35-
<None Include="Controls\AutoCompleteSuggestionTests.cs" />
3634
<None Include="Controls\AutoCompleteTextInputExtensionsTests.cs" />
3735
</ItemGroup>
3836

0 commit comments

Comments
 (0)