Beispiel #1
0
        public void GetAllWordsGetsFromStore()
        {
            // arrange
            var collector = new Mock <ICollect>();
            var store     = new Mock <IStorage>();

            store.Setup(x => x.Get()).Returns(ExampleWords);
            var sut = new WordsController(collector.Object, store.Object);

            // act
            var result = sut.GetAllWords();

            // assert
            var expectedPosition = 1;
            var index            = 0;

            foreach (var expectedWord in ExampleWords())
            {
                var actualWord = result[index];
                Assert.AreEqual(expectedPosition, actualWord.Position);
                Assert.AreEqual(expectedWord.Key, actualWord.Name);
                Assert.AreEqual(expectedWord.Value, actualWord.Count);
                expectedPosition++;
                index++;
            }
        }