public void Add_WhenTerminalIsNotInSet_AddTerminalToSet() { // Arrange: var ts = new TerminalSet(); const string terminal = "t"; // Act: ts.Add(terminal); // Assert: Assert.AreEqual(1, ts.AsEnumerable().Count()); Assert.IsTrue(ts.AsEnumerable().Contains(terminal)); }
public void Union_WhenTwoSets_ReturnsUnionOfSets(string[] set1, string[] set2, string[] expected) { // Arrange: var ts1 = new TerminalSet(); foreach (var terminal in set1) { ts1.Add(terminal); } var ts2 = new TerminalSet(); foreach (var terminal in set2) { ts2.Add(terminal); } // Act: ts1.Union(ts2, false); // Assert: Assert.That(ts1.AsEnumerable(), Is.EquivalentTo(expected)); }