示例#1
0
        public void Throws_ArgumentException_OnNull()
        {
            //Arrange
            var service = new LetterCounterService();

            //Act
            Assert.ThrowsException <ArgumentException>(() => service.CountLetters(null));
        }
示例#2
0
        public void CanIgnoreWhitespace()
        {
            //Arrange
            string input   = "a a";
            var    service = new LetterCounterService();

            //Act
            var letterCount = service.CountLetters(input);

            //Assert
            Assert.AreEqual(1, letterCount.Count);
            Assert.AreEqual(2, letterCount['a']);
        }
示例#3
0
        public void CanCountLetters()
        {
            //Arrange
            string input   = "abbcccddddeeeeeffffff";
            var    service = new LetterCounterService();

            //Act
            var letterCount = service.CountLetters(input);

            //Assert
            Assert.AreEqual(6, letterCount.Count);
            Assert.AreEqual(1, letterCount['a']);
            Assert.AreEqual(2, letterCount['b']);
            Assert.AreEqual(3, letterCount['c']);
            Assert.AreEqual(4, letterCount['d']);
            Assert.AreEqual(5, letterCount['e']);
            Assert.AreEqual(6, letterCount['f']);
        }
        public void CanCountLetters()
        {
            //Arrange
            string input   = "allegro";
            var    service = new LetterCounterService();

            //Act
            var letterCount = service.CountLetters(input);

            //Assert
            Assert.AreEqual(6, letterCount.Count);
            Assert.AreEqual(1, letterCount['a']);
            Assert.AreEqual(2, letterCount['l']);
            Assert.AreEqual(1, letterCount['e']);
            Assert.AreEqual(1, letterCount['g']);
            Assert.AreEqual(1, letterCount['r']);
            Assert.AreEqual(1, letterCount['o']);
        }