|
1 | 1 | using System.Reactive.Linq; |
2 | 2 | using System.Windows.Media.Imaging; |
3 | | -using GitHub.UI; |
| 3 | +using GitHub.Models; |
4 | 4 | using NUnit.Framework; |
5 | | -using Xunit; |
6 | 5 |
|
7 | | -public class AutoCompleteSuggestionTests |
| 6 | +namespace GitHub.UI.UnitTests.Controls |
8 | 7 | { |
9 | | - public class TheToStringMethod |
| 8 | + public class AutoCompleteSuggestionTests |
10 | 9 | { |
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 |
17 | 11 | { |
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 | + } |
21 | 22 | } |
22 | | - } |
23 | 23 |
|
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 |
36 | 25 | { |
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()); |
38 | 37 |
|
39 | | - var suggestion = new AutoCompleteSuggestion(login, name, obs, "@", ""); |
| 38 | + var suggestion = new AutoCompleteSuggestion(login, name, obs, "@", ""); |
40 | 39 |
|
41 | | - int rank = suggestion.GetSortRank("pat"); |
| 40 | + int rank = suggestion.GetSortRank("pat"); |
42 | 41 |
|
43 | | - Assert.Equal(expectedRank, rank); |
44 | | - } |
| 42 | + Assert.AreEqual(expectedRank, rank); |
| 43 | + } |
45 | 44 |
|
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()); |
50 | 49 |
|
51 | | - var suggestion = new AutoCompleteSuggestion("joe", "namathe", obs, "@", ""); |
| 50 | + var suggestion = new AutoCompleteSuggestion("joe", "namathe", obs, "@", ""); |
52 | 51 |
|
53 | | - int rank = suggestion.GetSortRank(""); |
| 52 | + int rank = suggestion.GetSortRank(""); |
54 | 53 |
|
55 | | - Assert.Equal(1, rank); |
| 54 | + Assert.AreEqual(1, rank); |
| 55 | + } |
56 | 56 | } |
57 | 57 | } |
58 | 58 | } |
0 commit comments