public void WhenUNCPathRelativePartIsEqualToMaximumPathLengthValidationResultIsSuccess() { // Prepare int maxPathLength = 5; IConfiguration configuration = MockFactory.ConfigurationWithMaximumPathLengthOf(maxPathLength); MaximumPathLengthValidation validation = new MaximumPathLengthValidation(configuration); string path = "\\\\servername\\share$\\asdf"; IFileInfo file = MockFactory.FileWithPath(path); // Exercise IValidationResult validationResult = validation.Validate(file); // Verify AssertExtension.ValidationResultIsSuccess(validationResult, "File with UNC path relative parth length equal to max path length triggers an error."); }
public void WhenLocalFilePathIsEqualToMaxPathLengthValidationResultIsSuccess() { // Prepare int maxPathLength = 20; IConfiguration configuration = MockFactory.ConfigurationWithMaximumPathLengthOf(maxPathLength); MaximumPathLengthValidation validation = new MaximumPathLengthValidation(configuration); string path = "C:/asdfasdf/asdfasdf"; IFileInfo file = MockFactory.FileWithPath(path); // Exercise IValidationResult validationResult = validation.Validate(file); // Verify AssertExtension.ValidationResultIsSuccess(validationResult, "File with path length equal to max path length triggers an error."); }
public void WhenUNCPathIsTooLongValidationResultIsError() { // Prepare int maxPathLength = 3; IConfiguration configuration = MockFactory.ConfigurationWithMaximumPathLengthOf(maxPathLength); MaximumPathLengthValidation validation = new MaximumPathLengthValidation(configuration); string path = "\\\\servername\\share$\\asdfasdf\\asdfasdf"; IFileInfo file = MockFactory.FileWithPath(path); // Exercise IValidationResult validationResult = validation.Validate(file); // Verify AssertExtension.ValidationResultIsError(validationResult, "File with path length longer than max path length does not trigger an error."); }
public void WhenLocalPathIsTooLongValidationResultIsError() { // Prepare int maxPathLength = 20; IConfiguration configuration = MockFactory.ConfigurationWithMaximumPathLengthOf(maxPathLength); MaximumPathLengthValidation validation = new MaximumPathLengthValidation(configuration); string tooLongPath = "C:/asdfasdf/asdfasdf/asdfasdf"; IFileInfo file = MockFactory.FileWithPath(tooLongPath); // Exercise IValidationResult validationResult = validation.Validate(file); // Verify AssertExtension.ValidationResultIsError(validationResult, "File with too long path does not trigger an error."); }
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."); }
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 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."); }