public void Add_WithValidInput_ShouldStoreInMemory() { // Arrange var repo = new NegativeWordsRepository(); var negativeWord = new NegativeWord("shouldStoreInMemory"); var countPreSave = repo.NegativeWords.Count; // Act var persisted = repo.Add(negativeWord); //Assert Assert.AreEqual(negativeWord, persisted); Assert.AreEqual(repo.NegativeWords.Count, countPreSave + 1); }
public void Get_ShouldReturnFromMemory() { // Arrange var repo = new NegativeWordsRepository(); repo.NegativeWords = new List <NegativeWord>() { new NegativeWord("shouldReturnFromMemory") }; // Act var persisted = repo.GetAll(); //Assert Assert.AreEqual(persisted.Count, repo.NegativeWords.Count); }
public void Remove_WithValidInput_ShouldRemoveFromMemory() { // Arrange var repo = new NegativeWordsRepository(); var negativeWord = new NegativeWord("shouldRemoveFromMemory"); repo.NegativeWords.Add(negativeWord); var countPreSave = repo.NegativeWords.Count; // Act repo.Remove(negativeWord); //Assert Assert.AreEqual(repo.NegativeWords.Count, countPreSave - 1); Assert.IsNull(repo.NegativeWords.SingleOrDefault(w => w.Equals(negativeWord))); }