Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [TestMethod]
- public void Remove_ExistingElement_ShouldWorkCorrectly()
- {
- // Arrange
- MyDictionary<string, double> dictionary = new MyDictionary<string, double>
- { { "Vasko", 12.5 }, { "Maria", 99.9 } };
- // Assert
- Assert.AreEqual(2, dictionary.Count);
- // Act
- bool removed = dictionary.Remove("Vasko");
- // Assert
- Assert.IsTrue(removed);
- Assert.AreEqual(1, dictionary.Count);
- }
- [TestMethod]
- public void Remove_NonExistingElement_ShouldWorkCorrectly()
- {
- // Arrange
- MyDictionary<string, double> dictionary = new MyDictionary<string, double> { { "Peter", 12.5 }, { "Maria", 99.9 } };
- // Assert
- Assert.AreEqual(2, dictionary.Count);
- // Act
- bool removed = dictionary.Remove("Georgi");
- // Assert
- Assert.IsFalse(removed);
- Assert.AreEqual(2, dictionary.Count);
- }
Advertisement
Add Comment
Please, Sign In to add comment