コード例 #1
0
        public void CountTest(string str, double expectedResult)
        {
            var length = new AverageWordsLengthCounter(str);

            var result = length.Count();

            Assert.That(result, Is.EqualTo(expectedResult));
        }
コード例 #2
0
        public void CountExceptionTest(string str)
        {
            var length = new AverageWordsLengthCounter(str);

            void Result() => length.Count();

            Assert.Throws(Is.TypeOf <ArgumentException>()
                          .And.Message.EqualTo("Was printed the string without words"),
                          Result);
        }