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 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");
        }
Beispiel #3
0
        public override string Execute(IWordDictionary wordDictionary)
        {
            var result = wordDictionary.Add(Key, Values.ToArray());
            var sb     = new StringBuilder();

            sb.Append("(");
            sb.Append(string.Join(",", result));
            sb.Append($"): values of word \"{Key}\" has been successfully added to dictionary.");
            return(sb.ToString());
        }
        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");
        }