public void Should_Throw_Exception_If_Directory_Has_Subdirectories() { // arrange var workingDirectory = TestFileSystem.CreateTempWorkingDirectory(); TestFileSystem.CreateSubdirectory(baseDirectory: workingDirectory, subdirectoryName: "subdir"); var rule = new SubdirectoriesValidationRule(); // act & assert Action action = () => rule.Validate(workingDirectory); action.ShouldThrow <DirectoryHasSubdirectoriesException>() .WithMessage("Directory with database scripts must have no subdirectories"); }