| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Fire.UnitTest {
- public struct TestObj {
- public int id;
- public string Name;
- }
- public class SerializeDeepTestObject {
- public string TestString;
- public SerializeTestObject Obj1;
- public SerializeTestObject Obj2;
- public TestObj User;
- public int[] IntArray;
- public string[] StringArray;
- public void Fill() {
- this.TestString = "DeepTestString";
- this.Obj1 = new SerializeTestObject();
- this.Obj1.Fill();
- this.Obj2 = new SerializeTestObject();
- this.Obj2.Fill();
- this.User = new TestObj();
- this.User.id = 100;
- this.User.Name = "Misikuri";
- this.IntArray = new int[3];
- this.IntArray[0] = 10;
- this.IntArray[1] = 20;
- this.IntArray[2] = 30;
- this.StringArray = new string[3];
- this.StringArray[0] = "Hallo";
- this.StringArray[1] = "Welt";
- this.StringArray[2] = "!";
- }
- public bool Compare(SerializeDeepTestObject obj) {
- if (obj == null)
- return false;
- return (
- this.TestString == obj.TestString &&
- ((this.Obj1 == null && obj.Obj1 == null) || (this.Obj1 != null && this.Obj1.Compare(obj.Obj1))) &&
- ((this.Obj2 == null && obj.Obj2 == null) || (this.Obj2 != null && this.Obj2.Compare(obj.Obj2))) &&
- this.User.id == obj.User.id && this.User.Name == obj.User.Name &&
- (this.IntArray.Length == obj.IntArray.Length && this.IntArray[0] == obj.IntArray[0] && this.IntArray[1] == obj.IntArray[1] && this.IntArray[2] == obj.IntArray[2]) &&
- (this.StringArray.Length == obj.StringArray.Length && this.StringArray[0] == obj.StringArray[0] && this.StringArray[1] == obj.StringArray[1] && this.StringArray[2] == obj.StringArray[2]) &&
- true
- );
- }
- }
- }
|