public void Setup() { _project = new BuildProject(); _dirBaseProperty = new Property("dirBase", "c:\\temp"); _project.AddProperty(_dirBaseProperty); _subject = new OutputGenerator(_project); }
public void ShouldDetermineThatThereIsAStringSubFolder() { var fileProperty = new Property("tools.nunitConsole", "${dirBase}\\tools\\nunit-console.exe"); _project.AddProperty(fileProperty); _subject.CreatePropertySetter(_dirBaseProperty); string output = _subject.CreatePropertySetter(fileProperty); Assert.That(output, Is.EqualTo("_tools_nunitConsole = _dirBase.SubFolder(\"tools\").File(\"nunit-console.exe\");")); }
public void BuildPropertyShouldBuildFileOnExistingVariable() { var fileProperty = new Property("dirTools", "${dirBase}\\test.dll"); _project.AddProperty(fileProperty); _subject.CreatePropertySetter(_dirBaseProperty); string output = _subject.CreatePropertySetter(fileProperty); Assert.That(output, Is.EqualTo("_dirTools = _dirBase.File(\"test.dll\");")); }
public void BuildPropertyShouldBuildCommentOnUnkownType() { var version = new Property("nant.settings.frameworkVersion", "${net-3.5}"); version.Type = PropertyType.Unkown; _project.AddProperty(version); string output = _subject.CreatePropertySetter(version); Assert.That(output, Is.EqualTo("//_nant_settings_frameworkVersion = ${net-3.5};")); }
//analzies the given property and its dependancies //and anything that depends on the property to further discover its type public static void RecomputeTypeFor(Property property) { var thisPropertyDependsOnCount = (from Property p in Properties where property.DependsOnProperty.Contains(p.Name) select p).Count(); var otherPropertiesDependOnThisPropertyCount = (from Property p in Properties where p.DependsOnProperty.Contains(property.Name) select p).Count(); }
public void BuildPropertyShouldBuildSubFolderOnExistingVariable() { var toolsProperty = new Property("dirTools", "${dirBase}\\tools"); _project.AddProperty(toolsProperty); _subject.CreatePropertySetter(_dirBaseProperty); string output = _subject.CreatePropertySetter(toolsProperty); Assert.That(output, Is.EqualTo("_dirTools = _dirBase.SubFolder(\"tools\");")); }
public void ShouldRegisterDependancyOnOtherProperty() { var subject = new Property("test", @"${build.dir}\test.dll"); Assert.That(subject.DependsOnProperty[0], Is.EqualTo("build_dir")); }
public void ShouldParseLongProperty() { var subject = new Property("test", "value=\"${directory::get-current-directory()}\""); Assert.That(subject.DependsOnProperty[0], Is.EqualTo("directory::get-current-directory()")); }
public void ShouldRegisterDependancyOnMultipleProperties() { var subject = new Property("test", @"${build.dir}\${tests}\test.dll"); Assert.That(subject.DependsOnProperty[0], Is.EqualTo("build_dir")); // Assert.That(subject.DependsOnProperty[1], Is.EqualTo("tests")); }
public void ShouldDeterminePropertyIsAFolderWhenParentFoldersHaveDots() { var subject = new Property("test", "dir.base\\tools\\nunt"); Assert.That(subject.Type, Is.EqualTo(PropertyType.Directory)); }
public void ShouldDeterminePropertyIsAFileWithShortExtension() { var subject = new Property("test", "test.cs"); Assert.That(subject.Type, Is.EqualTo(PropertyType.File)); }
public void ShouldDeterminePropertyIsAFileWhenPartOfADirectory() { var subject = new Property("test", "c:\\temp\\test.dll"); Assert.That(subject.Type, Is.EqualTo(PropertyType.File)); }
public void ShouldDeterminePropertyIsAFile() { var subject = new Property("test", "test.dll"); Assert.That(subject.Type, Is.EqualTo(PropertyType.File)); }
public void ShouldDeterminePropertyIsADirectory() { var subject = new Property("test", "c:\\temp"); Assert.That(subject.Type, Is.EqualTo(PropertyType.Directory)); }