public void CanGetApiKey(bool shouldThrowException, string expected, string key, string value) { var dictionary = new Hashtable(); if (!string.IsNullOrWhiteSpace(key)) { dictionary.Add(key, value); } if (shouldThrowException) { Assert.Throws <System.ApplicationException>(() => dictionary.ApiKey()); } else { Assert.That(dictionary.ApiKey(), Is.EqualTo(expected)); } }