From 9c493fd8fedffe33c3e22c8fa1649bbddfacb55c Mon Sep 17 00:00:00 2001 From: Mikhail Mitrofanov Date: Tue, 25 Feb 2025 08:52:18 +0300 Subject: [PATCH] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B5=201.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mROA.Cbor/CborSerializaitonToolkit.cs | 2 +- mROA.Test/CborTest.cs | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) 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)