コード例 #1
0
        public void WordLen()
        {
#if !DEBUG
        Assert.Multiple(() => {
#endif
            var expected = new Dictionary<string, int> { { "bb", 2 }, { "a", 1 } };
            var actual = _object.WordLen(new[] { "a", "bb", "a", "bb" });
            CollectionAssert.AreEquivalent(expected, actual);

            expected = new Dictionary<string, int> { { "that", 4 }, { "and", 3 }, { "this", 4 } };
            actual = _object.WordLen(new[] { "this", "and", "that", "and" });
            CollectionAssert.AreEquivalent(expected, actual);

            expected = new Dictionary<string, int> { { "code", 4 }, { "bug", 3 } };
            actual = _object.WordLen(new[] { "code", "code", "code", "bug" });
            CollectionAssert.AreEquivalent(expected, actual);

            expected = new Dictionary<string, int>();
            actual = _object.WordLen(new string[0]);
            CollectionAssert.AreEquivalent(expected, actual);

            expected = new Dictionary<string, int> { { "z", 1 } };
            actual = _object.WordLen(new[] { "z" });
            CollectionAssert.AreEquivalent(expected, actual);
#if !DEBUG
    });
#endif
        }