Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DO NOT MERGE]: IKeyValueCollection as IReadOnlyList #874

16 changes: 8 additions & 8 deletions src/DynamicData.Tests/Cache/SortFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ public void RemoveFirst()
_source.AddOrUpdate(people);

//create age 0 to ensure it is inserted first
var remove = _results.Messages[0].SortedItems.First();
var remove = _results.Messages[0].SortedItems[0];

_source.Remove(remove.Key);

Expand All @@ -323,7 +323,7 @@ public void RemoveFromEnd()
_source.AddOrUpdate(people);

//create age 0 to ensure it is inserted first
var remove = _results.Messages[0].SortedItems.Last();
var remove = _results.Messages[0].SortedItems[^1];

_source.Remove(remove.Key);

Expand Down Expand Up @@ -421,7 +421,7 @@ public void UpdateFirst()
var people = _generator.Take(100).ToArray();
_source.AddOrUpdate(people);

var toupdate = _results.Messages[0].SortedItems.First().Value;
var toupdate = _results.Messages[0].SortedItems[0].Value;
var update = new Person(toupdate.Name, toupdate.Age + 5);

_source.AddOrUpdate(update);
Expand All @@ -444,7 +444,7 @@ public void UpdateLast()
var people = _generator.Take(100).ToArray();
_source.AddOrUpdate(people);

var toupdate = _results.Messages[0].SortedItems.Last().Value;
var toupdate = _results.Messages[0].SortedItems[^1].Value;
var update = new Person(toupdate.Name, toupdate.Age + 5);

_source.AddOrUpdate(update);
Expand Down Expand Up @@ -828,7 +828,7 @@ public void RemoveFirst()
_source.AddOrUpdate(people);

//create age 0 to ensure it is inserted first
var remove = _results.Messages[0].SortedItems.First();
var remove = _results.Messages[0].SortedItems[0];

_source.Remove(remove.Key);

Expand All @@ -849,7 +849,7 @@ public void RemoveFromEnd()
_source.AddOrUpdate(people);

//create age 0 to ensure it is inserted first
var remove = _results.Messages[0].SortedItems.Last();
var remove = _results.Messages[0].SortedItems[^1];

_source.Remove(remove.Key);

Expand Down Expand Up @@ -947,7 +947,7 @@ public void UpdateFirst()
var people = _generator.Take(100).ToArray();
_source.AddOrUpdate(people);

var toupdate = _results.Messages[0].SortedItems.First().Value;
var toupdate = _results.Messages[0].SortedItems[0].Value;
var update = new Person(toupdate.Name, toupdate.Age + 5);

_source.AddOrUpdate(update);
Expand All @@ -970,7 +970,7 @@ public void UpdateLast()
var people = _generator.Take(100).ToArray();
_source.AddOrUpdate(people);

var toupdate = _results.Messages[0].SortedItems.Last().Value;
var toupdate = _results.Messages[0].SortedItems[^1].Value;
var update = new Person(toupdate.Name, toupdate.Age + 5);

_source.AddOrUpdate(update);
Expand Down
6 changes: 3 additions & 3 deletions src/DynamicData/Cache/IKeyValueCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace DynamicData;
/// </summary>
/// <typeparam name="TObject">The type of the object.</typeparam>
/// <typeparam name="TKey">The type of the key.</typeparam>
public interface IKeyValueCollection<TObject, TKey> : IEnumerable<KeyValuePair<TKey, TObject>>
public interface IKeyValueCollection<TObject, TKey> : IReadOnlyList<KeyValuePair<TKey, TObject>>
{
/// <summary>
/// Gets the comparer used to perform the sort.
Expand All @@ -26,7 +26,7 @@ public interface IKeyValueCollection<TObject, TKey> : IEnumerable<KeyValuePair<T
/// <value>
/// The count.
/// </value>
int Count { get; }
new int Count { get; }
JakenVeina marked this conversation as resolved.
Show resolved Hide resolved

/// <summary>
/// Gets the optimisations used to produce the sort.
Expand All @@ -53,5 +53,5 @@ public interface IKeyValueCollection<TObject, TKey> : IEnumerable<KeyValuePair<T
/// </returns>
/// <param name="index">The zero-based index of the element to get. </param>
/// <returns>The key value pair.</returns>
KeyValuePair<TKey, TObject> this[int index] { get; }
new KeyValuePair<TKey, TObject> this[int index] { get; }
}
Loading