public void RemoveKvp() { Dictionary <string, string> backingKeys = GetBackingKeys(); BasicApiKeyService service = new BasicApiKeyService(backingKeys); service.Clear(); KeyValuePair <string, string> item = new KeyValuePair <string, string>(_appId2, _secretKey2); bool succeded = service.Remove(item); Assert.False(succeded); service.Add(item); string result = service[_appId2]; Assert.Equal(_secretKey2, result); succeded = service.Remove(item); Assert.True(succeded); Assert.Empty(service); }
public void Remove() { Dictionary <string, string> backingKeys = GetBackingKeys(); BasicApiKeyService service = new BasicApiKeyService(backingKeys); string retrievedSecret = service[_appId]; service.Remove(_appId); string retrievedSecret2 = null; Assert.Throws <KeyNotFoundException>(() => retrievedSecret2 = service[_appId]); Assert.Empty(service); Assert.NotNull(retrievedSecret); Assert.Null(retrievedSecret2); }