Exemplo n.º 1
0
        public void Init()
        {
            _directoryValidator = new DirectoryValidator();
            _directoryValidator.Initialize(new CachedValidationRegistry(),
                                           typeof(TestTarget).GetProperty("TargetField"));

            _filePathValidator = new FilePathValidator();
            _filePathValidator.Initialize(new CachedValidationRegistry(), typeof(TestTarget).GetProperty("TargetField"));

            _target = new TestTarget();
        }
Exemplo n.º 2
0
        public void IsValidInputFilePath_Returns_false_If_FilePath_Is_Empty()
        {
            var config            = new Mock <IConfiguration>();
            var filePathValidator = new FilePathValidator(config.Object);

            // giving an empty file path
            config.SetupProperty(c => c.FilePath, "");

            var exists = filePathValidator.IsValidInputFilePath();

            Assert.That(exists is false);
        }
        protected override void Arrange()
        {
            base.Arrange();

            var applicationModel = new Mock <IApplicationModel>();

            applicationModel.Setup(x => x.ConfigurationFilePath).Returns(Path.Combine(Environment.CurrentDirectory,
                                                                                      "test.config"));

            PathProperty.Value = ">??<";
            validator          = new FilePathValidator()
            {
                ApplicationModel = applicationModel.Object
            };
        }
 public void Setup()
 {
     filePathValidator = new FilePathValidator();
     filePath          = $"{Environment.CurrentDirectory}\\{Constants.TestFileName}";
 }