public override string Execute(IWordDictionary wordDictionary) { var result = wordDictionary.Delete(Key, Values); if (result.Count == 0) { return($"Word:\"{Key}\" is not exists in dictionary.{Environment.NewLine}"); } var sb = new StringBuilder(); foreach (var item in result) { if (item.Value == false) { sb.Append($"Word:\"{Key}\" value:\"{item.Key}\" is not exists in dictionary.{Environment.NewLine}"); } else { return($"Values of Word \"{Key}\" has been successfully deleted."); } } return(sb.ToString()); }
public void DeleteMethodTests() { _dictionary = _kernel.Get <IWordDictionary>(); _dictionary.Add(Key, new[] { "v1", "v2", "v3" }); _dictionary.Delete(Key, new[] { "v1" }); var coll = _dictionary.Get(Key).ToList(); CollectionAssert.DoesNotContain(coll, "v1"); }
public void DeleteNotInListMethodTests() { _dictionary = _kernel.Get <IWordDictionary>(); _dictionary.Delete(Key, new[] { "v1" }); CollectionAssert.DoesNotContain(_dictionary.Get("v1"), "v1"); }