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 AddMethodTests() { _dictionary = _kernel.Get <IWordDictionary>(); _dictionary.Add(Key, new[] { "v1" }); CollectionAssert.Contains(_dictionary.Get(Key).ToList(), "v1"); _dictionary.Add(Key, new[] { "v2" }); CollectionAssert.Contains(_dictionary.Get(Key).ToList(), "v2"); _dictionary.Add(Key, new[] { "v2" }); Assert.AreEqual(_dictionary.Get(Key).ToList().Count, 2); CollectionAssert.DoesNotContain(_dictionary.Get(Key).ToList(), "v3"); _dictionary.Add(Key, new[] { string.Empty }); Assert.AreEqual(3, _dictionary.Get(Key).ToList().Count); }
public void GetMethodTests() { _dictionary = _kernel.Get <IWordDictionary>(); _dictionary.Add(Key, new[] { "v1", "v2", "v3" }); var set = _dictionary.Get(Key); var collection = set.ToList(); CollectionAssert.Contains(collection, "v1"); CollectionAssert.Contains(collection, "v2"); CollectionAssert.Contains(collection, "v3"); CollectionAssert.DoesNotContain(collection, "v4"); }
public override string Execute(IWordDictionary wordDictionary) { var result = wordDictionary.Get(Key); if (result.Length > 0) { var sb = new StringBuilder(); sb.Append(string.Join(Environment.NewLine, result)); return(sb.ToString()); } else { return($"a word \"{Key}\" is missing in dictionary"); } }
public void DeleteNotInListMethodTests() { _dictionary = _kernel.Get <IWordDictionary>(); _dictionary.Delete(Key, new[] { "v1" }); CollectionAssert.DoesNotContain(_dictionary.Get("v1"), "v1"); }