From: <fab...@us...> - 2008-09-29 21:54:06
|
Revision: 3804 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=3804&view=rev Author: fabiomaulo Date: 2008-09-29 21:53:41 +0000 (Mon, 29 Sep 2008) Log Message: ----------- Start fixing NH-1173 (by Sean Carpenter) Modified Paths: -------------- trunk/nhibernate/src/Iesi.Collections/Iesi.Collections.csproj trunk/nhibernate/src/Iesi.Collections.Test/Generic/HashedSetFixture.cs trunk/nhibernate/src/Iesi.Collections.Test/Generic/ImmutableSetFixture.cs trunk/nhibernate/src/Iesi.Collections.Test/Generic/SetFixture.cs trunk/nhibernate/src/Iesi.Collections.Test/Generic/SortedSetFixture.cs trunk/nhibernate/src/Iesi.Collections.Test/Iesi.Collections.Test.csproj Added Paths: ----------- trunk/nhibernate/src/Iesi.Collections/Generic/OrderedSet.cs trunk/nhibernate/src/Iesi.Collections.Test/Generic/OrderedSetFixture.cs Added: trunk/nhibernate/src/Iesi.Collections/Generic/OrderedSet.cs =================================================================== --- trunk/nhibernate/src/Iesi.Collections/Generic/OrderedSet.cs (rev 0) +++ trunk/nhibernate/src/Iesi.Collections/Generic/OrderedSet.cs 2008-09-29 21:53:41 UTC (rev 3804) @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; + +namespace Iesi.Collections.Generic +{ + /// <summary> + /// Implements an ordered <c>Set</c> based on a dictionary. + /// </summary> + [Serializable] + public class OrderedSet<T> : DictionarySet<T> + { + /// <summary> + /// Initializes a new instance of the <see cref="OrderedSet{T}" /> class. + /// </summary> + public OrderedSet() + { + InternalDictionary = new Dictionary<T, object>(); + } + + /// <summary> + /// Initializes a new instance of the <see cref="OrderedSet{T}"/> class. + /// </summary> + /// <param name="initialValues">A collection of elements that defines the initial set contents.</param> + public OrderedSet(ICollection<T> initialValues) + : this() + { + AddAll(initialValues); + } + } +} Modified: trunk/nhibernate/src/Iesi.Collections/Iesi.Collections.csproj =================================================================== --- trunk/nhibernate/src/Iesi.Collections/Iesi.Collections.csproj 2008-09-29 21:27:32 UTC (rev 3803) +++ trunk/nhibernate/src/Iesi.Collections/Iesi.Collections.csproj 2008-09-29 21:53:41 UTC (rev 3804) @@ -2,7 +2,7 @@ <PropertyGroup> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> - <ProductVersion>8.0.50727</ProductVersion> + <ProductVersion>9.0.30729</ProductVersion> <SchemaVersion>2.0</SchemaVersion> <ProjectGuid>{4C251E3E-6EA1-4A51-BBCB-F9C42AE55344}</ProjectGuid> <OutputType>Library</OutputType> @@ -48,6 +48,7 @@ <Compile Include="Generic\HashedSet.cs" /> <Compile Include="Generic\ImmutableSet.cs" /> <Compile Include="Generic\ISet.cs" /> + <Compile Include="Generic\OrderedSet.cs" /> <Compile Include="Generic\Set.cs" /> <Compile Include="Generic\SortedSet.cs" /> <Compile Include="Generic\SynchronizedSet.cs" /> Modified: trunk/nhibernate/src/Iesi.Collections.Test/Generic/HashedSetFixture.cs =================================================================== --- trunk/nhibernate/src/Iesi.Collections.Test/Generic/HashedSetFixture.cs 2008-09-29 21:27:32 UTC (rev 3803) +++ trunk/nhibernate/src/Iesi.Collections.Test/Generic/HashedSetFixture.cs 2008-09-29 21:53:41 UTC (rev 3804) @@ -3,10 +3,10 @@ using System.IO; using System.Runtime.Serialization; using System.Runtime.Serialization.Formatters.Binary; - +using Iesi.Collections.Generic; using NUnit.Framework; -namespace Iesi.Collections.Generic.Test +namespace Iesi.Collections.Test.Generic { /// <summary> /// Summary description for HashedSetFixture. @@ -47,4 +47,4 @@ Assert.IsTrue(desSet.Contains(three), "should contain three"); } } -} +} \ No newline at end of file Modified: trunk/nhibernate/src/Iesi.Collections.Test/Generic/ImmutableSetFixture.cs =================================================================== --- trunk/nhibernate/src/Iesi.Collections.Test/Generic/ImmutableSetFixture.cs 2008-09-29 21:27:32 UTC (rev 3803) +++ trunk/nhibernate/src/Iesi.Collections.Test/Generic/ImmutableSetFixture.cs 2008-09-29 21:53:41 UTC (rev 3804) @@ -1,9 +1,9 @@ using System; using System.Collections.Generic; - +using Iesi.Collections.Generic; using NUnit.Framework; -namespace Iesi.Collections.Generic.Test +namespace Iesi.Collections.Test.Generic { /// <summary> /// Summary description for HashedSetFixture. @@ -26,4 +26,4 @@ get { return typeof(ImmutableSet<string>); } } } -} +} \ No newline at end of file Added: trunk/nhibernate/src/Iesi.Collections.Test/Generic/OrderedSetFixture.cs =================================================================== --- trunk/nhibernate/src/Iesi.Collections.Test/Generic/OrderedSetFixture.cs (rev 0) +++ trunk/nhibernate/src/Iesi.Collections.Test/Generic/OrderedSetFixture.cs 2008-09-29 21:53:41 UTC (rev 3804) @@ -0,0 +1,42 @@ +using System; +using System.Collections.Generic; +using Iesi.Collections.Generic; +using NUnit.Framework; + +namespace Iesi.Collections.Test.Generic +{ + /// <summary> + /// Summary description for OrderedSetFixture. + /// </summary> + [TestFixture] + public class OrderedSetFixture : GenericSetFixture + { + protected override ISet<string> CreateInstance() + { + return new OrderedSet<string>(); + } + + protected override ISet<string> CreateInstance(ICollection<string> init) + { + return new OrderedSet<string>(init); + } + + protected override Type ExpectedType + { + get { return typeof(OrderedSet<string>); } + } + + [Test] + public void OrderedEnumeration() + { + List<string> expectedOrder = new List<string>(3) {one, two, three}; + + int index = 0; + foreach (string str in _set) + { + Assert.AreEqual(str, expectedOrder[index], index + " did not have same value"); + index++; + } + } + } +} Modified: trunk/nhibernate/src/Iesi.Collections.Test/Generic/SetFixture.cs =================================================================== --- trunk/nhibernate/src/Iesi.Collections.Test/Generic/SetFixture.cs 2008-09-29 21:27:32 UTC (rev 3803) +++ trunk/nhibernate/src/Iesi.Collections.Test/Generic/SetFixture.cs 2008-09-29 21:53:41 UTC (rev 3804) @@ -1,9 +1,9 @@ using System; using System.Collections.Generic; - +using Iesi.Collections.Generic; using NUnit.Framework; -namespace Iesi.Collections.Generic.Test +namespace Iesi.Collections.Test.Generic { /// <summary> /// Summary description for SetFixture. @@ -460,4 +460,4 @@ protected abstract Type ExpectedType { get; } } -} +} \ No newline at end of file Modified: trunk/nhibernate/src/Iesi.Collections.Test/Generic/SortedSetFixture.cs =================================================================== --- trunk/nhibernate/src/Iesi.Collections.Test/Generic/SortedSetFixture.cs 2008-09-29 21:27:32 UTC (rev 3803) +++ trunk/nhibernate/src/Iesi.Collections.Test/Generic/SortedSetFixture.cs 2008-09-29 21:53:41 UTC (rev 3804) @@ -1,10 +1,10 @@ using System; using System.Collections; using System.Collections.Generic; - +using Iesi.Collections.Generic; using NUnit.Framework; -namespace Iesi.Collections.Generic.Test +namespace Iesi.Collections.Test.Generic { /// <summary> /// Summary description for SortedSetFixture. @@ -66,4 +66,4 @@ } } } -} +} \ No newline at end of file Modified: trunk/nhibernate/src/Iesi.Collections.Test/Iesi.Collections.Test.csproj =================================================================== --- trunk/nhibernate/src/Iesi.Collections.Test/Iesi.Collections.Test.csproj 2008-09-29 21:27:32 UTC (rev 3803) +++ trunk/nhibernate/src/Iesi.Collections.Test/Iesi.Collections.Test.csproj 2008-09-29 21:53:41 UTC (rev 3804) @@ -49,6 +49,7 @@ <Compile Include="AssemblyInfo.cs" /> <Compile Include="Generic\HashedSetFixture.cs" /> <Compile Include="Generic\ImmutableSetFixture.cs" /> + <Compile Include="Generic\OrderedSetFixture.cs" /> <Compile Include="Generic\SetFixture.cs" /> <Compile Include="Generic\SortedSetFixture.cs" /> <Compile Include="HashedSetFixture.cs" /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |