public StorEvilStoryElement(StorEvilTestProvider provider, UnitTestElement parent, IProject project, string title, ConfigSettings config, string id) : base(provider, parent, project, title) { Config = config; Id = id; _namespace = new UnitTestNamespace(project.Name + " " + title); }
private IEnumerable<Story> GetStoriesForProject(ConfigSettings config) { var filesystemStoryReader = new FilesystemStoryReader(new Filesystem(), config); var storyProvider = new StoryProvider(filesystemStoryReader, new StoryParser()); return storyProvider.GetStories(); }
public ConfigSettings Read(string contents) { var nonBlankLines = GetNonBlankLines(contents); var lines = StripCommentLines(nonBlankLines); var settings = new ConfigSettings(); foreach (var line in lines) { var indexOfSeparator = line.IndexOf(":"); string settingName; string settingValue; if (indexOfSeparator > 0) { settingName = line.Substring(0, indexOfSeparator).Trim().ToLowerInvariant(); settingValue = line.Substring(indexOfSeparator + 1).Trim(); } else { settingName = line; settingValue = ""; } if (!ApplySettingValue(settings, settingName, settingValue)) { throw new BadSettingNameException( settingName, line); } } return settings; }
public FilesystemStoryReader(IFilesystem filesystem, ConfigSettings settings) { _settings = settings; Filesystem = filesystem; _filter = new FileExtensionFilter(_settings); }
public IStorEvilJob ParseArguments(string[] args) { _settings = ParseCommonConfigSettings(Container, args); SetupContainer(Container, args); return Container.Resolve<IStorEvilJob>(); }
public void SetupContext() { FakeFilesystem = MockRepository.GenerateMock<IFilesystem>(); Settings = new ConfigSettings { StoryBasePath = BasePath }; Reader = new SingleFileStoryReader(FakeFilesystem, Settings, "foo.feature"); FakeFilesystem.Stub(x => x.GetFileText("foo.feature")).Return("foo"); }
public void SetupContext() { FakeFilesystem = MockRepository.GenerateMock<IFilesystem>(); Settings = new ConfigSettings {StoryBasePath = BasePath}; Reader = new FilesystemStoryReader(FakeFilesystem, Settings); FakeFilesystem.Stub(x => x.GetFilesInFolder(BasePath)) .Return(new[] {"ignore.txt", "feature.feature","bar.story"}); FakeFilesystem.Stub(x => x.GetSubFolders(BasePath)) .Return(new string[0]); }
public void sets_story_base_path_to_current_directory_if_not_specified() { // note: should make successive calls up the directory structure // first \test\foo\bar, then \test\foo, then \test string workingDirectory = "c:\\test\\foo\\"; ConfigFileExistsAt(workingDirectory + "storevil.config"); var settings = new ConfigSettings(); ParserReturnsConfigSettings(settings); var result = FilesystemConfigReader.GetConfig(workingDirectory); result.StoryBasePath.ShouldEqual(workingDirectory); }
public void SetupContainer(Container container, ConfigSettings settings, string[] args) { if (args.Length <= 1) { container.Register<IStorEvilJob>(new DisplayHelpJob(GetStandardHelpText())); return; } var helpJobFactory = new ContainerConfiguratorFactory(settings).GetConfigurator(args[1]); if (helpJobFactory != null) container.Register<IStorEvilJob>( new DisplayHelpJob(GetStandardHelpText() + "\r\n\r\nSwitches for '" + args[1] + "': \r\n\r\n" + helpJobFactory.GetUsage())); else container.Register<IStorEvilJob>(new DisplayHelpJob(GetStandardHelpText())); }
private static bool ApplySettingValue(ConfigSettings settings, string settingName, string settingValue) { if (settingName == "assemblies") settings.AssemblyLocations = SplitSettingValue(settingValue); else if (settingName == "extensions") settings.ScenarioExtensions = SplitSettingValue(settingValue); else if (settingName == "outputfile") settings.OutputFile = settingValue; else if (settingName == "outputfileformat") settings.OutputFileFormat = settingValue; else if (settingName == "outputfiletemplate") settings.OutputFileTemplate = settingValue; else return false; return true; }
public FilesystemStoryReader(IFilesystem filesystem, ConfigSettings settings) { _settings = settings; Filesystem = filesystem; }
public ContainerConfiguratorFactory(ConfigSettings settings) { _settings = settings; }
private void FixUpPaths(string basePath, ConfigSettings settings) { settings.AssemblyLocations = settings.AssemblyLocations.Select(x => FixUpPath(basePath, x)); }
public StorEvilProject(ConfigSettings configSettings) { ConfigSettings = configSettings; }
public FileExtensionFilter(ConfigSettings settings) { _settings = settings; }
public RemoteHandlerFactory(AssemblyGenerator assemblyGenerator, ConfigSettings settings, IFilesystem filesystem) { _assemblyGenerator = assemblyGenerator; _settings = settings; _filesystem = filesystem; }
public void SetupContext() { Result = ParseConfig(TestConfigContents); }
public ListenerBuilder(ConfigSettings settings) { _settings = settings; }
public SingleFileStoryReader(IFilesystem filesystem, ConfigSettings settings, string filename) { _filesystem = filesystem; _settings = settings; _filename = filename; }
private void ShouldReturnConfigFileWhenCalledFrom(string workingDirectory) { var settings = new ConfigSettings(); ParserReturnsConfigSettings(settings); var result = FilesystemConfigReader.GetConfig(workingDirectory); Assert.That(result, Is.SameAs(settings)); }
private void AddStoryElement(ConfigSettings config, Story story, IProject project, UnitTestElementConsumer consumer, StorEvilProjectElement parent) { var storyElement = new StorEvilStoryElement(this, parent, project, story.Summary, config, story.Id); consumer(storyElement); foreach (var scenario in story.Scenarios) AddScenarioElement(project, consumer, storyElement, scenario); }
private void ParserReturnsConfigSettings(ConfigSettings settings) { _fakeParser.Stub(x => x.Read(FakeConfigFileContents)).Return(settings); }
public void SetupContext() { FakeFilesystem = MockRepository.GenerateMock<IFilesystem>(); Settings = new ConfigSettings {StoryBasePath = BasePath, ScenarioExtensions = new string[] {}}; Reader = new FilesystemStoryReader(FakeFilesystem, Settings); FakeFilesystem.Stub(x => x.GetFilesInFolder(BasePath)) .Return(new[] { "ignore.txt", "feature.feature" }); FakeFilesystem.Stub(x => x.GetFileText(BasePath + "\\ignore.txt")) .Return(NotAStory); FakeFilesystem.Stub(x => x.GetFileText(BasePath + "\\feature.feature")) .Return(AStory); FakeFilesystem.Stub(x => x.GetSubFolders(BasePath)) .Return(new string[0]); }