|
|
|
@ -7,12 +7,11 @@ |
|
|
|
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
|
|
|
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
using System; |
|
|
|
using System; |
|
|
|
using System.Collections.Generic; |
|
|
|
|
|
|
|
using System.ComponentModel; |
|
|
|
using System.ComponentModel; |
|
|
|
using System.Linq; |
|
|
|
using System.Linq; |
|
|
|
|
|
|
|
|
|
|
|
using ICSharpCode.Reporting.BaseClasses; |
|
|
|
using ICSharpCode.Reporting.BaseClasses; |
|
|
|
using ICSharpCode.Reporting.DataManager.Listhandling; |
|
|
|
using ICSharpCode.Reporting.DataManager.Listhandling; |
|
|
|
using ICSharpCode.Reporting.DataSource; |
|
|
|
|
|
|
|
using ICSharpCode.Reporting.Items; |
|
|
|
using ICSharpCode.Reporting.Items; |
|
|
|
using NUnit.Framework; |
|
|
|
using NUnit.Framework; |
|
|
|
|
|
|
|
|
|
|
|
@ -27,20 +26,20 @@ namespace ICSharpCode.Reporting.Test.DataSource |
|
|
|
[Test] |
|
|
|
[Test] |
|
|
|
public void CanInitDataCollection() |
|
|
|
public void CanInitDataCollection() |
|
|
|
{ |
|
|
|
{ |
|
|
|
var collectionSource = new CollectionSource (list,new ReportSettings()); |
|
|
|
var collectionSource = new CollectionSource (list,typeof(Contributor),new ReportSettings()); |
|
|
|
Assert.That(collectionSource,Is.Not.Null); |
|
|
|
Assert.That(collectionSource,Is.Not.Null); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
[Test] |
|
|
|
[Test] |
|
|
|
public void CurrentpositionShouldZeroAfterBind () { |
|
|
|
public void CurrentpositionShouldZeroAfterBind () { |
|
|
|
var collectionSource = new CollectionSource (list,new ReportSettings()); |
|
|
|
var collectionSource = new CollectionSource (list,typeof(Contributor),new ReportSettings()); |
|
|
|
collectionSource.Bind(); |
|
|
|
collectionSource.Bind(); |
|
|
|
Assert.That(collectionSource.CurrentPosition,Is.EqualTo(0)); |
|
|
|
Assert.That(collectionSource.CurrentPosition,Is.EqualTo(0)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
[Test] |
|
|
|
[Test] |
|
|
|
public void CurrentPositionIsTwo () { |
|
|
|
public void CurrentPositionIsTwo () { |
|
|
|
var collectionSource = new CollectionSource (list,new ReportSettings()); |
|
|
|
var collectionSource = new CollectionSource (list,typeof(Contributor),new ReportSettings()); |
|
|
|
collectionSource.Bind(); |
|
|
|
collectionSource.Bind(); |
|
|
|
collectionSource.MoveNext(); |
|
|
|
collectionSource.MoveNext(); |
|
|
|
collectionSource.MoveNext(); |
|
|
|
collectionSource.MoveNext(); |
|
|
|
@ -49,20 +48,21 @@ namespace ICSharpCode.Reporting.Test.DataSource |
|
|
|
|
|
|
|
|
|
|
|
[Test] |
|
|
|
[Test] |
|
|
|
public void CollectionCountIsEqualToListCount() { |
|
|
|
public void CollectionCountIsEqualToListCount() { |
|
|
|
var collectionSource = new CollectionSource (list,new ReportSettings()); |
|
|
|
var collectionSource = new CollectionSource (list,typeof(Contributor),new ReportSettings()); |
|
|
|
Assert.That(collectionSource.Count,Is.EqualTo(list.Count)); |
|
|
|
Assert.That(collectionSource.Count,Is.EqualTo(list.Count)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[Test] |
|
|
|
[Test] |
|
|
|
public void AvailableFieldsEqualContibutorsPropertyCount() { |
|
|
|
public void AvailableFieldsEqualContibutorsPropertyCount() { |
|
|
|
var collectionSource = new CollectionSource (list,new ReportSettings()); |
|
|
|
var collectionSource = new CollectionSource (list,typeof(Contributor),new ReportSettings()); |
|
|
|
Assert.That(collectionSource.AvailableFields.Count,Is.EqualTo(6)); |
|
|
|
Assert.That(collectionSource.AvailableFields.Count,Is.EqualTo(6)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
#region Fill
|
|
|
|
#region Fill
|
|
|
|
|
|
|
|
|
|
|
|
[Test] |
|
|
|
[Test] |
|
|
|
|
|
|
|
[Ignore] |
|
|
|
public void TypeOfReportItemIsString () { |
|
|
|
public void TypeOfReportItemIsString () { |
|
|
|
var ric = new ReportItemCollection(){ |
|
|
|
var ric = new ReportItemCollection(){ |
|
|
|
new BaseDataItem(){ |
|
|
|
new BaseDataItem(){ |
|
|
|
@ -73,9 +73,9 @@ namespace ICSharpCode.Reporting.Test.DataSource |
|
|
|
ColumnName = "Firstname" |
|
|
|
ColumnName = "Firstname" |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
var collectionSource = new CollectionSource (list,new ReportSettings()); |
|
|
|
var collectionSource = new CollectionSource (list,typeof(Contributor),new ReportSettings()); |
|
|
|
collectionSource.Bind(); |
|
|
|
collectionSource.Bind(); |
|
|
|
collectionSource.Fill(ric); |
|
|
|
// collectionSource.Fill(ric);
|
|
|
|
foreach (BaseDataItem element in ric) { |
|
|
|
foreach (BaseDataItem element in ric) { |
|
|
|
Assert.That(element.DataType,Is.EqualTo("System.String")); |
|
|
|
Assert.That(element.DataType,Is.EqualTo("System.String")); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -83,6 +83,7 @@ namespace ICSharpCode.Reporting.Test.DataSource |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[Test] |
|
|
|
[Test] |
|
|
|
|
|
|
|
[Ignore] |
|
|
|
public void FillReportItemCollection () { |
|
|
|
public void FillReportItemCollection () { |
|
|
|
var ric = new ReportItemCollection(){ |
|
|
|
var ric = new ReportItemCollection(){ |
|
|
|
new BaseDataItem(){ |
|
|
|
new BaseDataItem(){ |
|
|
|
@ -93,9 +94,9 @@ namespace ICSharpCode.Reporting.Test.DataSource |
|
|
|
ColumnName = "Firstname" |
|
|
|
ColumnName = "Firstname" |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
var collectionSource = new CollectionSource (list,new ReportSettings()); |
|
|
|
var collectionSource = new CollectionSource (list,typeof(Contributor),new ReportSettings()); |
|
|
|
collectionSource.Bind(); |
|
|
|
collectionSource.Bind(); |
|
|
|
collectionSource.Fill(ric); |
|
|
|
// collectionSource.Fill(ric);
|
|
|
|
foreach (BaseDataItem element in ric) { |
|
|
|
foreach (BaseDataItem element in ric) { |
|
|
|
Assert.That(element.DBValue,Is.Not.EqualTo(String.Empty)); |
|
|
|
Assert.That(element.DBValue,Is.Not.EqualTo(String.Empty)); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -110,7 +111,7 @@ namespace ICSharpCode.Reporting.Test.DataSource |
|
|
|
public void GroupbyOneColumn () { |
|
|
|
public void GroupbyOneColumn () { |
|
|
|
var rs = new ReportSettings(); |
|
|
|
var rs = new ReportSettings(); |
|
|
|
rs.GroupColumnCollection.Add( new GroupColumn("GroupItem",1,ListSortDirection.Ascending)); |
|
|
|
rs.GroupColumnCollection.Add( new GroupColumn("GroupItem",1,ListSortDirection.Ascending)); |
|
|
|
var collectionSource = new CollectionSource (list,rs); |
|
|
|
var collectionSource = new CollectionSource (list,typeof(Contributor),rs); |
|
|
|
collectionSource.Bind(); |
|
|
|
collectionSource.Bind(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -133,7 +134,7 @@ namespace ICSharpCode.Reporting.Test.DataSource |
|
|
|
|
|
|
|
|
|
|
|
[Test] |
|
|
|
[Test] |
|
|
|
public void CreateUnsortedIndex() { |
|
|
|
public void CreateUnsortedIndex() { |
|
|
|
var collectionSource = new CollectionSource (list,new ReportSettings()); |
|
|
|
var collectionSource = new CollectionSource (list,typeof(Contributor),new ReportSettings()); |
|
|
|
collectionSource.Bind(); |
|
|
|
collectionSource.Bind(); |
|
|
|
Assert.That(collectionSource.IndexList.Count,Is.EqualTo(collectionSource.Count)); |
|
|
|
Assert.That(collectionSource.IndexList.Count,Is.EqualTo(collectionSource.Count)); |
|
|
|
Assert.That(collectionSource.IndexList.CurrentPosition,Is.EqualTo(0)); |
|
|
|
Assert.That(collectionSource.IndexList.CurrentPosition,Is.EqualTo(0)); |
|
|
|
@ -145,7 +146,7 @@ namespace ICSharpCode.Reporting.Test.DataSource |
|
|
|
public void SortColumnNotExist() { |
|
|
|
public void SortColumnNotExist() { |
|
|
|
var rs = new ReportSettings(); |
|
|
|
var rs = new ReportSettings(); |
|
|
|
rs.SortColumnsCollection.Add(new SortColumn("aa",ListSortDirection.Ascending)); |
|
|
|
rs.SortColumnsCollection.Add(new SortColumn("aa",ListSortDirection.Ascending)); |
|
|
|
var collectionSource = new CollectionSource (list,rs); |
|
|
|
var collectionSource = new CollectionSource (list,typeof(Contributor),rs); |
|
|
|
collectionSource.Bind(); |
|
|
|
collectionSource.Bind(); |
|
|
|
Assert.That(collectionSource.IndexList,Is.Not.Null); |
|
|
|
Assert.That(collectionSource.IndexList,Is.Not.Null); |
|
|
|
Assert.That(collectionSource.IndexList.Count,Is.EqualTo(0)); |
|
|
|
Assert.That(collectionSource.IndexList.Count,Is.EqualTo(0)); |
|
|
|
@ -156,7 +157,7 @@ namespace ICSharpCode.Reporting.Test.DataSource |
|
|
|
public void SortOneColumnAscending() { |
|
|
|
public void SortOneColumnAscending() { |
|
|
|
var rs = new ReportSettings(); |
|
|
|
var rs = new ReportSettings(); |
|
|
|
rs.SortColumnsCollection.Add(new SortColumn("Lastname",ListSortDirection.Ascending)); |
|
|
|
rs.SortColumnsCollection.Add(new SortColumn("Lastname",ListSortDirection.Ascending)); |
|
|
|
var collectionSource = new CollectionSource (list,rs); |
|
|
|
var collectionSource = new CollectionSource (list,typeof(Contributor),rs); |
|
|
|
collectionSource.Bind(); |
|
|
|
collectionSource.Bind(); |
|
|
|
string compare = collectionSource.IndexList[0].ObjectArray[0].ToString(); |
|
|
|
string compare = collectionSource.IndexList[0].ObjectArray[0].ToString(); |
|
|
|
foreach (var element in collectionSource.IndexList) { |
|
|
|
foreach (var element in collectionSource.IndexList) { |
|
|
|
@ -173,7 +174,7 @@ namespace ICSharpCode.Reporting.Test.DataSource |
|
|
|
var rs = new ReportSettings(); |
|
|
|
var rs = new ReportSettings(); |
|
|
|
rs.SortColumnsCollection.Add(new SortColumn("Lastname",ListSortDirection.Ascending)); |
|
|
|
rs.SortColumnsCollection.Add(new SortColumn("Lastname",ListSortDirection.Ascending)); |
|
|
|
rs.SortColumnsCollection.Add(new SortColumn("RandomInt",ListSortDirection.Ascending)); |
|
|
|
rs.SortColumnsCollection.Add(new SortColumn("RandomInt",ListSortDirection.Ascending)); |
|
|
|
var collectionSource = new CollectionSource (list,rs); |
|
|
|
var collectionSource = new CollectionSource (list,typeof(Contributor),rs); |
|
|
|
collectionSource.Bind(); |
|
|
|
collectionSource.Bind(); |
|
|
|
string compare = collectionSource.IndexList[0].ObjectArray[0].ToString(); |
|
|
|
string compare = collectionSource.IndexList[0].ObjectArray[0].ToString(); |
|
|
|
foreach (var element in collectionSource.IndexList) { |
|
|
|
foreach (var element in collectionSource.IndexList) { |
|
|
|
|