public void Input_validator_returns_1_if_file_does_not_exist()
        {
            // Given
            var fileName = string.Empty;
            var fileCheckerStub = new Mock<IFileChecker>();
            fileCheckerStub.Setup(fc => fc.FileExists(fileName)).Returns(false);
            var validator = new InputFileValidator(fileCheckerStub.Object, null, null);

            // When
            var result = validator.Validate(fileName);

            // Then
            result.Should().Be(1);
        }
        public void Input_validator_returns_0_if_all_validators_pass()
        {
            // Given
            var fileName = string.Empty;

            var fileCheckerStub = new Mock<IFileChecker>();
            fileCheckerStub.Setup(fc => fc.FileExists(fileName)).Returns(true);

            var textFileCheckerStub = new Mock<ITextFileChecker>();
            textFileCheckerStub.Setup(tfc => tfc.IsTextFile(fileName)).Returns(true).Verifiable();

            var permissionsCheckerStub = new Mock<IPermissionChecker>();
            permissionsCheckerStub.Setup(pc => pc.CanReadFile(fileName)).Returns(true).Verifiable();

            var validator = new InputFileValidator(fileCheckerStub.Object, textFileCheckerStub.Object, permissionsCheckerStub.Object);

            // When
            var result = validator.Validate(fileName);

            // Then
            result.Should().Be(0);
        }
        public void Input_validator_passes_the_correct_filename(string fileName)
        {
            // Given
            var fileCheckerMock = new Mock<IFileChecker>();
            fileCheckerMock.Setup(fc => fc.FileExists(fileName)).Returns(true).Verifiable();

            var textFileCheckerMock = new Mock<ITextFileChecker>();
            textFileCheckerMock.Setup(tfc => tfc.IsTextFile(fileName)).Returns(true).Verifiable();

            var permissionCheckerMock = new Mock<IPermissionChecker>();
            permissionCheckerMock.Setup(pc => pc.CanReadFile(fileName)).Verifiable();

            var validator = new InputFileValidator(fileCheckerMock.Object, textFileCheckerMock.Object, permissionCheckerMock.Object);

            // When
            validator.Validate(fileName);

            // Then
            fileCheckerMock.Verify();
            textFileCheckerMock.Verify();
            permissionCheckerMock.Verify();
        }
        public void Input_validator_returns_2_if_file_is_not_textFile()
        {
            // Given
            var fileName = string.Empty;

            var fileCheckerStub = new Mock<IFileChecker>();
            fileCheckerStub.Setup(fc => fc.FileExists(fileName)).Returns(true);

            var textFileCheckerStub = new Mock<ITextFileChecker>();
            textFileCheckerStub.Setup(tfc => tfc.IsTextFile(fileName)).Returns(false);

            var validator = new InputFileValidator(fileCheckerStub.Object, textFileCheckerStub.Object, null);

            // When
            var result = validator.Validate(fileName);

            // Then
            result.Should().Be(2);
        }