Index: Core/Components/src/Core.Components.Charting/Data/ChartDataCollection.cs
===================================================================
diff -u -r38ee40c1f98ff4b1921d4de64fd032c8fbcadf92 -rcc526e3e085516c1c2f260e1249b3b9e5a6e9f03
--- Core/Components/src/Core.Components.Charting/Data/ChartDataCollection.cs (.../ChartDataCollection.cs) (revision 38ee40c1f98ff4b1921d4de64fd032c8fbcadf92)
+++ Core/Components/src/Core.Components.Charting/Data/ChartDataCollection.cs (.../ChartDataCollection.cs) (revision cc526e3e085516c1c2f260e1249b3b9e5a6e9f03)
@@ -54,45 +54,46 @@
}
///
- /// Adds an element to the collection of .
+ /// Adds an item to the collection of .
///
- /// The element to add to the collection.
- /// Thrown when is null.
- public void Add(ChartData elementToAdd)
+ /// The item to add to the collection.
+ /// Thrown when is null.
+ public void Add(ChartData item)
{
- if (elementToAdd == null)
+ if (item == null)
{
- throw new ArgumentNullException("elementToAdd", @"An element cannot be null when adding it to the collection.");
+ throw new ArgumentNullException("item", @"An item cannot be null when adding it to the collection.");
}
- chartDataList.Add(elementToAdd);
+ chartDataList.Add(item);
}
///
- /// Inserts the given element into the collection of on the given position.
+ /// Inserts the given item into the collection of on the given index.
///
- /// The position to insert the element on.
- /// The element to insert.
- /// Thrown when is null.
- public void Insert(int position, ChartData elementToInsert)
+ /// The position to insert the item on.
+ /// The item to insert.
+ /// Thrown when is null.
+ /// Thrown when is less than 0 or greater than the size of .
+ public void Insert(int index, ChartData item)
{
- if (elementToInsert == null)
+ if (item == null)
{
- throw new ArgumentNullException("elementToInsert", @"An element cannot be null when adding it to the collection.");
+ throw new ArgumentNullException("item", @"An item cannot be null when adding it to the collection.");
}
- chartDataList.Insert(position, elementToInsert);
+ chartDataList.Insert(index, item);
}
///
- /// Removes the given element from the collection of .
+ /// Removes the given item from the collection of .
///
- /// The element to remove.
- public void Remove(ChartData elementToRemove)
+ /// The item to remove.
+ public void Remove(ChartData item)
{
- chartDataList.Remove(elementToRemove);
+ chartDataList.Remove(item);
}
///
- /// Removes all elements from the collection of .
+ /// Removes all items from the collection of .
///
public void Clear()
{
Index: Core/Components/src/Core.Components.Gis/Data/MapDataCollection.cs
===================================================================
diff -u -r38ee40c1f98ff4b1921d4de64fd032c8fbcadf92 -rcc526e3e085516c1c2f260e1249b3b9e5a6e9f03
--- Core/Components/src/Core.Components.Gis/Data/MapDataCollection.cs (.../MapDataCollection.cs) (revision 38ee40c1f98ff4b1921d4de64fd032c8fbcadf92)
+++ Core/Components/src/Core.Components.Gis/Data/MapDataCollection.cs (.../MapDataCollection.cs) (revision cc526e3e085516c1c2f260e1249b3b9e5a6e9f03)
@@ -54,45 +54,46 @@
}
///
- /// Adds an element to the collection of .
+ /// Adds an item to the collection of .
///
- /// The element to add to the collection.
- /// Thrown when is null.
- public void Add(MapData elementToAdd)
+ /// The item to add to the collection.
+ /// Thrown when is null.
+ public void Add(MapData item)
{
- if (elementToAdd == null)
+ if (item == null)
{
- throw new ArgumentNullException("elementToAdd", @"An element cannot be null when adding it to the collection.");
+ throw new ArgumentNullException("item", @"An item cannot be null when adding it to the collection.");
}
- mapDataList.Add(elementToAdd);
+ mapDataList.Add(item);
}
///
- /// Inserts the given element into the collection of on the given position.
+ /// Inserts the given item into the collection of on the given index.
///
- /// The position to insert the element on.
- /// The element to insert.
- /// Thrown when is null.
- public void Insert(int position, MapData elementToInsert)
+ /// The position to insert the item on.
+ /// The item to insert.
+ /// Thrown when is null.
+ /// Thrown when is less than 0 or greater than the size of .
+ public void Insert(int index, MapData item)
{
- if (elementToInsert == null)
+ if (item == null)
{
- throw new ArgumentNullException("elementToInsert", @"An element cannot be null when adding it to the collection.");
+ throw new ArgumentNullException("item", @"An item cannot be null when adding it to the collection.");
}
- mapDataList.Insert(position, elementToInsert);
+ mapDataList.Insert(index, item);
}
///
- /// Removes the given element from the collection of .
+ /// Removes the given item from the collection of .
///
- /// The element to remove.
- public void Remove(MapData elementToRemove)
+ /// The item to remove.
+ public void Remove(MapData item)
{
- mapDataList.Remove(elementToRemove);
+ mapDataList.Remove(item);
}
///
- /// Removes all elements from the collection of .
+ /// Removes all items from the collection of .
///
public void Clear()
{
Index: Core/Components/test/Core.Components.Charting.Test/Data/ChartDataCollectionTest.cs
===================================================================
diff -u -r848c3a050bda5fb0dd74232deb7f1d5eba8ecbf6 -rcc526e3e085516c1c2f260e1249b3b9e5a6e9f03
--- Core/Components/test/Core.Components.Charting.Test/Data/ChartDataCollectionTest.cs (.../ChartDataCollectionTest.cs) (revision 848c3a050bda5fb0dd74232deb7f1d5eba8ecbf6)
+++ Core/Components/test/Core.Components.Charting.Test/Data/ChartDataCollectionTest.cs (.../ChartDataCollectionTest.cs) (revision cc526e3e085516c1c2f260e1249b3b9e5a6e9f03)
@@ -50,161 +50,179 @@
const string name = "Some name";
// Call
- var data = new ChartDataCollection(name);
+ var chartDataCollection = new ChartDataCollection(name);
// Assert
- Assert.AreEqual(name, data.Name);
- Assert.IsInstanceOf(data);
- CollectionAssert.IsEmpty(data.Collection);
+ Assert.AreEqual(name, chartDataCollection.Name);
+ Assert.IsInstanceOf(chartDataCollection);
+ CollectionAssert.IsEmpty(chartDataCollection.Collection);
}
[Test]
- public void Add_NotNull_AddsElementToCollection()
+ public void Add_NotNull_AddsItemToCollection()
{
// Setup
- var data = new ChartDataCollection("test");
- var objectToAdd = new ChartLineData("test");
+ var item = new ChartLineData("test");
+ var chartDataCollection = new ChartDataCollection("test");
// Call
- data.Add(objectToAdd);
+ chartDataCollection.Add(item);
// Assert
- var chartData = data.Collection.ToList();
+ var chartData = chartDataCollection.Collection.ToList();
Assert.AreEqual(1, chartData.Count);
- Assert.AreSame(objectToAdd, chartData.First());
+ Assert.AreSame(item, chartData.First());
}
[Test]
public void Add_Null_ThrowsArgumentNullException()
{
// Setup
- var data = new ChartDataCollection("test");
+ var chartDataCollection = new ChartDataCollection("test");
// Call
- TestDelegate call = () => data.Add(null);
+ TestDelegate call = () => chartDataCollection.Add(null);
// Assert
- TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, "An element cannot be null when adding it to the collection.");
+ TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, "An item cannot be null when adding it to the collection.");
}
[Test]
- public void Insert_NotNull_InsertsElementToCollectionAtGivenPosition()
+ public void Insert_ItemNotNullAndValidIndex_InsertsItemToCollectionAtGivenIndex()
{
// Setup
- TestChartData chartData = new TestChartData("test");
- var data = new ChartDataCollection("test");
- var objectToAdd = new ChartLineData("test");
+ var itemToInsert = new ChartLineData("test");
+ var existingItem = new TestChartData("test");
+ var chartDataCollection = new ChartDataCollection("test");
- data.Add(chartData);
+ chartDataCollection.Add(existingItem);
// Precondition
- Assert.AreEqual(1, data.Collection.Count());
- Assert.AreSame(chartData, data.Collection.ElementAt(0));
+ Assert.AreEqual(1, chartDataCollection.Collection.Count());
+ Assert.AreSame(existingItem, chartDataCollection.Collection.ElementAt(0));
// Call
- data.Insert(0, objectToAdd);
+ chartDataCollection.Insert(0, itemToInsert);
// Assert
- Assert.AreEqual(2, data.Collection.Count());
- Assert.AreSame(objectToAdd, data.Collection.ElementAt(0));
- Assert.AreSame(chartData, data.Collection.ElementAt(1));
+ Assert.AreEqual(2, chartDataCollection.Collection.Count());
+ Assert.AreSame(itemToInsert, chartDataCollection.Collection.ElementAt(0));
+ Assert.AreSame(existingItem, chartDataCollection.Collection.ElementAt(1));
}
[Test]
- public void Insert_ElementNull_ThrowsArgumentNullException()
+ public void Insert_ItemNull_ThrowsArgumentNullException()
{
// Setup
- var data = new ChartDataCollection("test");
+ var chartDataCollection = new ChartDataCollection("test");
// Call
- TestDelegate call = () => data.Insert(0, null);
+ TestDelegate call = () => chartDataCollection.Insert(0, null);
// Assert
- TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, "An element cannot be null when adding it to the collection.");
+ TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, "An item cannot be null when adding it to the collection.");
}
+ [TestCase(-1)]
+ [TestCase(2)]
+ public void Insert_InvalidIndex_ThrowsArgumentOutOfRangeException(int invalidIndex)
+ {
+ // Setup
+ var itemToInsert = new ChartLineData("test");
+ var existingItem = new TestChartData("test");
+ var chartDataCollection = new ChartDataCollection("test");
+
+ chartDataCollection.Add(existingItem);
+
+ // Call
+ TestDelegate call = () => chartDataCollection.Insert(invalidIndex, itemToInsert);
+
+ // Assert
+ Assert.Throws(call, "index");
+ }
+
[Test]
- public void Remove_ExistingElement_RemovesElement()
+ public void Remove_ExistingItem_RemovesItem()
{
// Setup
- var data = new ChartDataCollection("test");
- var dataElement = new ChartLineData("test");
+ var item = new ChartLineData("test");
+ var chartDataCollection = new ChartDataCollection("test");
- data.Add(dataElement);
+ chartDataCollection.Add(item);
// Precondition
- Assert.AreEqual(1, data.Collection.Count());
- Assert.IsInstanceOf(data.Collection.First());
+ Assert.AreEqual(1, chartDataCollection.Collection.Count());
+ Assert.IsInstanceOf(chartDataCollection.Collection.First());
// Call
- data.Remove(dataElement);
+ chartDataCollection.Remove(item);
// Assert
- CollectionAssert.IsEmpty(data.Collection);
+ CollectionAssert.IsEmpty(chartDataCollection.Collection);
}
[Test]
public void Remove_Null_DoesNotRemove()
{
// Setup
- var data = new ChartDataCollection("test");
- var dataElement = new ChartLineData("test");
+ var item = new ChartLineData("test");
+ var chartDataCollection = new ChartDataCollection("test");
- data.Add(dataElement);
+ chartDataCollection.Add(item);
// Precondition
- Assert.AreEqual(1, data.Collection.Count());
- Assert.IsInstanceOf(data.Collection.First());
- var listBeforeRemove = data.Collection;
+ Assert.AreEqual(1, chartDataCollection.Collection.Count());
+ Assert.IsInstanceOf(chartDataCollection.Collection.First());
+ var listBeforeRemove = chartDataCollection.Collection.ToList();
// Call
- data.Remove(null);
+ chartDataCollection.Remove(null);
// Assert
- CollectionAssert.AreEqual(listBeforeRemove, data.Collection);
+ CollectionAssert.AreEqual(listBeforeRemove, chartDataCollection.Collection);
}
[Test]
- public void Remove_NotExistingElement_DoesNotRemove()
+ public void Remove_NotExistingItem_DoesNotRemove()
{
// Setup
- var data = new ChartDataCollection("test");
- var dataElement = new ChartLineData("test");
- var otherDataElement = new ChartPointData("another test");
+ var item = new ChartLineData("test");
+ var otherItem = new ChartPointData("another test");
+ var chartDataCollection = new ChartDataCollection("test");
- data.Add(dataElement);
+ chartDataCollection.Add(item);
// Precondition
- Assert.AreEqual(1, data.Collection.Count());
- Assert.IsInstanceOf(data.Collection.First());
- var listBeforeRemove = data.Collection;
+ Assert.AreEqual(1, chartDataCollection.Collection.Count());
+ Assert.IsInstanceOf(chartDataCollection.Collection.First());
+ var listBeforeRemove = chartDataCollection.Collection.ToList();
// Call
- data.Remove(otherDataElement);
+ chartDataCollection.Remove(otherItem);
// Assert
- CollectionAssert.AreEqual(listBeforeRemove, data.Collection);
+ CollectionAssert.AreEqual(listBeforeRemove, chartDataCollection.Collection);
}
[Test]
- public void Clear_Always_RemovesAllElements()
+ public void Clear_Always_RemovesAllItems()
{
// Setup
- var data = new ChartDataCollection("test");
- var dataElement1 = new ChartLineData("test");
- var dataElement2 = new ChartLineData("test");
+ var item1 = new ChartLineData("test");
+ var item2 = new ChartLineData("test");
+ var chartDataCollection = new ChartDataCollection("test");
- data.Add(dataElement1);
- data.Add(dataElement2);
+ chartDataCollection.Add(item1);
+ chartDataCollection.Add(item2);
// Precondition
- Assert.AreEqual(2, data.Collection.Count());
+ Assert.AreEqual(2, chartDataCollection.Collection.Count());
// Call
- data.Clear();
+ chartDataCollection.Clear();
// Assert
- CollectionAssert.IsEmpty(data.Collection);
+ CollectionAssert.IsEmpty(chartDataCollection.Collection);
}
}
}
\ No newline at end of file
Index: Core/Components/test/Core.Components.Gis.Test/Data/MapDataCollectionTest.cs
===================================================================
diff -u -r38ee40c1f98ff4b1921d4de64fd032c8fbcadf92 -rcc526e3e085516c1c2f260e1249b3b9e5a6e9f03
--- Core/Components/test/Core.Components.Gis.Test/Data/MapDataCollectionTest.cs (.../MapDataCollectionTest.cs) (revision 38ee40c1f98ff4b1921d4de64fd032c8fbcadf92)
+++ Core/Components/test/Core.Components.Gis.Test/Data/MapDataCollectionTest.cs (.../MapDataCollectionTest.cs) (revision cc526e3e085516c1c2f260e1249b3b9e5a6e9f03)
@@ -50,161 +50,179 @@
const string name = "Some name";
// Call
- var data = new MapDataCollection(name);
+ var mapDataCollection = new MapDataCollection(name);
// Assert
- Assert.AreEqual(name, data.Name);
- Assert.IsInstanceOf(data);
- CollectionAssert.IsEmpty(data.Collection);
+ Assert.AreEqual(name, mapDataCollection.Name);
+ Assert.IsInstanceOf(mapDataCollection);
+ CollectionAssert.IsEmpty(mapDataCollection.Collection);
}
[Test]
- public void Add_NotNull_AddsElementToCollection()
+ public void Add_NotNull_AddsItemToCollection()
{
// Setup
- var data = new MapDataCollection("test");
- var objectToAdd = new MapLineData("test");
+ var item = new MapLineData("test");
+ var mapDataCollection = new MapDataCollection("test");
// Call
- data.Add(objectToAdd);
+ mapDataCollection.Add(item);
// Assert
- var mpaData = data.Collection.ToList();
- Assert.AreEqual(1, mpaData.Count);
- Assert.AreSame(objectToAdd, mpaData.First());
+ var mapData = mapDataCollection.Collection.ToList();
+ Assert.AreEqual(1, mapData.Count);
+ Assert.AreSame(item, mapData.First());
}
[Test]
public void Add_Null_ThrowsArgumentNullException()
{
// Setup
- var data = new MapDataCollection("test");
+ var mapDataCollection = new MapDataCollection("test");
// Call
- TestDelegate call = () => data.Add(null);
+ TestDelegate call = () => mapDataCollection.Add(null);
// Assert
- TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, "An element cannot be null when adding it to the collection.");
+ TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, "An item cannot be null when adding it to the collection.");
}
[Test]
- public void Insert_NotNull_InsertsElementToCollectionAtGivenPosition()
+ public void Insert_ItemNotNullAndValidIndex_InsertsItemToCollectionAtGivenIndex()
{
// Setup
- var mapData = new MapPointData("test");
- var data = new MapDataCollection("test");
- var objectToAdd = new MapLineData("test");
+ var itemToInsert = new MapLineData("test");
+ var existingItem = new MapPointData("test");
+ var mapDataCollection = new MapDataCollection("test");
- data.Add(mapData);
+ mapDataCollection.Add(existingItem);
// Precondition
- Assert.AreEqual(1, data.Collection.Count());
- Assert.AreSame(mapData, data.Collection.ElementAt(0));
+ Assert.AreEqual(1, mapDataCollection.Collection.Count());
+ Assert.AreSame(existingItem, mapDataCollection.Collection.ElementAt(0));
// Call
- data.Insert(0, objectToAdd);
+ mapDataCollection.Insert(0, itemToInsert);
// Assert
- Assert.AreEqual(2, data.Collection.Count());
- Assert.AreSame(objectToAdd, data.Collection.ElementAt(0));
- Assert.AreSame(mapData, data.Collection.ElementAt(1));
+ Assert.AreEqual(2, mapDataCollection.Collection.Count());
+ Assert.AreSame(itemToInsert, mapDataCollection.Collection.ElementAt(0));
+ Assert.AreSame(existingItem, mapDataCollection.Collection.ElementAt(1));
}
[Test]
- public void Insert_ElementNull_ThrowsArgumentNullException()
+ public void Insert_ItemNull_ThrowsArgumentNullException()
{
// Setup
- var data = new MapDataCollection("test");
+ var mapDataCollection = new MapDataCollection("test");
// Call
- TestDelegate call = () => data.Insert(0, null);
+ TestDelegate call = () => mapDataCollection.Insert(0, null);
// Assert
- TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, "An element cannot be null when adding it to the collection.");
+ TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, "An item cannot be null when adding it to the collection.");
}
+ [TestCase(-1)]
+ [TestCase(2)]
+ public void Insert_InvalidIndex_ThrowsArgumentOutOfRangeException(int invalidIndex)
+ {
+ // Setup
+ var itemToInsert = new MapLineData("test");
+ var existingItem = new MapPointData("test");
+ var mapDataCollection = new MapDataCollection("test");
+
+ mapDataCollection.Add(existingItem);
+
+ // Call
+ TestDelegate call = () => mapDataCollection.Insert(invalidIndex, itemToInsert);
+
+ // Assert
+ Assert.Throws(call, "index");
+ }
+
[Test]
- public void Remove_ExistingElement_RemovesElement()
+ public void Remove_ExistingItem_RemovesItem()
{
// Setup
- var data = new MapDataCollection("test");
- var dataElement = new MapLineData("test");
+ var item = new MapLineData("test");
+ var mapDataCollection = new MapDataCollection("test");
- data.Add(dataElement);
+ mapDataCollection.Add(item);
// Precondition
- Assert.AreEqual(1, data.Collection.Count());
- Assert.IsInstanceOf(data.Collection.First());
+ Assert.AreEqual(1, mapDataCollection.Collection.Count());
+ Assert.IsInstanceOf(mapDataCollection.Collection.First());
// Call
- data.Remove(dataElement);
+ mapDataCollection.Remove(item);
// Assert
- CollectionAssert.IsEmpty(data.Collection);
+ CollectionAssert.IsEmpty(mapDataCollection.Collection);
}
[Test]
public void Remove_Null_DoesNotRemove()
{
// Setup
- var data = new MapDataCollection("test");
- var dataElement = new MapLineData("test");
+ var item = new MapLineData("test");
+ var mapDataCollection = new MapDataCollection("test");
- data.Add(dataElement);
+ mapDataCollection.Add(item);
// Precondition
- Assert.AreEqual(1, data.Collection.Count());
- Assert.IsInstanceOf(data.Collection.First());
- var listBeforeRemove = data.Collection;
+ Assert.AreEqual(1, mapDataCollection.Collection.Count());
+ Assert.IsInstanceOf(mapDataCollection.Collection.First());
+ var listBeforeRemove = mapDataCollection.Collection.ToList();
// Call
- data.Remove(null);
+ mapDataCollection.Remove(null);
// Assert
- CollectionAssert.AreEqual(listBeforeRemove, data.Collection);
+ CollectionAssert.AreEqual(listBeforeRemove, mapDataCollection.Collection);
}
[Test]
- public void Remove_NotExistingElement_DoesNotRemove()
+ public void Remove_NotExistingItem_DoesNotRemove()
{
// Setup
- var data = new MapDataCollection("test");
- var dataElement = new MapLineData("test");
- var otherDataElement = new MapPointData("another test");
+ var item = new MapLineData("test");
+ var otherItem = new MapPointData("another test");
+ var mapDataCollection = new MapDataCollection("test");
- data.Add(dataElement);
+ mapDataCollection.Add(item);
// Precondition
- Assert.AreEqual(1, data.Collection.Count());
- Assert.IsInstanceOf(data.Collection.First());
- var listBeforeRemove = data.Collection;
+ Assert.AreEqual(1, mapDataCollection.Collection.Count());
+ Assert.IsInstanceOf(mapDataCollection.Collection.First());
+ var listBeforeRemove = mapDataCollection.Collection.ToList();
// Call
- data.Remove(otherDataElement);
+ mapDataCollection.Remove(otherItem);
// Assert
- CollectionAssert.AreEqual(listBeforeRemove, data.Collection);
+ CollectionAssert.AreEqual(listBeforeRemove, mapDataCollection.Collection);
}
[Test]
- public void Clear_Always_RemovesAllElements()
+ public void Clear_Always_RemovesAllItems()
{
// Setup
- var data = new MapDataCollection("test");
- var dataElement1 = new MapLineData("test");
- var dataElement2 = new MapLineData("test");
+ var item1 = new MapLineData("test");
+ var item2 = new MapLineData("test");
+ var mapDataCollection = new MapDataCollection("test");
- data.Add(dataElement1);
- data.Add(dataElement2);
+ mapDataCollection.Add(item1);
+ mapDataCollection.Add(item2);
// Precondition
- Assert.AreEqual(2, data.Collection.Count());
+ Assert.AreEqual(2, mapDataCollection.Collection.Count());
// Call
- data.Clear();
+ mapDataCollection.Clear();
// Assert
- CollectionAssert.IsEmpty(data.Collection);
+ CollectionAssert.IsEmpty(mapDataCollection.Collection);
}
}
}
\ No newline at end of file