public void Output_validator_returns_4_if_file_does_exists() { // Given var fileName = string.Empty; var fileCheckerStub = new Mock <IFileChecker>(); fileCheckerStub.Setup(fc => fc.FileExists(fileName)).Returns(true); var validator = new OutputFileValidator(fileCheckerStub.Object, null); // When var result = validator.Validate(fileName); // Then result.Should().Be(4); }
public void Output_validator_returns_0_if_all_validators_pass() { // Given var fileName = string.Empty; var fileCheckerStub = new Mock <IFileChecker>(); fileCheckerStub.Setup(fc => fc.FileExists(fileName)).Returns(false); var fileCreateStub = new Mock <IFileCreate>(); fileCreateStub.Setup(fc => fc.CanCreate(fileName)).Returns(true); var validator = new OutputFileValidator(fileCheckerStub.Object, fileCreateStub.Object); // When var result = validator.Validate(fileName); // Then result.Should().Be(0); }
public void Output_validator_passes_the_correct_filename(string fileName) { // Given var fileCheckerMock = new Mock <IFileChecker>(); fileCheckerMock.Setup(fc => fc.FileExists(fileName)).Returns(false).Verifiable(); var fileCreateMock = new Mock <IFileCreate>(); fileCreateMock.Setup(fc => fc.CanCreate(fileName)).Returns(true).Verifiable(); var validator = new OutputFileValidator(fileCheckerMock.Object, fileCreateMock.Object); // When validator.Validate(fileName); // Then fileCheckerMock.Verify(); fileCreateMock.Verify(); }