-
Notifications
You must be signed in to change notification settings - Fork 12
/
LocationNameMatcherTests.cs
82 lines (71 loc) · 5.31 KB
/
LocationNameMatcherTests.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
using FluentAssertions;
using StardewArchipelago.Locations;
namespace StardewArchipelago.ests
{
public class LocationNameMatcherTests
{
private LocationNameMatcher _locationNameMatcher;
[SetUp]
public void Setup()
{
_locationNameMatcher = new LocationNameMatcher();
}
[TestCase("Snail", new[] { "Shipsanity: Snail", "Fishsanity: Snail" }, new[] { "Escargot", "Nail" }, TestName = "Snail")]
[TestCase("Stone", new[] { "Shipsanity: Stone" }, new[] { "Shipsanity: Wood", "Explore Stonehenge" }, TestName = "Stone")]
[TestCase("Wood", new[] { "Shipsanity: Wood" }, new[] { "Shipsanity: Hardwood", "Craft Wooden Display" }, TestName = "Wood")]
[TestCase("Juice", new[] { "Shipsanity: Juice" }, new string[0], TestName = "Juice")]
[TestCase("Win Grange Display", new[] { "Win Grange Display" }, new[] { "Grange Display" }, TestName = "Grange Display")]
[TestCase("Hardwood", new[] { "Shipsanity: Hardwood" }, new[] { "Robin's Project" }, TestName = "Hardwood")]
[TestCase("Tomato", new[] { "Harvest Tomato", "Shipsanity: Tomato" }, new string[0], TestName = "Tomato")]
[TestCase("Wizard", new[] { "Friendsanity: Wizard 4 <3" }, new string[0], TestName = "Wizard")]
[TestCase("Apple", new[] { "Harvest Apple" }, new[] { "Friendsanity: Apples 1 <3" }, TestName = "Apple")]
[TestCase("Apples", new[] { "Friendsanity: Apples 10 <3" }, new[] { "Harvest Apple" }, TestName = "Apples")]
[TestCase("Opal", new[] { "Museumsanity: Opal" }, new[] { "Museumsanity: Fire Opal" }, TestName = "Opal")]
[TestCase("Fire Opal", new[] { "Museumsanity: Fire Opal" }, new[] { "Museumsanity: Opal" }, TestName = "Opal")]
[TestCase("Chest", new[] { "Craft Chest" }, new[] { "Craft Stone Chest", "Craft Big Chest", "Craft Big Stone Chest" }, TestName = "Chest")]
[TestCase("Stone Chest", new[] { "Craft Stone Chest" }, new[] { "Craft Chest", "Craft Big Chest", "Craft Big Stone Chest" }, TestName = "Stone Chest")]
[TestCase("Big Chest", new[] { "Craft Big Chest" }, new[] { "Craft Stone Chest", "Craft Chest", "Craft Big Stone Chest" }, TestName = "Big Chest")]
[TestCase("Big Stone Chest", new[] { "Craft Big Stone Chest" }, new[] { "Craft Chest", "Craft Big Chest", "Craft Stone Chest" }, TestName = "Big Stone Chest")]
[TestCase("Egg", new[] { "Shipsanity: Egg" }, new[] { "Shipsanity: Duck Egg", "Shipsanity: Egg (Brown)", "Shipsanity: Large Egg", "Shipsanity: Green Slime Egg", "Shipsanity: Calico Egg" }, TestName = "Egg")]
[TestCase("Large Egg", new[] { "Shipsanity: Large Egg" }, new[] { "Shipsanity: Egg (Brown)", "Shipsanity: Large Egg (Brown)" }, TestName = "Large Egg")]
[TestCase("Egg (Brown)", new[] { "Shipsanity: Egg (Brown)" }, new[] { "Shipsanity: Large Egg (Brown)" }, TestName = "Brown Egg")]
public void GetAllLocationsContainingWordTruePositivesTest(string itemName, string[] locationsMatching, string[] locationsNotMatching)
{
// Arrange
var allLocations = locationsMatching.Union(locationsNotMatching);
// Act
var matches = _locationNameMatcher.GetAllLocationsContainingWord(allLocations, itemName);
// Assert
matches.Should().NotBeNull();
matches.Should().BeEquivalentTo(locationsMatching);
}
[TestCase("Snail", new[] { "Open Professor Snail Cave" }, TestName = "Professor Snail Cave")]
[TestCase("Stone", new[] { "Shipsanity: Swirl Stone", "Smashing Stone" }, TestName = "Swirl Stone")]
[TestCase("Hardwood", new[] { "Shipsanity: Hardwood Display: Amphibian Fossil" }, TestName = "Hardwood Displays")]
[TestCase("Anchor", new[] { "Repair Boat Anchor" }, TestName = "Boat Anchor")]
[TestCase("Diamond", new[] { "Read The Diamond Hunter", "Starfish Diamond", "Diamond Of Indents", "Diamond Of Pebbles" }, TestName = "Diamond")]
[TestCase("Opal", new[] { "Fire Opal" }, TestName = "Opals")]
[TestCase("Chest", new[] { "Craft Stone Chest", "Craft Big Chest", "Craft Big Stone Chest", "Volcano Common Chest Walnut", "Volcano Rare Chest Walnut", "Deep Woods Treasure Chest" }, TestName = "Chest")]
public void GetAllLocationsContainingWordFalsePositivesTest(string itemName, string[] locationsNotMatching)
{
// Arrange
// Act
var matches = _locationNameMatcher.GetAllLocationsContainingWord(locationsNotMatching, itemName);
// Assert
matches.Should().NotBeNull();
matches.Should().BeEmpty();
}
[TestCase("Juice", new[] { "Pam Needs Juice" }, TestName = "Pam Juice")]
[TestCase("Tomato", new[] { "Shipsanity: Tomato Seeds" }, TestName = "Tomato Seeds")]
[TestCase("Wizard", new[] { "Meet The Wizard" }, TestName = "Meet the Wizard")]
public void GetAllLocationsContainingWordThematicallyRelatedItemsTest(string itemName, string[] locationsMatching)
{
// Arrange
// Act
var matches = _locationNameMatcher.GetAllLocationsContainingWord(locationsMatching, itemName);
// Assert
matches.Should().NotBeNull();
matches.Should().BeEquivalentTo(locationsMatching);
}
}
}