-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Handle KeyNotFoundException thrown from DictionaryPropertyProxy and D…
…ictionaryTypedPropertyProxy (#40) * handle KeyNotFoundException thrown from DictionaryPropertyProxy and DictionaryTypedPropertyProxy * use TryGetValue in DictionaryTypedPropertyProxy * remove try-catch in DictionaryPropertyProxy * revert to stopping patch execution on patch error
- Loading branch information
1 parent
b7cf008
commit ea4baf5
Showing
4 changed files
with
212 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
SystemTextJsonPatch.Tests/TestObjectModels/NonGenericDictionary.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
using System; | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
|
||
namespace SystemTextJsonPatch.IntegrationTests; | ||
|
||
public class NonGenericDictionary : IDictionary | ||
{ | ||
private readonly Dictionary<object, object> _dictionary = new(); | ||
|
||
public object this[object key] { get => _dictionary[key]; set => _dictionary[key] = value; } | ||
|
||
public bool IsFixedSize => false; | ||
|
||
public bool IsReadOnly => false; | ||
|
||
public ICollection Keys => _dictionary.Keys; | ||
|
||
public ICollection Values => _dictionary.Values; | ||
|
||
public int Count => _dictionary.Count; | ||
|
||
public bool IsSynchronized => false; | ||
|
||
public object SyncRoot => null; | ||
|
||
public void Add(object key, object value) => _dictionary.Add(key, value); | ||
|
||
public void Clear() => _dictionary.Clear(); | ||
|
||
public bool Contains(object key) => _dictionary.ContainsKey(key); | ||
|
||
public void CopyTo(Array array, int index) => throw new NotImplementedException(); | ||
|
||
public IDictionaryEnumerator GetEnumerator() => _dictionary.GetEnumerator(); | ||
|
||
public void Remove(object key) => _dictionary.Remove(key); | ||
|
||
IEnumerator IEnumerable.GetEnumerator() => _dictionary.GetEnumerator(); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.