// NAnt - A .NET build tool // Copyright (C) 2002 Scott Hernandez (ScottHernandez@hotmail.com) // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // Scott Hernandez (ScottHernandez@hotmail.com) using System; using System.IO; using System.Reflection; using System.Text; using System.Xml; using NUnit.Framework; namespace Tests.NAnt.Core.Tasks { [TestFixture] public class PropertyTest : BuildTestBase { [Test] public void Test_PropCreate() { string _xml = @" "; string result = RunBuild(_xml); Assert.IsTrue(result.IndexOf("I Love you") != -1, "Property value not set." + Environment.NewLine + result); } [Test] public void Test_PropReset() { string _xml = @" "; string result = RunBuild(_xml); Assert.IsTrue(result.IndexOf("I Love me") != -1, "Property value not re-set." + Environment.NewLine + result); } /// /// Overwriting a read-only property should result in build error. /// [Ignore("For now, we only output a warning message when read-only properties are overwritten.")] [Test] [ExpectedException(typeof(TestBuildException))] public void Test_ROSet() { string _xml = @" "; RunBuild(_xml); } [Test] public void Test_NoOverwriteProperty() { string _xml = @" "; string result = RunBuild(_xml); Assert.IsTrue(result.IndexOf("I Love me") == -1, "Property value should not have been overwritten." + Environment.NewLine + result); } [Test] public void Test_OverwriteProperty() { string _xml = @" "; string result = RunBuild(_xml); Assert.IsTrue(result.IndexOf("I Love me") != -1, "Property value should have been overwritten." + Environment.NewLine + result); } /// /// Overwriting a read-only property should result in build error. /// [Ignore("For now, we only output a warning message when read-only properties are overwritten.")] [Test] [ExpectedException(typeof(TestBuildException))] public void Test_OverwriteReadOnlyProperty() { string _xml = @" "; RunBuild(_xml); } [Test] public void Test_DynamicProperty() { string _xml = @" "; string result = RunBuild(_xml); Assert.IsTrue(result.IndexOf("I Love you") != -1, "Value of dynamic property should have reflected change in referenced property." + Environment.NewLine + result); } [Test] [ExpectedException(typeof(TestBuildException))] public void Test_DynamicPropertyNotExisting() { string _xml = @" "; RunBuild(_xml); } [Test] [ExpectedException(typeof(TestBuildException))] public void Test_DynamicPropertyCircularReference() { string _xml = @" "; RunBuild(_xml); } [Test] public void Test_ChangeStaticPropertyToDynamic() { string _xml = @" "; string result = RunBuild(_xml); Assert.IsTrue(result.IndexOf("I Love you") != -1, "Static property should be upgraded to dynamic property." + Environment.NewLine + result); } [Test] public void Test_ReadOnlyDynamicProperty() { string _xml = @" "; string result = RunBuild(_xml); Assert.IsTrue(result.IndexOf("I Love you") != -1, "Value of read-only dynamic property should have reflected change in referenced property." + Environment.NewLine + result); } } }