public void ClearTest() { // Arrange var retorts = new Retorts("test"); var question = "question1_test"; var answer = "defaultAnswer1_test"; retorts.Add(question.Trim(), answer); Assert.True(retorts.Count() > 0); var expectedSize = 0; // Act retorts.Clear(); var actualSize = retorts.Count(); // Assert Assert.Equal(expectedSize, actualSize); }
public void ContainsTest(string question, bool expected, bool existsBefore) { // Arrange var retorts = new Retorts("test"); retorts.Clear(); var answer = "defaultAnswer1"; if (existsBefore) { retorts.Add(question.Trim(), answer); } // Act var result = retorts.Contains(question); // Assert Assert.Equal(expected, result); }
public void RemoveTest(string line, bool expected, bool existsBefore) { // Arrange var retorts = new Retorts("test"); retorts.Clear(); var question = (!string.IsNullOrWhiteSpace(line)) ? line.Split("|")[1] : ""; var answer = "defaultAnswer1"; if (existsBefore) { Assert.True(retorts.Add(question, answer)); } // Act var result = retorts.Remove(line); // Assert Assert.Equal(expected, result); }
public void CountTest(bool mustHaveEntries) { // Arrange var retorts = new Retorts("test"); retorts.Clear(); var expectedSize = 0; if (mustHaveEntries) { var question = "question1_test"; var answer = "defaultAnswer1_test"; Assert.True(retorts.Add(question.Trim(), answer)); expectedSize = 1; } // Act var actualSize = retorts.Count(); // Assert Assert.Equal(expectedSize, actualSize); }