Esempio n. 1
0
        public void FileExists_ShouldReturnWords()
        {
            var config   = this.CreateConfig("words_alpha.txt", "Resources");
            var provider = new FileWordProvider(config, this.loggerMock.Object);

            var works = provider.GetWords();

            works.Should().NotBeEmpty();
        }
Esempio n. 2
0
        public void PathIsNull_ShouldThrowException()
        {
            Assert.Throws <ArgumentNullException>(() =>
            {
                var provider = new FileWordProvider(null, this.loggerMock.Object);
            });

            Assert.Throws <ArgumentNullException>(() =>
            {
                var provider = new FileWordProvider(new GameConfiguration(), null);
            });
        }
Esempio n. 3
0
        public void FileNotExists_ShouldNotReturnWords()
        {
            var config   = this.CreateConfig("someFile.txt", "Resources");
            var provider = new FileWordProvider(config, this.loggerMock.Object);

            Assert.Throws <InvalidOperationException>(() =>
            {
                var works = provider.GetWords();
            });

            this.loggerMock.Verify(m => m.Error(It.IsAny <FileNotFoundException>(), It.IsAny <string>()));
        }