public void Get_GivenNonExistingKey_ThrowsException() { // arrange var sut = new MemoryBackingStore(); // assert Assert.Throws<KeyNotFoundException>(() => sut.Get("someKeyThatDoesn'tExist")); }
public void Get_GivenNullKey_ThrowsException() { // arrange var sut = new MemoryBackingStore(); // assert Assert.Throws<ArgumentNullException>(() => sut.Get(null)); }
[Test] // silently tests MemoryBackingStore.Add as well public void Get_GivenExistingKey_ReturnsValue() { // arrange var sut = new MemoryBackingStore(); var expected = new object(); sut.Add("ThisKeyExists", expected); // act var actual = sut.Get("ThisKeyExists"); // assert Assert.That(actual, Is.SameAs(expected)); }