Skip to content

Commit d25058f

Browse files
committed
Port more tests to avoid use of non-generic collections.
1 parent 578061b commit d25058f

File tree

24 files changed

+93
-110
lines changed

24 files changed

+93
-110
lines changed

src/NHibernate.DomainModel/Lower.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using System;
2-
using System.Collections;
32
using System.Collections.Generic;
43

54
namespace NHibernate.DomainModel
@@ -9,7 +8,7 @@ public class Lower : Top
98
private int _intprop;
109
private string _foo;
1110
private ISet<Top> _set;
12-
private IList _bag;
11+
private IList<Top> _bag;
1312
private Lower _other;
1413
private Top _another;
1514
private Lower _yetAnother;
@@ -33,7 +32,7 @@ public ISet<Top> Set
3332
set { _set = value; }
3433
}
3534

36-
public IList Bag
35+
public IList<Top> Bag
3736
{
3837
get { return _bag; }
3938
set { _bag = value; }

src/NHibernate.DomainModel/NHSpecific/Optimistic.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using System;
2-
using System.Collections;
3-
2+
using System.Collections.Generic;
3+
44
namespace NHibernate.DomainModel.NHSpecific
55
{
66
/// <summary>
@@ -10,7 +10,7 @@ public class Optimistic
1010
{
1111
private int _id;
1212
private string _string;
13-
private IList _bag;
13+
private IList<string> _bag;
1414

1515
public int Id
1616
{
@@ -24,7 +24,7 @@ public string String
2424
set { _string = value; }
2525
}
2626

27-
public IList Bag
27+
public IList<string> Bag
2828
{
2929
get { return _bag; }
3030
set { _bag = value; }

src/NHibernate.DomainModel/Po.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using System;
2-
using System.Collections;
32
using System.Collections.Generic;
43

54
namespace NHibernate.DomainModel
@@ -10,7 +9,7 @@ public class Po
109
private string _value;
1110
private ISet<Multi> _set;
1211
private ISet<object> _eagerSet;
13-
private IList _list;
12+
private IList<SubMulti> _list;
1413
private Top _top;
1514
private Lower _lower;
1615

@@ -33,7 +32,7 @@ public ISet<Multi> Set
3332
set { _set = value; }
3433
}
3534

36-
public IList List
35+
public IList<SubMulti> List
3736
{
3837
get { return _list; }
3938
set { _list = value; }

src/NHibernate.DomainModel/SubMulti.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
using System;
2-
using System.Collections;
3-
2+
using System.Collections.Generic;
3+
44
namespace NHibernate.DomainModel
55
{
66
public class SubMulti : Multi
77
{
88
private float _amount;
99
private SubMulti _parent;
10-
private IList _children;
11-
private IList _moreChildren;
10+
private IList<SubMulti> _children;
11+
private IList<SubMulti> _moreChildren;
1212

1313
public float Amount
1414
{
@@ -22,13 +22,13 @@ public SubMulti Parent
2222
set { _parent = value; }
2323
}
2424

25-
public IList Children
25+
public IList<SubMulti> Children
2626
{
2727
get { return _children; }
2828
set { _children = value; }
2929
}
3030

31-
public IList MoreChildren
31+
public IList<SubMulti> MoreChildren
3232
{
3333
get { return _moreChildren; }
3434
set { _moreChildren = value; }

src/NHibernate.Test/CompositeId/Order.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
using System;
2-
using System.Collections;
2+
using System.Collections.Generic;
33

44
namespace NHibernate.Test.CompositeId
55
{
@@ -46,7 +46,7 @@ public override int GetHashCode()
4646
private ID id = new ID();
4747
private DateTime orderDate;
4848
private Customer customer;
49-
private IList lineItems = new ArrayList();
49+
private IList<LineItem> lineItems = new List<LineItem>();
5050
private decimal total;
5151

5252
public Order() {}
@@ -76,7 +76,7 @@ public virtual Customer Customer
7676
set { customer = value; }
7777
}
7878

79-
public virtual IList LineItems
79+
public virtual IList<LineItem> LineItems
8080
{
8181
get { return lineItems; }
8282
set { lineItems = value; }

src/NHibernate.Test/FilterTest/Order.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
using System;
2-
using System.Collections;
2+
using System.Collections.Generic;
33

44
namespace NHibernate.Test.FilterTest
55
{
@@ -11,7 +11,7 @@ public class Order
1111
private DateTime fulfillmentDate;
1212
private Salesperson salesperson;
1313
private String buyer;
14-
private IList lineItems = new ArrayList();
14+
private IList<LineItem> lineItems = new List<LineItem>();
1515

1616
public virtual long Id
1717
{
@@ -49,7 +49,7 @@ public virtual string Buyer
4949
set { buyer = value; }
5050
}
5151

52-
public virtual IList LineItems
52+
public virtual IList<LineItem> LineItems
5353
{
5454
get { return lineItems; }
5555
set { lineItems = value; }

src/NHibernate.Test/Legacy/MultiTableTest.cs

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,9 @@ public void SubclassCollection()
6868
SubMulti sm = new SubMulti();
6969
SubMulti sm1 = new SubMulti();
7070
SubMulti sm2 = new SubMulti();
71-
IList list = new ArrayList();
72-
IList anotherList = new ArrayList();
73-
sm.Children = list;
74-
sm.MoreChildren = anotherList;
71+
sm.Children = new List<SubMulti> {sm1, sm2};
72+
sm.MoreChildren = new List<SubMulti> {sm1, sm2};
7573
sm.ExtraProp = "foo";
76-
list.Add(sm1);
77-
list.Add(sm2);
78-
anotherList.Add(sm1);
79-
anotherList.Add(sm2);
8074
sm1.Parent = sm;
8175
sm2.Parent = sm;
8276
object id = s.Save(sm);
@@ -619,8 +613,7 @@ public void Collection()
619613
multi1.Po = po;
620614
multi2.Po = po;
621615
po.Set = new HashSet<Multi> {multi1, multi2};
622-
po.List = new ArrayList();
623-
po.List.Add(new SubMulti());
616+
po.List = new List<SubMulti> {new SubMulti()};
624617
object id = s.Save(po);
625618
Assert.IsNotNull(id);
626619
t.Commit();
@@ -661,7 +654,7 @@ public void CollectionPointer()
661654
{
662655
ISession s = OpenSession();
663656
Lower ls = new Lower();
664-
IList list = new ArrayList();
657+
IList<Top> list = new List<Top>();
665658
ls.Bag = list;
666659
Top simple = new Top();
667660
object id = s.Save(ls);

src/NHibernate.Test/NHSpecificTest/NH1359/Person.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System.Collections;
1+
using System.Collections.Generic;
22

33
namespace NHibernate.Test.NHSpecificTest.NH1359
44
{
@@ -7,20 +7,20 @@ public class Person
77
private int id;
88
private int iq;
99
private string name;
10-
private IList pets;
10+
private IList<Pet> pets;
1111
private int shoeSize;
1212

1313
public Person()
1414
{
15-
Pets = new ArrayList();
15+
Pets = new List<Pet>();
1616
}
1717

1818
public Person(string name, int iq, int shoeSize)
1919
{
2020
this.name = name;
2121
this.iq = iq;
2222
this.shoeSize = shoeSize;
23-
Pets = new ArrayList();
23+
Pets = new List<Pet>();
2424
}
2525

2626
public virtual int Id
@@ -47,7 +47,7 @@ public virtual int ShoeSize
4747
set { shoeSize = value; }
4848
}
4949

50-
public virtual IList Pets
50+
public virtual IList<Pet> Pets
5151
{
5252
get { return pets; }
5353
protected set { pets = value; }

src/NHibernate.Test/NHSpecificTest/NH1393/Person.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System.Collections;
1+
using System.Collections.Generic;
22

33
namespace NHibernate.Test.NHSpecificTest.NH1393
44
{
@@ -7,20 +7,20 @@ public class Person
77
private int id;
88
private int iq;
99
private string name;
10-
private IList pets;
10+
private IList<Pet> pets;
1111
private int shoeSize;
1212

1313
public Person()
1414
{
15-
pets = new ArrayList();
15+
pets = new List<Pet>();
1616
}
1717

1818
public Person(string name, int iq, int shoeSize)
1919
{
2020
this.name = name;
2121
this.iq = iq;
2222
this.shoeSize = shoeSize;
23-
pets = new ArrayList();
23+
pets = new List<Pet>();
2424
}
2525

2626
public virtual int Id
@@ -47,7 +47,7 @@ public virtual int ShoeSize
4747
set { shoeSize = value; }
4848
}
4949

50-
public virtual IList Pets
50+
public virtual IList<Pet> Pets
5151
{
5252
get { return pets; }
5353
protected set { pets = value; }

src/NHibernate.Test/NHSpecificTest/NH1394/Person.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System.Collections;
1+
using System.Collections.Generic;
22

33
namespace NHibernate.Test.NHSpecificTest.NH1394
44
{
@@ -7,20 +7,20 @@ public class Person
77
private int id;
88
private int iq;
99
private string name;
10-
private IList pets;
10+
private IList<Pet> pets;
1111
private int shoeSize;
1212

1313
public Person()
1414
{
15-
pets = new ArrayList();
15+
pets = new List<Pet>();
1616
}
1717

1818
public Person(string name, int iq, int shoeSize)
1919
{
2020
this.name = name;
2121
this.iq = iq;
2222
this.shoeSize = shoeSize;
23-
pets = new ArrayList();
23+
pets = new List<Pet>();
2424
}
2525

2626
public virtual int Id
@@ -47,7 +47,7 @@ public virtual int ShoeSize
4747
set { shoeSize = value; }
4848
}
4949

50-
public virtual IList Pets
50+
public virtual IList<Pet> Pets
5151
{
5252
get { return pets; }
5353
protected set { pets = value; }

0 commit comments

Comments
 (0)