예제 #1
0
 public void Setup()
 {
     _project = new BuildProject();
     _dirBaseProperty = new Property("dirBase", "c:\\temp");
     _project.AddProperty(_dirBaseProperty);
     _subject = new OutputGenerator(_project);
 }
예제 #2
0
        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\");"));
        }
예제 #3
0
        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\");"));
        }
예제 #4
0
        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};"));
        }
예제 #5
0
        //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();
        }
예제 #6
0
        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\");"));
        }
예제 #7
0
 public void ShouldRegisterDependancyOnOtherProperty()
 {
     var subject = new Property("test", @"${build.dir}\test.dll");
     Assert.That(subject.DependsOnProperty[0], Is.EqualTo("build_dir"));
 }
예제 #8
0
 public void ShouldParseLongProperty()
 {
     var subject = new Property("test", "value=\"${directory::get-current-directory()}\"");
     Assert.That(subject.DependsOnProperty[0], Is.EqualTo("directory::get-current-directory()"));
 }
예제 #9
0
 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"));
 }
예제 #10
0
 public void ShouldDeterminePropertyIsAFolderWhenParentFoldersHaveDots()
 {
     var subject = new Property("test", "dir.base\\tools\\nunt");
     Assert.That(subject.Type, Is.EqualTo(PropertyType.Directory));
 }
예제 #11
0
 public void ShouldDeterminePropertyIsAFileWithShortExtension()
 {
     var subject = new Property("test", "test.cs");
     Assert.That(subject.Type, Is.EqualTo(PropertyType.File));
 }
예제 #12
0
 public void ShouldDeterminePropertyIsAFileWhenPartOfADirectory()
 {
     var subject = new Property("test", "c:\\temp\\test.dll");
     Assert.That(subject.Type, Is.EqualTo(PropertyType.File));
 }
예제 #13
0
 public void ShouldDeterminePropertyIsAFile()
 {
     var subject = new Property("test", "test.dll");
     Assert.That(subject.Type, Is.EqualTo(PropertyType.File));
 }
예제 #14
0
 public void ShouldDeterminePropertyIsADirectory()
 {
     var subject = new Property("test", "c:\\temp");
     Assert.That(subject.Type, Is.EqualTo(PropertyType.Directory));
 }