nassss

Untitled

Mar 27th, 2020
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. [TestMethod]
  2. public void Remove_ExistingElement_ShouldWorkCorrectly()
  3. {
  4. // Arrange
  5. MyDictionary<string, double> dictionary = new MyDictionary<string, double>
  6.  
  7. { { "Vasko", 12.5 }, { "Maria", 99.9 } };
  8.  
  9. // Assert
  10. Assert.AreEqual(2, dictionary.Count);
  11.  
  12. // Act
  13. bool removed = dictionary.Remove("Vasko");
  14.  
  15. // Assert
  16. Assert.IsTrue(removed);
  17. Assert.AreEqual(1, dictionary.Count);
  18. }
  19. [TestMethod]
  20. public void Remove_NonExistingElement_ShouldWorkCorrectly()
  21. {
  22. // Arrange
  23. MyDictionary<string, double> dictionary = new MyDictionary<string, double> { { "Peter", 12.5 }, { "Maria", 99.9 } };
  24.  
  25. // Assert
  26. Assert.AreEqual(2, dictionary.Count);
  27.  
  28. // Act
  29. bool removed = dictionary.Remove("Georgi");
  30.  
  31. // Assert
  32. Assert.IsFalse(removed);
  33. Assert.AreEqual(2, dictionary.Count);
  34. }
Advertisement
Add Comment
Please, Sign In to add comment