Исправление 1.
This commit is contained in:
@@ -194,7 +194,7 @@ namespace mROA.Cbor
|
|||||||
if (type.IsSubclassOf(typeof(ISharedObject)))
|
if (type.IsSubclassOf(typeof(ISharedObject)))
|
||||||
return ReadSharedObject(reader, type, context);
|
return ReadSharedObject(reader, type, context);
|
||||||
|
|
||||||
if (type.IsSubclassOf(typeof(IList)))
|
if (type.IsSubclassOf(typeof(IList)) || type.IsArray)
|
||||||
return ReadList(reader, type, context);
|
return ReadList(reader, type, context);
|
||||||
|
|
||||||
return ReadObject(reader, type, context);
|
return ReadObject(reader, type, context);
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using mROA.Cbor;
|
using mROA.Cbor;
|
||||||
|
|
||||||
namespace mROA.Test;
|
namespace mROA.Test;
|
||||||
@@ -43,9 +44,6 @@ public class CborTest
|
|||||||
public void ComplexFlat()
|
public void ComplexFlat()
|
||||||
{
|
{
|
||||||
var value = _basicCollectionElement;
|
var value = _basicCollectionElement;
|
||||||
List<int> first = [1, 2, 3];
|
|
||||||
List<int> second = [1, 2, 3];
|
|
||||||
var eq = first.Equals(second);
|
|
||||||
var data = _serializationToolKit.Serialize(value, null);
|
var data = _serializationToolKit.Serialize(value, null);
|
||||||
var deserialize = _serializationToolKit.Deserialize<BasicCollectionElement>(data, null);
|
var deserialize = _serializationToolKit.Deserialize<BasicCollectionElement>(data, null);
|
||||||
Assert.That(value, Is.EqualTo(deserialize));
|
Assert.That(value, Is.EqualTo(deserialize));
|
||||||
@@ -54,6 +52,10 @@ public class CborTest
|
|||||||
[Test]
|
[Test]
|
||||||
public void ComplexFull()
|
public void ComplexFull()
|
||||||
{
|
{
|
||||||
|
var value = _complexTestObject;
|
||||||
|
var data = _serializationToolKit.Serialize(value, null);
|
||||||
|
var deserialize = _serializationToolKit.Deserialize<ComplexTestObject>(data, null);
|
||||||
|
Assert.That(value, Is.EqualTo(deserialize));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SharedObject()
|
public void SharedObject()
|
||||||
@@ -71,7 +73,7 @@ public class CborTest
|
|||||||
|
|
||||||
protected bool Equals(ComplexTestObject other)
|
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)
|
public override bool Equals(object? obj)
|
||||||
|
|||||||
Reference in New Issue
Block a user