Skip to content

Commit

Permalink
Continue removing use of persistent non-generic collections from the …
Browse files Browse the repository at this point in the history
…test suite.
  • Loading branch information
oskarb committed Mar 8, 2013
1 parent 777ca5b commit 016c97b
Show file tree
Hide file tree
Showing 12 changed files with 58 additions and 56 deletions.
10 changes: 5 additions & 5 deletions src/NHibernate.DomainModel/B.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System;
using System.Collections;
using System.Collections.Generic;

namespace NHibernate.DomainModel
{
Expand All @@ -22,7 +22,7 @@ public class B : A
/// <summary>
/// Holder for map
/// </summary>
private IDictionary _map;
private IDictionary<string, string> _map;

#endregion

Expand All @@ -41,7 +41,7 @@ public B()
/// <param name="name">Initial name value</param>
/// <param name="count">Initial count value</param>
/// <param name="map">Initial map value</param>
public B(String name, Int32 count, IDictionary map)
public B(String name, Int32 count, IDictionary<string, string> map)
: base(name)
{
this._count = count;
Expand All @@ -52,7 +52,7 @@ public B(String name, Int32 count, IDictionary map)
/// Minimal constructor for class B
/// </summary>
/// <param name="map">Initial map value</param>
public B(IDictionary map)
public B(IDictionary<string, string> map)
{
this._map = map;
}
Expand All @@ -73,7 +73,7 @@ public virtual Int32 Count
/// <summary>
/// Get/set for map
/// </summary>
public virtual IDictionary Map
public virtual IDictionary<string, string> Map
{
get { return _map; }
set { _map = value; }
Expand Down
12 changes: 6 additions & 6 deletions src/NHibernate.DomainModel/C1.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System;
using System.Collections;

using System.Collections.Generic;

namespace NHibernate.DomainModel
{
/// <summary>
Expand Down Expand Up @@ -32,7 +32,7 @@ public class C1 : B
/// <summary>
/// Holder for c2s
/// </summary>
private IList _c2s = new ArrayList();
private IList<C2> _c2s = new List<C2>();

#endregion

Expand All @@ -53,7 +53,7 @@ public C1()
/// <param name="map">Initial map value</param>
/// <param name="address">Initial address value</param>
/// <param name="d">Initial d value</param>
public C1(String name, Int32 count, IDictionary map, String address, D d)
public C1(String name, Int32 count, IDictionary<string, string> map, String address, D d)
: base(name, count, map)
{
this._address = address;
Expand All @@ -64,7 +64,7 @@ public C1(String name, Int32 count, IDictionary map, String address, D d)
/// Minimal constructor for class C1
/// </summary>
/// <param name="map">Initial map value</param>
public C1(IDictionary map)
public C1(IDictionary<string, string> map)
: base(map)
{
}
Expand Down Expand Up @@ -97,7 +97,7 @@ public virtual C2 C2
set { _c2 = value; }
}

public virtual IList C2s
public virtual IList<C2> C2s
{
get { return _c2s; }
set { _c2s = value; }
Expand Down
4 changes: 2 additions & 2 deletions src/NHibernate.DomainModel/C2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public C2()
/// <param name="count">Initial count value</param>
/// <param name="map">Initial map value</param>
/// <param name="address">Initial address value</param>
public C2(String name, Int32 count, IDictionary map, String address)
public C2(String name, Int32 count, IDictionary<string, string> map, String address)
: base(name, count, map)
{
this._address = address;
Expand All @@ -58,7 +58,7 @@ public C2(String name, Int32 count, IDictionary map, String address)
/// Minimal constructor for class C2
/// </summary>
/// <param name="map">Initial map value</param>
public C2(IDictionary map)
public C2(IDictionary<string, string> map)
: base(map)
{
}
Expand Down
8 changes: 4 additions & 4 deletions src/NHibernate.DomainModel/Category.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System;
using System.Collections;

using System.Collections.Generic;

namespace NHibernate.DomainModel
{
/// <summary>
Expand All @@ -12,7 +12,7 @@ public class Category

private long _id;
private string _name;
private IList _subcategories = new ArrayList();
private IList<Category> _subcategories = new List<Category>();
private Assignable _assignable;

public long Id
Expand All @@ -27,7 +27,7 @@ public string Name
set { _name = value; }
}

public IList Subcategories
public IList<Category> Subcategories
{
get { return _subcategories; }
set { _subcategories = value; }
Expand Down
21 changes: 11 additions & 10 deletions src/NHibernate.DomainModel/NHSpecific/Child.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.Collections;

using System.Collections;
using System.Collections.Generic;

namespace NHibernate.DomainModel.NHSpecific
{
/// <summary>
Expand All @@ -10,10 +11,10 @@ public class Child
{
private int _id;
private string _fullName;
private IDictionary _parents;
private IDictionary<string, Parent> _parents;
private SexType _sex;

private IList _siblings;
private IList<Child> _siblings;

private Child[] _friends;

Expand All @@ -37,11 +38,11 @@ public string FullName
set { _fullName = value; }
}

public IList Siblings
public IList<Child> Siblings
{
get
{
if (_siblings == null) _siblings = new ArrayList();
if (_siblings == null) _siblings = new List<Child>();
return _siblings;
}
set { _siblings = value; }
Expand All @@ -60,11 +61,11 @@ public Child SecondSibling
set { Siblings.Insert(1, value); }
}

public IDictionary Parents
public IDictionary<string, Parent> Parents
{
get
{
if (_parents == null) _parents = new Hashtable();
if (_parents == null) _parents = new Dictionary<string, Parent>();
return _parents;
}
set { _parents = value; }
Expand All @@ -75,7 +76,7 @@ public Parent Mom
get { return (Parent) Parents["mom"]; }
set
{
if (Parents.Contains("mom") == false)
if (Parents.ContainsKey("mom") == false)
{
Parents.Add("mom", value);
}
Expand All @@ -91,7 +92,7 @@ public Parent Dad
get { return (Parent) Parents["dad"]; }
set
{
if (Parents.Contains("dad") == false)
if (Parents.ContainsKey("dad") == false)
{
Parents.Add("dad", value);
}
Expand Down
8 changes: 4 additions & 4 deletions src/NHibernate.Test/Legacy/ABCProxyTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,8 @@ public void SubclassMap()
ITransaction t = s.BeginTransaction();
B b = new B();
s.Save(b);
Hashtable map = new Hashtable();
map.Add("3", 1);
IDictionary<string, string> map = new Dictionary<string, string>();
map.Add("3", "1");
b.Map = map;
s.Flush();
s.Delete(b);
Expand All @@ -253,8 +253,8 @@ public void SubclassMap()

s = OpenSession();
t = s.BeginTransaction();
map = new Hashtable();
map.Add("3", 1);
map = new Dictionary<string, string>();
map.Add("3", "1");
b = new B();
b.Map = map;
s.Save(b);
Expand Down
5 changes: 3 additions & 2 deletions src/NHibernate.Test/Legacy/ABCTest.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Collections;
using System.Collections;
using System.Collections.Generic;
using NHibernate.Dialect;
using NHibernate.DomainModel;
using NUnit.Framework;
Expand Down Expand Up @@ -42,7 +43,7 @@ public void Subselect()
using (ITransaction t = s.BeginTransaction())
{
B b = new B();
IDictionary map = new Hashtable();
IDictionary<string, string> map = new Dictionary<string, string>();
map["a"] = "a";
map["b"] = "b";
b.Map = map;
Expand Down
18 changes: 9 additions & 9 deletions src/NHibernate.Test/Legacy/MasterDetailTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -850,7 +850,7 @@ public void CollectionReplaceOnUpdate()
ISession s = OpenSession();
ITransaction t = s.BeginTransaction();
Category c = new Category();
IList list = new ArrayList();
IList<Category> list = new List<Category>();
c.Subcategories = list;
list.Add(new Category());
s.Save(c);
Expand All @@ -867,7 +867,7 @@ public void CollectionReplaceOnUpdate()
s = OpenSession();
t = s.BeginTransaction();
c = (Category) s.Load(typeof(Category), c.Id, LockMode.Upgrade);
IList list2 = c.Subcategories;
IList<Category> list2 = c.Subcategories;
t.Commit();
s.Close();

Expand Down Expand Up @@ -895,7 +895,7 @@ public void CollectionReplace2()
ISession s = OpenSession();
ITransaction t = s.BeginTransaction();
Category c = new Category();
IList list = new ArrayList();
IList<Category> list = new List<Category>();
c.Subcategories = list;
list.Add(new Category());
Category c2 = new Category();
Expand All @@ -907,7 +907,7 @@ public void CollectionReplace2()
s = OpenSession();
t = s.BeginTransaction();
c = (Category) s.Load(typeof(Category), c.Id, LockMode.Upgrade);
IList list2 = c.Subcategories;
IList<Category> list2 = c.Subcategories;
t.Commit();
s.Close();

Expand All @@ -934,7 +934,7 @@ public void CollectionReplace()
ISession s = OpenSession();
ITransaction t = s.BeginTransaction();
Category c = new Category();
IList list = new ArrayList();
IList<Category> list = new List<Category>();
c.Subcategories = list;
list.Add(new Category());
s.Save(c);
Expand All @@ -951,7 +951,7 @@ public void CollectionReplace()
s = OpenSession();
t = s.BeginTransaction();
c = (Category) s.Load(typeof(Category), c.Id, LockMode.Upgrade);
IList list2 = c.Subcategories;
IList<Category> list2 = c.Subcategories;
t.Commit();
s.Close();

Expand Down Expand Up @@ -997,7 +997,7 @@ public void Categories()
c = (Category) s.Load(typeof(Category), c.Id);
Assert.IsNotNull(c.Subcategories[0]);
Assert.IsNotNull(c.Subcategories[1]);
IList list = ((Category) c.Subcategories[1]).Subcategories;
IList<Category> list = ((Category) c.Subcategories[1]).Subcategories;
Assert.IsNull(list[0]);
Assert.IsNotNull(list[1]);

Expand All @@ -1019,7 +1019,7 @@ public void CollectionRefresh()
{
ISession s = OpenSession();
Category c = new Category();
IList list = new ArrayList();
IList<Category> list = new List<Category>();
c.Subcategories = list;
list.Add(new Category());
c.Name = "root";
Expand Down Expand Up @@ -1062,7 +1062,7 @@ public void CachedCollectionRefresh()
{
ISession s = OpenSession();
Category c = new Category();
IList list = new ArrayList();
IList<Category> list = new List<Category>();
c.Subcategories = list;
list.Add(new Category());
c.Name = "root";
Expand Down
6 changes: 3 additions & 3 deletions src/NHibernate.Test/NHSpecificTest/NH704/Cat.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
using System;
using System.Collections;
using System.Collections.Generic;

namespace NHibernate.Test.NHSpecificTest.NH704
{
public class Cat
{
private int id;
private IList children = new ArrayList();
private IList<Cat> children = new List<Cat>();
//Note: I initialized the collection here, if removed, Lock will work.

public int Id
Expand All @@ -15,7 +15,7 @@ public int Id
set { id = value; }
}

public IList Children
public IList<Cat> Children
{
get { return children; }
set { children = value; }
Expand Down
6 changes: 3 additions & 3 deletions src/NHibernate.Test/NHSpecificTest/NH739/Cat.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
using System.Collections;
using System.Collections.Generic;

namespace NHibernate.Test.NHSpecificTest.NH739
{
public class Cat
{
private int id;
private IList children = new ArrayList();
private IList<Cat> children = new List<Cat>();
private Cat mother;

public int Id
Expand All @@ -20,7 +20,7 @@ public Cat Mother
set { mother = value; }
}

public IList Children
public IList<Cat> Children
{
get { return children; }
set { children = value; }
Expand Down
6 changes: 3 additions & 3 deletions src/NHibernate.Test/NHSpecificTest/NH883/Cat.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
using System.Collections;
using System.Collections.Generic;

namespace NHibernate.Test.NHSpecificTest.NH883
{
public class Cat
{
private int id;
private IList children = new ArrayList();
private IList<Cat> children = new List<Cat>();
private Cat mother;

public int Id
Expand All @@ -20,7 +20,7 @@ public Cat Mother
set { mother = value; }
}

public IList Children
public IList<Cat> Children
{
get { return children; }
set { children = value; }
Expand Down
Loading

0 comments on commit 016c97b

Please sign in to comment.