bloritsch    2003/06/27 06:25:24

  Modified:    csframework AvalonFramework.build
               csframework/src/test AssemblyInfo.cs AttributesTestCase.cs
  Added:       csframework/src/test AbstractConfigurationTestCase.cs
                        ConfigurationCollectionTestCase.cs
                        ConfigurationExceptionTestCase.cs
                        ContextExceptionTestCase.cs
                        DefaultConfigurationTestCase.cs
                        DefaultContextTestCase.cs
                        ParameterExceptionTestCase.cs
                        ServiceExceptionTestCase.cs
  Removed:     csframework/src/test/Configuration
                        AbstractConfigurationTestCase.cs
                        ConfigurationCollectionTestCase.cs
                        ConfigurationExceptionTestCase.cs
                        DefaultConfigurationTestCase.cs
               csframework/src/test/Context ContextExceptionTestCase.cs
                        DefaultContextTestCase.cs
               csframework/src/test/Parameters
                        ParameterExceptionTestCase.cs
               csframework/src/test/Service ServiceExceptionTestCase.cs
  Log:
  merge the test namespace
  
  Revision  Changes    Path
  1.12      +1 -1      avalon-sandbox/csframework/AvalonFramework.build
  
  Index: AvalonFramework.build
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/csframework/AvalonFramework.build,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- AvalonFramework.build     26 Jun 2003 18:19:39 -0000      1.11
  +++ AvalonFramework.build     27 Jun 2003 13:25:23 -0000      1.12
  @@ -35,7 +35,7 @@
     </target>
   
     <target name="test" depends="build-test" description="Run the NUnit tests">
  -     <nunit2 haltonfailure="true">
  +     <nunit2>
          <test assemblyname="${library.name}-test.dll"/>
        </nunit2>
     </target>
  
  
  
  1.2       +3 -3      avalon-sandbox/csframework/src/test/AssemblyInfo.cs
  
  Index: AssemblyInfo.cs
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/csframework/src/test/AssemblyInfo.cs,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- AssemblyInfo.cs   25 Jun 2003 12:15:23 -0000      1.1
  +++ AssemblyInfo.cs   27 Jun 2003 13:25:23 -0000      1.2
  @@ -54,11 +54,11 @@
   // set of attributes. Change these attribute values to modify the information
   // associated with an assembly.
   //
  -[assembly: AssemblyTitle("AvalonFramework")]
  -[assembly: AssemblyDescription("Avalon Framework defines the lifecycle interfaces 
and contracts that all components must obey.")]
  +[assembly: AssemblyTitle("AvalonFrameworkTest")]
  +[assembly: AssemblyDescription("Avalon Framework Test provides the NUnit2 tests.")]
   [assembly: AssemblyConfiguration("")]
   [assembly: AssemblyCompany("Apache Software Foundation")]
  -[assembly: AssemblyProduct("Avalon Framework")]
  +[assembly: AssemblyProduct("Avalon Framework Test")]
   [assembly: AssemblyCopyright("Copyright (c) 2002 Apache Software Foundation")]
   [assembly: AssemblyTrademark("")]
   [assembly: AssemblyCulture("")]              
  
  
  
  1.3       +2 -1      avalon-sandbox/csframework/src/test/AttributesTestCase.cs
  
  Index: AttributesTestCase.cs
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/csframework/src/test/AttributesTestCase.cs,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- AttributesTestCase.cs     26 Jun 2003 19:44:43 -0000      1.2
  +++ AttributesTestCase.cs     27 Jun 2003 13:25:23 -0000      1.3
  @@ -47,8 +47,9 @@
   
   using System;
   using NUnit.Framework;
  +using Apache.Avalon.Framework;
   
  -namespace Apache.Avalon.Framework
  +namespace Apache.Avalon.Framework.Test
   {
        
   [TestFixture]
  
  
  
  1.1                  
avalon-sandbox/csframework/src/test/AbstractConfigurationTestCase.cs
  
  Index: AbstractConfigurationTestCase.cs
  ===================================================================
  // ============================================================================
  //                   The Apache Software License, Version 1.1
  // ============================================================================
  //
  // Copyright (C) 2002-2003 The Apache Software Foundation. All rights reserved.
  //
  // Redistribution and use in source and binary forms, with or without modifica-
  // tion, are permitted provided that the following conditions are met:
  //
  // 1. Redistributions of  source code must  retain the above copyright  notice,
  //    this list of conditions and the following disclaimer.
  //
  // 2. Redistributions in binary form must reproduce the above copyright notice,
  //    this list of conditions and the following disclaimer in the documentation
  //    and/or other materials provided with the distribution.
  //
  // 3. The end-user documentation included with the redistribution, if any, must
  //    include  the following  acknowledgment:  "This product includes  software
  //    developed  by the  Apache Software Foundation  (http://www.apache.org/)."
  //    Alternately, this  acknowledgment may  appear in the software itself,  if
  //    and wherever such third-party acknowledgments normally appear.
  //
  // 4. The names "Jakarta", "Avalon", "Excalibur" and "Apache Software Foundation"
  //    must not be used to endorse or promote products derived from this  software
  //    without  prior written permission. For written permission, please contact
  //    [EMAIL PROTECTED]
  //
  // 5. Products  derived from this software may not  be called "Apache", nor may
  //    "Apache" appear  in their name,  without prior written permission  of the
  //    Apache Software Foundation.
  //
  // THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
  // INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  // FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
  // APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
  // INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
  // DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
  // OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
  // ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
  // (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
  // THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  //
  // This software  consists of voluntary contributions made  by many individuals
  // on  behalf of the Apache Software  Foundation. For more  information on the
  // Apache Software Foundation, please see <http://www.apache.org/>.
  // ============================================================================
  
  
  using System;
  using System.Collections;
  
  using Apache.Avalon.Framework.Configuration;
  using NUnit.Framework;
  
  namespace Apache.Avalon.Framework.Test
  {
        public abstract class AbstractConfigurationTest
        {
        
                protected abstract AbstractConfiguration GetConfiguration();
  
                [Test]
                public void IsReadOnly()
                {
                        AbstractConfiguration config = GetConfiguration();
                        Assertion.AssertEquals( false, config.IsReadOnly );
  
                        config.MakeReadOnly();
  
                        Assertion.AssertEquals( true, config.IsReadOnly );
                }
  
                [Test]
                public void Name()
                {
                        AbstractConfiguration config = GetConfiguration();
  
                        config.Name = "Name";
  
                        Assertion.AssertEquals( "Name", config.Name );
                }
  
                [Test]
                public void Location()
                {
                        AbstractConfiguration config = GetConfiguration();
  
                        config.Location = "Location";
  
                        Assertion.AssertEquals( "Location", config.Location );
                }
  
                [Test]
                public void Value()
                {
                        AbstractConfiguration config = GetConfiguration();
  
                        config.Value = "Value";
  
                        Assertion.AssertEquals( "Value", config.Value );
  
                        config.Value = "true";
  
                        Assertion.AssertEquals( true, (bool)config.GetValue(typeof( 
bool ) ) );
  
                        int intValue = (int) config.GetValue(typeof(int), -1);
                        Assertion.AssertEquals( -1, intValue );
                        
                        config.Value = "3";
                        intValue = (int) config.GetValue( typeof( int ), -1 );
                        Assertion.AssertEquals( 3, intValue );
                }
  
                [Test]
                public void Namespace()
                {
                        AbstractConfiguration config = GetConfiguration();
  
                        config.Namespace = "Namespace";
  
                        Assertion.AssertEquals( "Namespace", config.Namespace );
                }
  
                [Test]
                public void Prefix()
                {
                        AbstractConfiguration config = GetConfiguration();
  
                        config.Prefix = "Prefix";
  
                        Assertion.AssertEquals( "Prefix", config.Prefix );
                }
  
                [Test]
                public void Children()
                {
                        AbstractConfiguration config = GetConfiguration();
  
                        IConfiguration fooBar = config.GetChild("FooBar", false );
                        Assertion.AssertNull( fooBar );
                        fooBar = config.GetChild("FooBar", true);
                        Assertion.AssertNotNull( fooBar );
  
                        Assertion.AssertNotNull( config.Children );
  
                        ConfigurationCollection collection = config.Children;
  
                        for (int i = 0; i < 10; i++)
                        {
                                AbstractConfiguration child = GetConfiguration();
                                child.Name="Child" + i;
                                collection.Add( child );
                        }
  
                        config.Children = collection;
  
                        Assertion.AssertEquals( 11, config.Children.Count );
  
                        config.Children.Remove( fooBar );
                        
                        Assertion.AssertEquals( 10, config.Children.Count );
  
                        int x = 0;
                        foreach ( AbstractConfiguration child in config.Children )
                        {
                                Assertion.AssertEquals( "Child" + x, child.Name );
                                x++;
                        }
                }
  
                [Test]
                public void Attributes()
                {
                        AbstractConfiguration config = GetConfiguration();
  
                        Assertion.AssertEquals( 0, config.Attributes.Count );
  
                        config.Attributes.Add( "Attr1", "Val1" );
  
                        Assertion.AssertEquals( 1, config.Attributes.Count );
  
                        Assertion.AssertEquals( "Val1", config.Attributes[ "Attr1" ] );
  
                        config.Attributes.Add( "ValTest", "true" );
                        Assertion.AssertEquals( 2, config.Attributes.Count );
  
                        bool valTest = (bool) config.GetAttribute( "ValTest", typeof ( 
bool ) );
                        Assertion.AssertEquals( true, valTest );
  
                        config.Attributes["ValTest"] = "3";
                        Assertion.AssertEquals( 2, config.Attributes.Count );
  
                        int intValTest = (int) config.GetAttribute( "ValTest", typeof( 
int ), -1 );
                        Assertion.AssertEquals( 3, intValTest );
  
                        intValTest = (int) config.GetAttribute( "Attr1", typeof( int 
), -1 );
                        Assertion.AssertEquals( -1, intValTest );
                        
                }
  
        }
  }
  
  
  
  1.1                  
avalon-sandbox/csframework/src/test/ConfigurationCollectionTestCase.cs
  
  Index: ConfigurationCollectionTestCase.cs
  ===================================================================
  // ============================================================================
  //                   The Apache Software License, Version 1.1
  // ============================================================================
  // 
  // Copyright (C) 2002-2003 The Apache Software Foundation. All rights reserved.
  // 
  // Redistribution and use in source and binary forms, with or without modifica-
  // tion, are permitted provided that the following conditions are met:
  // 
  // 1. Redistributions of  source code must  retain the above copyright  notice,
  //    this list of conditions and the following disclaimer.
  // 
  // 2. Redistributions in binary form must reproduce the above copyright notice,
  //    this list of conditions and the following disclaimer in the documentation
  //    and/or other materials provided with the distribution.
  // 
  // 3. The end-user documentation included with the redistribution, if any, must
  //    include  the following  acknowledgment:  "This product includes  software
  //    developed  by the  Apache Software Foundation  (http://www.apache.org/)."
  //    Alternately, this  acknowledgment may  appear in the software itself,  if
  //    and wherever such third-party acknowledgments normally appear.
  // 
  // 4. The names "Jakarta", "Avalon", "Excalibur" and "Apache Software Foundation"  
  //    must not be used to endorse or promote products derived from this  software 
  //    without  prior written permission. For written permission, please contact 
  //    [EMAIL PROTECTED]
  // 
  // 5. Products  derived from this software may not  be called "Apache", nor may
  //    "Apache" appear  in their name,  without prior written permission  of the
  //    Apache Software Foundation.
  // 
  // THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
  // INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  // FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
  // APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
  // INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
  // DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
  // OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
  // ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
  // (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
  // THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  // 
  // This software  consists of voluntary contributions made  by many individuals
  // on  behalf of the Apache Software  Foundation. For more  information on the 
  // Apache Software Foundation, please see <http://www.apache.org/>.
  // ============================================================================
  
  
  using System;
  using System.Collections; 
  using NUnit.Framework;
  
  using Apache.Avalon.Framework.Configuration;
  
  namespace Apache.Avalon.Framework.Test
  {
        [TestFixture]
        public class ConfigurationCollectionTest
        {
                private IConfiguration[] arrayRange = new IConfiguration[] {
                        new DefaultConfiguration("array", 
"ConfigurationCollectionTest" ),
                        new DefaultConfiguration("array", 
"ConfigurationCollectionTest" ),
                        new DefaultConfiguration("array", 
"ConfigurationCollectionTest" )
                };
  
                private ConfigurationCollection collRange;
  
                public ConfigurationCollectionTest()
                {
                        collRange = new ConfigurationCollection();
                        collRange.Add( new DefaultConfiguration("collection", 
"ConfigurationCollectionTest") );
                        collRange.Add( new DefaultConfiguration("collection", 
"ConfigurationCollectionTest") );
                        collRange.Add( new DefaultConfiguration("collection", 
"ConfigurationCollectionTest") );
                }
  
                [Test] public void Constructors()
                {
                        ConfigurationCollection collection = new 
ConfigurationCollection();
                        Assertion.AssertEquals( 0, collection.Count );
  
                        collection = new ConfigurationCollection( collRange );
                        Assertion.AssertEquals( 3, collection.Count );
                        foreach( IConfiguration config in collection )
                        {
                                Assertion.AssertEquals( "collection", config.Name );
                                Assertion.AssertEquals( "ConfigurationCollectionTest", 
config.Location );
                        }
  
                        collection = new ConfigurationCollection( arrayRange );
                        Assertion.AssertEquals( 3, collection.Count );
                        foreach( IConfiguration config in collection )
                        {
                                Assertion.AssertEquals( "array", config.Name );
                                Assertion.AssertEquals( "ConfigurationCollectionTest", 
config.Location );
                        }
                }
  
                [Test] public void Index()
                {
                        ConfigurationCollection collection = new 
ConfigurationCollection( arrayRange );
                        DefaultConfiguration testconfig = new DefaultConfiguration( 
"test", "ConfigurationCollectionTest" );
                        testconfig.Value = "1";
                        collection.Add( testconfig );
  
                        Assertion.AssertEquals( 4, collection.Count );
                        IConfiguration config = collection[3]; // 0 based indexes
  
                        Assertion.AssertEquals( "test", config.Name );
                        Assertion.AssertEquals( "ConfigurationCollectionTest" , 
config.Location );
  
                        Assertion.Assert( ! ("1" == collection[0].Value) );
                        Assertion.AssertEquals( "1", collection[3].Value );
                }
  
                [Test] public void Add()
                {
                        ConfigurationCollection collection = new 
ConfigurationCollection();
                        collection.Add( new DefaultConfiguration( "test", 
"ConfigurationCollectionTest" ) );
                        Assertion.AssertEquals( 1, collection.Count );
                        Assertion.AssertEquals( "test", collection[0].Name );
                        Assertion.AssertEquals( "ConfigurationCollectionTest" , 
collection[0].Location );
  
                        collection.AddRange( arrayRange );
                        Assertion.AssertEquals( 4, collection.Count );
  
                        collection.AddRange( collRange );
                        Assertion.AssertEquals( 7, collection.Count );
  
                        int place = 0;
                        foreach( IConfiguration config in collection )
                        {
                                Assertion.AssertEquals( "ConfigurationCollectionTest", 
config.Location );
                                switch (place)
                                {
                                        case 0:
                                                Assertion.AssertEquals( "test", 
config.Name );
                                                break;
  
                                        case 1:
                                        case 2:
                                        case 3:
                                                Assertion.AssertEquals( "array", 
config.Name );
                                                break;
  
                                        case 4:
                                        case 5:
                                        case 6:
                                                Assertion.AssertEquals( "collection", 
config.Name );
                                                break;
                                }
                                place++;
                        }
                }
  
                [Test] public void CopyTo()
                {
                        ConfigurationCollection collection = new 
ConfigurationCollection( collRange );
                        
                        IConfiguration[] array = new IConfiguration[4];
                        array[0] = new DefaultConfiguration( "test", 
"ConfigurationCollectionTest" );
  
                        collection.CopyTo( array, 1 );
  
                        bool isFirst = true;
                        foreach ( IConfiguration config in array )
                        {
                                if (isFirst)
                                {
                                        Assertion.AssertEquals("test", config.Name);
                                        isFirst = false;
                                }
                                else
                                {
                                        Assertion.AssertEquals("collection", 
config.Name);
                                }
  
                                Assertion.AssertEquals("ConfigurationCollectionTest", 
config.Location);
                        }
                }
  
                [Test] public void Contains()
                {
                        ConfigurationCollection collection = new 
ConfigurationCollection( arrayRange );
  
                        foreach ( IConfiguration config in arrayRange )
                        {
                                Assertion.AssertEquals( true, collection.Contains( 
config ) );
                        }
  
                        foreach ( IConfiguration config in collRange )
                        {
                                Assertion.AssertEquals( false, collection.Contains( 
config ) );
                        }
                }
  
                [Test] public void IndexOf()
                {
                        ConfigurationCollection collection = new 
ConfigurationCollection( arrayRange );
                        Assertion.AssertEquals( 0, collection.IndexOf( arrayRange[0] ) 
);
                        Assertion.AssertEquals( 2, collection.IndexOf( arrayRange[2] ) 
);
                }
  
                [Test] public void InsertRemove()
                {
                        ConfigurationCollection collection = new 
ConfigurationCollection( arrayRange );
                        IConfiguration config = new DefaultConfiguration( "test", 
"ConfigurationCollectionTest" );
  
                        collection.Insert( 1, config );
                        Assertion.Assert( collection.Contains( config ) );
                        Assertion.AssertEquals( config, collection[1] );
                        Assertion.AssertEquals( 4, collection.Count );
  
                        collection.Remove( config );
                        Assertion.AssertEquals( 3, collection.Count );
                        Assertion.AssertEquals( false, collection.Contains( config ) );
                }
        }
  }
  
  
  
  1.1                  
avalon-sandbox/csframework/src/test/ConfigurationExceptionTestCase.cs
  
  Index: ConfigurationExceptionTestCase.cs
  ===================================================================
  // ============================================================================
  //                   The Apache Software License, Version 1.1
  // ============================================================================
  // 
  // Copyright (C) 2002-2003 The Apache Software Foundation. All rights reserved.
  // 
  // Redistribution and use in source and binary forms, with or without modifica-
  // tion, are permitted provided that the following conditions are met:
  // 
  // 1. Redistributions of  source code must  retain the above copyright  notice,
  //    this list of conditions and the following disclaimer.
  // 
  // 2. Redistributions in binary form must reproduce the above copyright notice,
  //    this list of conditions and the following disclaimer in the documentation
  //    and/or other materials provided with the distribution.
  // 
  // 3. The end-user documentation included with the redistribution, if any, must
  //    include  the following  acknowledgment:  "This product includes  software
  //    developed  by the  Apache Software Foundation  (http://www.apache.org/)."
  //    Alternately, this  acknowledgment may  appear in the software itself,  if
  //    and wherever such third-party acknowledgments normally appear.
  // 
  // 4. The names "Jakarta", "Avalon", "Excalibur" and "Apache Software Foundation"  
  //    must not be used to endorse or promote products derived from this  software 
  //    without  prior written permission. For written permission, please contact 
  //    [EMAIL PROTECTED]
  // 
  // 5. Products  derived from this software may not  be called "Apache", nor may
  //    "Apache" appear  in their name,  without prior written permission  of the
  //    Apache Software Foundation.
  // 
  // THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
  // INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  // FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
  // APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
  // INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
  // DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
  // OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
  // ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
  // (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
  // THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  // 
  // This software  consists of voluntary contributions made  by many individuals
  // on  behalf of the Apache Software  Foundation. For more  information on the 
  // Apache Software Foundation, please see <http://www.apache.org/>.
  // ============================================================================
  
  
  using System;
  using System.Runtime.Serialization;
  using NUnit.Framework;
  using Apache.Avalon.Framework.Configuration;
  
  namespace Apache.Avalon.Framework.Test
  {
        [TestFixture]
        public class ConfigurationExceptionTest
        {
                [Test] public void Constructor()
                {
                        Assertion.AssertNotNull( new ConfigurationException() );
                        Assertion.AssertNotNull( new ConfigurationException( "message" 
) );
                        Assertion.AssertNotNull( new ConfigurationException( 
"message", new Exception() ) );
                }
  
                [Test] public void Message()
                {
                        ConfigurationException ce = new 
ConfigurationException("message");
                        Assertion.AssertEquals( "message", ce.Message );
                        Assertion.AssertNull( ce.InnerException );
  
                        Exception inner = new Exception("inner");
                        ce = new ConfigurationException("message", inner);
                        Assertion.AssertEquals("message", ce.Message);
                        Assertion.AssertEquals( inner, ce.InnerException );
                        Assertion.AssertEquals( "inner", ce.InnerException.Message );
                }
        }
  }
  
  
  
  1.1                  avalon-sandbox/csframework/src/test/ContextExceptionTestCase.cs
  
  Index: ContextExceptionTestCase.cs
  ===================================================================
  // ============================================================================
  //                   The Apache Software License, Version 1.1
  // ============================================================================
  // 
  // Copyright (C) 2002-2003 The Apache Software Foundation. All rights reserved.
  // 
  // Redistribution and use in source and binary forms, with or without modifica-
  // tion, are permitted provided that the following conditions are met:
  // 
  // 1. Redistributions of  source code must  retain the above copyright  notice,
  //    this list of conditions and the following disclaimer.
  // 
  // 2. Redistributions in binary form must reproduce the above copyright notice,
  //    this list of conditions and the following disclaimer in the documentation
  //    and/or other materials provided with the distribution.
  // 
  // 3. The end-user documentation included with the redistribution, if any, must
  //    include  the following  acknowledgment:  "This product includes  software
  //    developed  by the  Apache Software Foundation  (http://www.apache.org/)."
  //    Alternately, this  acknowledgment may  appear in the software itself,  if
  //    and wherever such third-party acknowledgments normally appear.
  // 
  // 4. The names "Jakarta", "Avalon", "Excalibur" and "Apache Software Foundation"  
  //    must not be used to endorse or promote products derived from this  software 
  //    without  prior written permission. For written permission, please contact 
  //    [EMAIL PROTECTED]
  // 
  // 5. Products  derived from this software may not  be called "Apache", nor may
  //    "Apache" appear  in their name,  without prior written permission  of the
  //    Apache Software Foundation.
  // 
  // THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
  // INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  // FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
  // APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
  // INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
  // DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
  // OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
  // ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
  // (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
  // THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  // 
  // This software  consists of voluntary contributions made  by many individuals
  // on  behalf of the Apache Software  Foundation. For more  information on the 
  // Apache Software Foundation, please see <http://www.apache.org/>.
  // ============================================================================
  
  
  using System;
  using System.Runtime.Serialization;
  using NUnit.Framework;
  using Apache.Avalon.Framework.Context;
  
  namespace Apache.Avalon.Framework.Test
  {
        [TestFixture]
        public class ContextExceptionTest
        {
                [Test] public void Constructor()
                {
                        Assertion.AssertNotNull( new ContextException() );
                        Assertion.AssertNotNull( new ContextException( "message" ) );
                        Assertion.AssertNotNull( new ContextException( "message", new 
Exception() ) );
                }
  
                [Test] public void Message()
                {
                        ContextException ce = new ContextException("message");
                        Assertion.AssertEquals( "message", ce.Message );
                        Assertion.AssertNull( ce.InnerException );
  
                        Exception inner = new Exception("inner");
                        ce = new ContextException("message", inner);
                        Assertion.AssertEquals("message", ce.Message);
                        Assertion.AssertEquals( inner, ce.InnerException );
                        Assertion.AssertEquals( "inner", ce.InnerException.Message );
                }
        }
  }
  
  
  
  1.1                  
avalon-sandbox/csframework/src/test/DefaultConfigurationTestCase.cs
  
  Index: DefaultConfigurationTestCase.cs
  ===================================================================
  // ============================================================================
  //                   The Apache Software License, Version 1.1
  // ============================================================================
  //
  // Copyright (C) 2002-2003 The Apache Software Foundation. All rights reserved.
  //
  // Redistribution and use in source and binary forms, with or without modifica-
  // tion, are permitted provided that the following conditions are met:
  //
  // 1. Redistributions of  source code must  retain the above copyright  notice,
  //    this list of conditions and the following disclaimer.
  //
  // 2. Redistributions in binary form must reproduce the above copyright notice,
  //    this list of conditions and the following disclaimer in the documentation
  //    and/or other materials provided with the distribution.
  //
  // 3. The end-user documentation included with the redistribution, if any, must
  //    include  the following  acknowledgment:  "This product includes  software
  //    developed  by the  Apache Software Foundation  (http://www.apache.org/)."
  //    Alternately, this  acknowledgment may  appear in the software itself,  if
  //    and wherever such third-party acknowledgments normally appear.
  //
  // 4. The names "Jakarta", "Avalon", "Excalibur" and "Apache Software Foundation"
  //    must not be used to endorse or promote products derived from this  software
  //    without  prior written permission. For written permission, please contact
  //    [EMAIL PROTECTED]
  //
  // 5. Products  derived from this software may not  be called "Apache", nor may
  //    "Apache" appear  in their name,  without prior written permission  of the
  //    Apache Software Foundation.
  //
  // THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
  // INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  // FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
  // APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
  // INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
  // DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
  // OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
  // ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
  // (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
  // THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  //
  // This software  consists of voluntary contributions made  by many individuals
  // on  behalf of the Apache Software  Foundation. For more  information on the
  // Apache Software Foundation, please see <http://www.apache.org/>.
  // ============================================================================
  
  
  using System;
  using System.Collections;
  using System.Runtime.Serialization;
  
  using Apache.Avalon.Framework.Configuration;
  using NUnit.Framework;
  
  namespace Apache.Avalon.Framework.Test
  {
        [TestFixture]
        public class DefaultConfigurationTest: AbstractConfigurationTest
        {
                protected override AbstractConfiguration GetConfiguration()
                {
                        return new DefaultConfiguration("Name", "Location", 
"Namespace", "Prefix");
                }
  
                [Test]
                public void DefaultChildren()
                {
                        IConfiguration config = GetConfiguration();
  
                        IConfiguration child = config.GetChild("Child", false);
                        Assertion.AssertNull( child );
  
                        child = config.GetChild("Child", true);
                        Assertion.AssertNotNull( child );
  
                        for( int i = 0; i < 10; i++ )
                        {
                                DefaultConfiguration testChild = new 
DefaultConfiguration( "test", "Apache.Avalon.Framework.DefaultConfigurationTest" );
                                testChild.Value = "value";
                                config.Children.Add( testChild );
                        }
  
                        Assertion.AssertEquals( 11, config.Children.Count );
  
                        ConfigurationCollection coll = config.GetChildren( "test" );
                        Assertion.AssertEquals( 10, coll.Count );
  
                        foreach( IConfiguration testConfig in coll )
                        {
                                Assertion.AssertEquals( "test", testConfig.Name );
                                Assertion.AssertEquals( "value", testConfig.Value );
                        }
                }
        }
  }
  
  
  
  1.1                  avalon-sandbox/csframework/src/test/DefaultContextTestCase.cs
  
  Index: DefaultContextTestCase.cs
  ===================================================================
  // ============================================================================
  //                   The Apache Software License, Version 1.1
  // ============================================================================
  // 
  // Copyright (C) 2002-2003 The Apache Software Foundation. All rights reserved.
  // 
  // Redistribution and use in source and binary forms, with or without modifica-
  // tion, are permitted provided that the following conditions are met:
  // 
  // 1. Redistributions of  source code must  retain the above copyright  notice,
  //    this list of conditions and the following disclaimer.
  // 
  // 2. Redistributions in binary form must reproduce the above copyright notice,
  //    this list of conditions and the following disclaimer in the documentation
  //    and/or other materials provided with the distribution.
  // 
  // 3. The end-user documentation included with the redistribution, if any, must
  //    include  the following  acknowledgment:  "This product includes  software
  //    developed  by the  Apache Software Foundation  (http://www.apache.org/)."
  //    Alternately, this  acknowledgment may  appear in the software itself,  if
  //    and wherever such third-party acknowledgments normally appear.
  // 
  // 4. The names "Jakarta", "Avalon", "Excalibur" and "Apache Software Foundation"  
  //    must not be used to endorse or promote products derived from this  software 
  //    without  prior written permission. For written permission, please contact 
  //    [EMAIL PROTECTED]
  // 
  // 5. Products  derived from this software may not  be called "Apache", nor may
  //    "Apache" appear  in their name,  without prior written permission  of the
  //    Apache Software Foundation.
  // 
  // THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
  // INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  // FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
  // APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
  // INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
  // DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
  // OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
  // ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
  // (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
  // THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  // 
  // This software  consists of voluntary contributions made  by many individuals
  // on  behalf of the Apache Software  Foundation. For more  information on the 
  // Apache Software Foundation, please see <http://www.apache.org/>.
  // ============================================================================
  
  
  using System;
  using System.Collections;
  using System.Runtime.Serialization; 
  
  using Apache.Avalon.Framework.Context;
  using NUnit.Framework;
  
  namespace Apache.Avalon.Framework.Test
  {
        [TestFixture]
        public class DefaultContextTest
        {
                private IDictionary data = new Hashtable();
  
                public DefaultContextTest()
                {
                        data.Add("test", "value");
                }
                
                [Test] public void Constructors()
                {
                        IContext context = new DefaultContext();
                        Assertion.AssertNotNull( context );
  
                        context = new DefaultContext( data );
                        Assertion.AssertEquals( "value", data["test"] );
                        data["test"] = "newValue";
  
                        context = new DefaultContext( context );
                        Assertion.AssertEquals( "newValue", data["test"] );
                }
  
                [Test] public void ReadOnly()
                {
                        DefaultContext context = new DefaultContext( data );
                        Assertion.AssertEquals( false, context.IsReadOnly );
                        
                        context.MakeReadOnly();
                        Assertion.Assert( context.IsReadOnly );
  
                        try
                        {
                                context["test"] = "foo";
                        }
                        catch(ContextException ce)
                        {
                                Assertion.AssertEquals("Context is read only and can 
not be modified", ce.Message);
                        }
                }
        }
  }
  
  
  
  1.1                  
avalon-sandbox/csframework/src/test/ParameterExceptionTestCase.cs
  
  Index: ParameterExceptionTestCase.cs
  ===================================================================
  // ============================================================================
  //                   The Apache Software License, Version 1.1
  // ============================================================================
  // 
  // Copyright (C) 2002-2003 The Apache Software Foundation. All rights reserved.
  // 
  // Redistribution and use in source and binary forms, with or without modifica-
  // tion, are permitted provided that the following conditions are met:
  // 
  // 1. Redistributions of  source code must  retain the above copyright  notice,
  //    this list of conditions and the following disclaimer.
  // 
  // 2. Redistributions in binary form must reproduce the above copyright notice,
  //    this list of conditions and the following disclaimer in the documentation
  //    and/or other materials provided with the distribution.
  // 
  // 3. The end-user documentation included with the redistribution, if any, must
  //    include  the following  acknowledgment:  "This product includes  software
  //    developed  by the  Apache Software Foundation  (http://www.apache.org/)."
  //    Alternately, this  acknowledgment may  appear in the software itself,  if
  //    and wherever such third-party acknowledgments normally appear.
  // 
  // 4. The names "Jakarta", "Avalon", "Excalibur" and "Apache Software Foundation"  
  //    must not be used to endorse or promote products derived from this  software 
  //    without  prior written permission. For written permission, please contact 
  //    [EMAIL PROTECTED]
  // 
  // 5. Products  derived from this software may not  be called "Apache", nor may
  //    "Apache" appear  in their name,  without prior written permission  of the
  //    Apache Software Foundation.
  // 
  // THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
  // INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  // FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
  // APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
  // INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
  // DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
  // OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
  // ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
  // (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
  // THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  // 
  // This software  consists of voluntary contributions made  by many individuals
  // on  behalf of the Apache Software  Foundation. For more  information on the 
  // Apache Software Foundation, please see <http://www.apache.org/>.
  // ============================================================================
  
  
  using System;
  using System.Runtime.Serialization;
  using NUnit.Framework;
  using Apache.Avalon.Framework.Parameter;
  
  namespace Apache.Avalon.Framework.Test
  {
        [TestFixture]
        public class ParameterExceptionTest
        {
                [Test] public void Constructor()
                {
                        Assertion.AssertNotNull( new ParameterException() );
                        Assertion.AssertNotNull( new ParameterException( "message" ) );
                        Assertion.AssertNotNull( new ParameterException( "message", 
new Exception() ) );
                }
  
                [Test] public void Message()
                {
                        ParameterException ce = new ParameterException("message");
                        Assertion.AssertEquals( "message", ce.Message );
                        Assertion.AssertNull( ce.InnerException );
  
                        Exception inner = new Exception("inner");
                        ce = new ParameterException("message", inner);
                        Assertion.AssertEquals("message", ce.Message);
                        Assertion.AssertEquals( inner, ce.InnerException );
                        Assertion.AssertEquals( "inner", ce.InnerException.Message );
                }
        }
  }
  
  
  
  1.1                  avalon-sandbox/csframework/src/test/ServiceExceptionTestCase.cs
  
  Index: ServiceExceptionTestCase.cs
  ===================================================================
  // ============================================================================
  //                   The Apache Software License, Version 1.1
  // ============================================================================
  // 
  // Copyright (C) 2002-2003 The Apache Software Foundation. All rights reserved.
  // 
  // Redistribution and use in source and binary forms, with or without modifica-
  // tion, are permitted provided that the following conditions are met:
  // 
  // 1. Redistributions of  source code must  retain the above copyright  notice,
  //    this list of conditions and the following disclaimer.
  // 
  // 2. Redistributions in binary form must reproduce the above copyright notice,
  //    this list of conditions and the following disclaimer in the documentation
  //    and/or other materials provided with the distribution.
  // 
  // 3. The end-user documentation included with the redistribution, if any, must
  //    include  the following  acknowledgment:  "This product includes  software
  //    developed  by the  Apache Software Foundation  (http://www.apache.org/)."
  //    Alternately, this  acknowledgment may  appear in the software itself,  if
  //    and wherever such third-party acknowledgments normally appear.
  // 
  // 4. The names "Jakarta", "Avalon", "Excalibur" and "Apache Software Foundation"  
  //    must not be used to endorse or promote products derived from this  software 
  //    without  prior written permission. For written permission, please contact 
  //    [EMAIL PROTECTED]
  // 
  // 5. Products  derived from this software may not  be called "Apache", nor may
  //    "Apache" appear  in their name,  without prior written permission  of the
  //    Apache Software Foundation.
  // 
  // THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
  // INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  // FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
  // APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
  // INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
  // DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
  // OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
  // ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
  // (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
  // THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  // 
  // This software  consists of voluntary contributions made  by many individuals
  // on  behalf of the Apache Software  Foundation. For more  information on the 
  // Apache Software Foundation, please see <http://www.apache.org/>.
  // ============================================================================
  
  
  using System;
  using System.Runtime.Serialization;
  using NUnit.Framework;
  using Apache.Avalon.Framework.Service;
  
  namespace Apache.Avalon.Framework.Test
  {
        [TestFixture]
        public class ServiceExceptionTest
        {
                [Test] public void Constructor()
                {
                        Assertion.AssertNotNull( new ServiceException() );
                        Assertion.AssertNotNull( new ServiceException( "message" ) );
                        Assertion.AssertNotNull( new ServiceException( "message", new 
Exception() ) );
                }
  
                [Test] public void Message()
                {
                        ServiceException ce = new ServiceException("message");
                        Assertion.AssertEquals( "message", ce.Message );
                        Assertion.AssertNull( ce.InnerException );
  
                        Exception inner = new Exception("inner");
                        ce = new ServiceException("message", inner);
                        Assertion.AssertEquals("message", ce.Message);
                        Assertion.AssertEquals( inner, ce.InnerException );
                        Assertion.AssertEquals( "inner", ce.InnerException.Message );
                }
        }
  }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to