-
Notifications
You must be signed in to change notification settings - Fork 0
/
_1773_Count_items_matching_a_rule_Test.cs
54 lines (47 loc) · 1.64 KB
/
_1773_Count_items_matching_a_rule_Test.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 Microsoft.VisualStudio.TestTools.UnitTesting;
using Solution._1773.Count_items_matching_a_rule;
using System.Collections.Generic;
namespace _1773.Count_items_matching_a_rule.Tests
{
[TestClass()]
public class _1773_Count_items_matching_a_rule_Test
{
_1773_Count_items_matching_a_rule s = new _1773_Count_items_matching_a_rule();
[TestMethod()]
public void CountMatches_Test1()
{
// Arrange
IList<IList<string>> items = new List<IList<string>>
{
new List<string>{ "phone", "blue", "pixel" },
new List<string>{ "computer", "silver", "lenovo" },
new List<string>{ "phone", "gold", "iphone" }
};
string ruleKey = "color";
string ruleValue = "silver";
var expected = 1;
// Act
var actual = s.CountMatches(items, ruleKey, ruleValue);
// Assert
Assert.AreEqual(expected, actual);
}
[TestMethod()]
public void CountMatches_Test2()
{
// Arrange
IList<IList<string>> items = new List<IList<string>>
{
new List<string>{ "phone", "blue", "pixel" },
new List<string>{ "computer","silver","phone" },
new List<string>{ "phone","gold","iphone" }
};
string ruleKey = "type";
string ruleValue = "phone";
var expected = 2;
// Act
var actual = s.CountMatches(items, ruleKey, ruleValue);
// Assert
Assert.AreEqual(expected, actual);
}
}
}