public void File_Has_One_Line_When_FizzBuzzFile_Is_Called()
        {
            FizzBuzzFile fizzBuzzFile = new FizzBuzzFile(fizzBuzzFileRepository, appSettingsRepositoryMock.Object);

            fizzBuzzFile.SetResultsInFile(3);

            Assert.AreEqual(1, File.ReadLines(path).Count());
        }
        public void The_File_Is_Created_When_FizzBuzzFile_Is_Called()
        {
            FizzBuzzFile fizzBuzzFile = new FizzBuzzFile(fizzBuzzFileRepository, appSettingsRepositoryMock.Object);

            fizzBuzzFile.SetResultsInFile(3);

            Assert.IsTrue(File.Exists(path));
        }
Пример #3
0
        public void Create_Fizz_Buzz_File_Is_Not_Called_When_There_Is_Not_Results()
        {
            appSettingsRepositoryMock.Setup(x => x.GetLimitValue())
            .Returns(0);

            FizzBuzzFile fizzBuzzFile = new FizzBuzzFile(fizzBuzzFileRepositoryMock.Object, appSettingsRepositoryMock.Object);

            fizzBuzzFile.SetResultsInFile(3);

            fizzBuzzFileRepositoryMock.Verify(x => x.Save(null), Times.Never);
        }
Пример #4
0
        public void Create_Fizz_Buzz_File_Is_Called_When_There_Is_Results()
        {
            appSettingsRepositoryMock.Setup(x => x.GetLimitValue())
            .Returns(1);

            FizzBuzzFile fizzBuzzFile = new FizzBuzzFile(fizzBuzzFileRepositoryMock.Object, appSettingsRepositoryMock.Object);

            fizzBuzzFile.SetResultsInFile(3);

            fizzBuzzFileRepositoryMock.Verify(x => x.Save(new List <string>()
            {
                "fizz"
            }), Times.Once);
        }