diff --git a/mROA.Cbor/CborSerializaitonToolkit.cs b/mROA.Cbor/CborSerializaitonToolkit.cs index fa7d658..c6e776d 100644 --- a/mROA.Cbor/CborSerializaitonToolkit.cs +++ b/mROA.Cbor/CborSerializaitonToolkit.cs @@ -194,7 +194,7 @@ namespace mROA.Cbor if (type.IsSubclassOf(typeof(ISharedObject))) return ReadSharedObject(reader, type, context); - if (type.IsSubclassOf(typeof(IList))) + if (type.IsSubclassOf(typeof(IList)) || type.IsArray) return ReadList(reader, type, context); return ReadObject(reader, type, context); diff --git a/mROA.Test/CborTest.cs b/mROA.Test/CborTest.cs index 95610e7..0b8a68e 100644 --- a/mROA.Test/CborTest.cs +++ b/mROA.Test/CborTest.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Linq; using mROA.Cbor; namespace mROA.Test; @@ -43,9 +44,6 @@ public class CborTest public void ComplexFlat() { var value = _basicCollectionElement; - List first = [1, 2, 3]; - List second = [1, 2, 3]; - var eq = first.Equals(second); var data = _serializationToolKit.Serialize(value, null); var deserialize = _serializationToolKit.Deserialize(data, null); Assert.That(value, Is.EqualTo(deserialize)); @@ -54,6 +52,10 @@ public class CborTest [Test] public void ComplexFull() { + var value = _complexTestObject; + var data = _serializationToolKit.Serialize(value, null); + var deserialize = _serializationToolKit.Deserialize(data, null); + Assert.That(value, Is.EqualTo(deserialize)); } public void SharedObject() @@ -71,7 +73,7 @@ public class CborTest protected bool Equals(ComplexTestObject other) { - return IntValue == other.IntValue && DoubleValue.Equals(other.DoubleValue) && StringValue == other.StringValue && IntArray.Equals(other.IntArray) && CollectionElements.Equals(other.CollectionElements); + return IntValue == other.IntValue && DoubleValue.Equals(other.DoubleValue) && StringValue == other.StringValue && IntArray.SequenceEqual(other.IntArray) && CollectionElements.SequenceEqual(other.CollectionElements); } public override bool Equals(object? obj)