Beispiel #1
0
        public void WhenLocalFileDepthIsEqualToMaxDepthValidationResultIsSuccess()
        {
            // Prepare
            int                        maxDepth      = 4;
            IConfiguration             configuration = MockFactory.ConfigurationWithMaximumDepthOf(maxDepth);
            MaximumTreeDepthValidation validation    = new MaximumTreeDepthValidation(configuration);
            var                        path          = Path.Combine(@"C:\", "first", "second", "third", "fourth");
            IFileInfo                  file          = MockFactory.FileWithPath(path);

            // Exercise
            IValidationResult validationResult = validation.Validate(file);

            // Verify
            AssertExtension.ValidationResultIsSuccess(validationResult, "Local file with depth equal to max depth triggers an error.");
        }
Beispiel #2
0
        public void WhenUNCFileIsDeeperThanMaxDepthValidationResultIsError()
        {
            // Prepare
            int                        maxDepth      = 3;
            IConfiguration             configuration = MockFactory.ConfigurationWithMaximumDepthOf(maxDepth);
            MaximumTreeDepthValidation validation    = new MaximumTreeDepthValidation(configuration);
            var                        tooDeepFile   = Path.Combine(@"\\server", "share$", "first", "second", "third", "fourth");
            IFileInfo                  file          = MockFactory.FileWithPath(tooDeepFile);

            // Exercise
            IValidationResult validationResult = validation.Validate(file);

            // Verify
            AssertExtension.ValidationResultIsError(validationResult, "Too deep local file does not trigger an error.");
        }
        public void WhenUNCFileDepthIsEqualToMaxDepthValidationResultIsSuccess()
        {
            // Prepare
            int                        maxDepth      = 4;
            IConfiguration             configuration = MockFactory.ConfigurationWithMaximumDepthOf(maxDepth);
            MaximumTreeDepthValidation validation    = new MaximumTreeDepthValidation(configuration);
            string                     path          = @"\\server\share$\first\second\third\fourth";
            IFileInfo                  file          = MockFactory.FileWithPath(path);

            // Exercise
            IValidationResult validationResult = validation.Validate(file);

            // Verify
            AssertExtension.ValidationResultIsSuccess(validationResult, "UNC file with depth equal to max depth triggers an error.");
        }
        public void WhenLocalDirectoryTreeDepthIsEqualToMaxDepthValidationResultIsSuccess()
        {
            // Prepare
            int                        maxDepth      = 4;
            IConfiguration             configuration = MockFactory.ConfigurationWithMaximumDepthOf(maxDepth);
            MaximumTreeDepthValidation validation    = new MaximumTreeDepthValidation(configuration);
            string                     path          = @"C:\first\second\third\fourth";
            IDirectoryInfo             directory     = MockFactory.DirectoryWithPath(path);

            // Exercise
            IValidationResult validationResult = validation.Validate(directory);

            // Verify
            AssertExtension.ValidationResultIsSuccess(validationResult, "Local file with depth equal to max depth triggers an error.");
        }
        public void WhenLocalFileIsDeeperThanMaxDepthValidationResultIsError()
        {
            // Prepare
            int                        maxDepth      = 3;
            IConfiguration             configuration = MockFactory.ConfigurationWithMaximumDepthOf(maxDepth);
            MaximumTreeDepthValidation validation    = new MaximumTreeDepthValidation(configuration);
            string                     tooDeepFile   = @"C:\first\second\third\fourth";
            IFileInfo                  file          = MockFactory.FileWithPath(tooDeepFile);

            // Exercise
            IValidationResult validationResult = validation.Validate(file);

            // Verify
            AssertExtension.ValidationResultIsError(validationResult, "Too deep local file does not trigger an error.");
        }