mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-02-16 21:24:58 +00:00
Merge remote-tracking branch 'origin/ConnectPro_v1.1' into ConnectPro_v1.4
# Conflicts: # CHANGELOG.md # ICD.Common.Utils/Properties/AssemblyInfo.cs
This commit is contained in:
@@ -91,6 +91,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|||||||
- Better VC-4 support for IcdConsole
|
- Better VC-4 support for IcdConsole
|
||||||
- JSON refactoring for simpler deserialization
|
- JSON refactoring for simpler deserialization
|
||||||
|
|
||||||
|
## [8.7.1] - 2019-08-22
|
||||||
|
### Changed
|
||||||
|
- Fixed a bug with the IcdOrderedDict index setter that was creating additional values
|
||||||
|
|
||||||
## [8.7.0] - 2019-06-24
|
## [8.7.0] - 2019-06-24
|
||||||
### Added
|
### Added
|
||||||
- IcdXmlException exposes line number and position properties
|
- IcdXmlException exposes line number and position properties
|
||||||
|
|||||||
@@ -69,16 +69,26 @@ namespace ICD.Common.Utils.Tests.Collections
|
|||||||
[Test]
|
[Test]
|
||||||
public void IndexerTest()
|
public void IndexerTest()
|
||||||
{
|
{
|
||||||
IcdOrderedDictionary<int, int> dict = new IcdOrderedDictionary<int, int>
|
// ReSharper disable UseObjectOrCollectionInitializer
|
||||||
{
|
IcdOrderedDictionary<int, int> dict = new IcdOrderedDictionary<int, int>();
|
||||||
{0, 0},
|
// ReSharper restore UseObjectOrCollectionInitializer
|
||||||
{1, 10},
|
|
||||||
{-1, -10}
|
dict[0] = 0;
|
||||||
};
|
dict[1] = 10;
|
||||||
|
dict[-1] = -10;
|
||||||
|
dict[-1] = -11;
|
||||||
|
|
||||||
Assert.AreEqual(0, dict[0]);
|
Assert.AreEqual(0, dict[0]);
|
||||||
Assert.AreEqual(10, dict[1]);
|
Assert.AreEqual(10, dict[1]);
|
||||||
Assert.AreEqual(-10, dict[-1]);
|
Assert.AreEqual(-11, dict[-1]);
|
||||||
|
|
||||||
|
Assert.AreEqual(3, dict.Count);
|
||||||
|
|
||||||
|
int[] expectedKeys = {-1, 0, 1 };
|
||||||
|
int[] expectedValues = {-11, 0, 10};
|
||||||
|
|
||||||
|
Assert.AreEqual(expectedKeys, dict.Keys.ToArray());
|
||||||
|
Assert.AreEqual(expectedValues, dict.Values.ToArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@@ -32,13 +32,8 @@ namespace ICD.Common.Utils.Collections
|
|||||||
if (key == null)
|
if (key == null)
|
||||||
throw new ArgumentNullException("key");
|
throw new ArgumentNullException("key");
|
||||||
|
|
||||||
if (!ContainsKey(key))
|
Remove(key);
|
||||||
{
|
Add(key, value);
|
||||||
int index = m_OrderedKeys.AddSorted(key, m_Comparer);
|
|
||||||
m_ValuesOrderedByKey.Insert(index, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
m_Dictionary[key] = value;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -109,9 +104,12 @@ namespace ICD.Common.Utils.Collections
|
|||||||
throw new ArgumentNullException("key");
|
throw new ArgumentNullException("key");
|
||||||
|
|
||||||
if (m_Dictionary.ContainsKey(key))
|
if (m_Dictionary.ContainsKey(key))
|
||||||
throw new ArgumentException("An item with the same key has already been added.", "key");
|
throw new ArgumentOutOfRangeException("key", "An item with the same key has already been added.");
|
||||||
|
|
||||||
this[key] = value;
|
int index = m_OrderedKeys.AddSorted(key, m_Comparer);
|
||||||
|
m_ValuesOrderedByKey.Insert(index, value);
|
||||||
|
|
||||||
|
m_Dictionary[key] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Clear()
|
public void Clear()
|
||||||
|
|||||||
Reference in New Issue
Block a user