Ejemplo n.º 1
0
        public void CanCopyIntegers()
        {
            var original = 123;
            var result   = CloneOperator.Clone(original);

            Assert.Equal(original, result);
        }
Ejemplo n.º 2
0
        public void ClassCloneTest()
        {
            var model = new TestModel
            {
                B      = "B",
                Model1 = new TestModel1("Model1"),
                Model2 = new TestModel2 {
                    A = "A", B = 1
                },
                Self = new TestModel {
                    B = "E"
                },
                SelfList = new List <TestModel> {
                    new TestModel {
                        B = "l"
                    }
                }
            };
            var testModel = CloneOperator.Clone(model);

            Assert.NotSame(model, testModel);
            Assert.Equal(model.B, testModel.B);
            Assert.NotNull(model.Model1);
            Assert.NotSame(model.Model2, testModel.Model2);
            Assert.Equal(model.Model2.A, testModel.Model2.A);
            Assert.Equal(model.Model2.B, testModel.Model2.B);
            Assert.NotSame(model.Self, testModel.Self);
            Assert.Equal(model.Self.B, testModel.Self.B);
            Assert.NotSame(model.SelfList, testModel.SelfList);
            Assert.Equal(model.SelfList[0].B, testModel.SelfList[0].B);
        }
Ejemplo n.º 3
0
        public void CanCopyStrings()
        {
            var original = "hello!";
            var result   = CloneOperator.Clone(original);

            Assert.Same(original, result);
        }
Ejemplo n.º 4
0
        public void ClassCollectionArray()
        {
            FieldCloneClassCollectionModel model = new FieldCloneClassCollectionModel
            {
                Nodes = new List <FieldCloneNormalModel>()
            };

            for (int i = 0; i < 10; i++)
            {
                model.Nodes.Add(new FieldCloneNormalModel()
                {
                    Age = i, Name = i.ToString()
                });
            }

            var newModel = CloneOperator.Clone(model);

            for (int i = 0; i < 10; i++)
            {
                Assert.Equal(model.Nodes[i].Name, newModel.Nodes[i].Name);
                Assert.Equal(model.Nodes[i].Age, newModel.Nodes[i].Age);
                Assert.NotEqual(i - 1, newModel.Nodes[i].Age);
            }
            model.Nodes.Clear();
            Assert.NotEqual(model.Nodes.Count, newModel.Nodes.Count);
        }
Ejemplo n.º 5
0
            public void ReadonlyNormal()
            {
                PropCloneNormalModel model = new PropCloneNormalModel
                {
                    Age   = 1000,
                    Name  = "ababab",
                    Timer = DateTime.Now,
                    money = 100000,

                    Title = false,
                    Id    = 100000
                };

                var newModel = CloneOperator.Clone(model);

                Assert.False(newModel.NoUseCtor);
                Assert.Equal(0, newModel.ReadOnly);
                Assert.Equal(model.ReadOnlyString, newModel.ReadOnlyString);
                Assert.Equal(model.ReadOnlyString1, newModel.ReadOnlyString1);
                Assert.Equal(model.Id, newModel.Id);
                Assert.Equal(model.Title, newModel.Title);
                Assert.Equal(model.money, newModel.money);
                Assert.Equal(model.Timer, newModel.Timer);
                Assert.Equal(model.Age, newModel.Age);
                Assert.Equal(model.Name, newModel.Name);
            }
Ejemplo n.º 6
0
        public void PropClassCollectionArray2()
        {
            CloneCollectionModel model = new CloneCollectionModel
            {
                LANodes = new List <PropCloneNormalModel[]>()
            };

            for (int i = 0; i < 5; i++)
            {
                model.LANodes.Add(new PropCloneNormalModel[10]);
                for (int j = 0; j < 10; j++)
                {
                    model.LANodes[i][j] = new PropCloneNormalModel()
                    {
                        Age = j, Name = j.ToString()
                    };
                }
            }


            var newModel = CloneOperator.Clone(model);

            for (int i = 0; i < 5; i++)
            {
                Assert.NotEqual(model.LANodes, newModel.LANodes);
                for (int j = 0; j < 10; j++)
                {
                    Assert.NotEqual(model.LANodes[i], newModel.LANodes[i]);
                    Assert.Equal(model.LANodes[i][j].Name, newModel.LANodes[i][j].Name);
                    Assert.Equal(model.LANodes[i][j].Age, newModel.LANodes[i][j].Age);
                }
            }
        }
Ejemplo n.º 7
0
        public void PropClassCollectionArray1()
        {
            CloneCollectionModel model = new CloneCollectionModel();
            var INodes = new List <List <PropCloneNormalModel> >();

            for (int i = 0; i < 5; i++)
            {
                INodes.Add(new List <PropCloneNormalModel>());
                for (int j = 0; j < 10; j++)
                {
                    INodes[i].Add(new PropCloneNormalModel()
                    {
                        Age = j, Name = j.ToString()
                    });
                }
            }
            model.LLNodes = INodes;
            var newModel = CloneOperator.Clone(model);

            Assert.NotEqual(model.LLNodes, newModel.LLNodes);
            var oldNodes = new List <List <PropCloneNormalModel> >(model.LLNodes);
            var newNodes = new List <List <PropCloneNormalModel> >(newModel.LLNodes);

            for (int i = 0; i < 5; i++)
            {
                for (int j = 0; j < 10; j++)
                {
                    Assert.NotEqual(oldNodes[i], newNodes[i]);
                    Assert.Equal(oldNodes[i][j].Name, newNodes[i][j].Name);
                    Assert.Equal(oldNodes[i][j].Age, newNodes[i][j].Age);
                }
            }
        }
Ejemplo n.º 8
0
        public void CloneLinkTest()
        {
            FieldLinkModel model = new FieldLinkModel();

            model.Nodes.AddFirst(new FieldLinkModel()
            {
                Name = "1",
                Age  = 1
            });
            model.Nodes.AddLast(new FieldLinkModel()
            {
                Name = "2",
                Age  = 2
            });


            var newModel = CloneOperator.Clone(model);

            newModel.Nodes = CloneOperator.Clone(model.Nodes);
            Assert.NotEqual(model.Nodes.First, newModel.Nodes.First);
            Assert.Equal(model.Nodes.First.Value.Name, newModel.Nodes.First.Value.Name);

            Assert.NotEqual(model.Nodes.First.Next, newModel.Nodes.First.Next);
            Assert.Equal(model.Nodes.First.Next.Value.Name, newModel.Nodes.First.Next.Value.Name);
        }
Ejemplo n.º 9
0
        public void CloneArraySelfTest()
        {
            FieldSelfLinkArrayModel model = new FieldSelfLinkArrayModel()
            {
                Name = "1",
                Age  = 1
            };


            model.Next = new FieldSelfLinkArrayModel[5];
            for (int i = 0; i < 5; i++)
            {
                model.Next[i] = new FieldSelfLinkArrayModel()
                {
                    Name = i.ToString(),
                    Age  = i
                };
            }


            var newModel = CloneOperator.Clone(model);

            Assert.NotEqual(model.Next, newModel.Next);
            for (int i = 0; i < 5; i++)
            {
                Assert.NotEqual(model.Next[i], newModel.Next[i]);
                Assert.Equal(model.Next[i].Name, newModel.Next[i].Name);
            }
        }
Ejemplo n.º 10
0
        public void ClassCloneTest()
        {
            List <string> lli = new List <string>();

            lli.Add("123");
            lli.Add("456");
            var tt1 = CloneOperator.Clone(lli.ToArray());

            Assert.NotSame(lli, tt1);
            for (int i = 0; i < lli.Count; i++)
            {
                Assert.Equal(tt1[i], tt1[i]);
            }

            List <TestList> kk = new List <TestList>();
            TestList        t1 = new TestList();

            t1.B = "13";
            TestList2 t2 = new TestList2();

            t2.A     = "234";
            t1.List2 = t2;
            kk.Add(t1);
            //var ttt1 = CloneOperator.Clone(kk);

            var testList2 = CloneOperator.Clone(t1); // 实体拷贝时出错

            var tt = CloneOperator.Clone(lli);
            //Console.WriteLine(tt == null);
        }
Ejemplo n.º 11
0
        public void DictionaryCloneTest()
        {
            var dict = new Dictionary <string, List <int> >()
            {
                { "1", new List <int> {
                      1
                  } }
            };
            var dictNew = CloneOperator.Clone(dict);

            Assert.NotNull(dictNew);
            Assert.NotSame(dict, dictNew);
            Assert.True(dict.Count == dictNew.Count);
            Assert.NotNull(dictNew["1"]);
            Assert.NotSame(dict["1"], dictNew["1"]);

            var dictModel = new Dictionary <TestModel, int> {
                { new TestModel(), 1 }
            };
            var dictModelNew = CloneOperator.Clone(dictModel);

            Assert.NotNull(dictModelNew);
            Assert.NotSame(dictModel, dictModelNew);
            Assert.True(dictModel.Count == dictModelNew.Count);
            Assert.NotNull(dictModelNew.Keys);
            Assert.NotSame(dictModel.Keys.FirstOrDefault(), dictModelNew.Keys.FirstOrDefault());
        }
Ejemplo n.º 12
0
        private async Task StartAsync(IConfiguration configuration)
        {
            var a = CloneOperator.Clone((ConfigurationRoot)configuration);

            Log.Logger.Information("DataSync starts job");

            await PreHandlerAsync(a);
        }
Ejemplo n.º 13
0
        public void CanCopyArrays()
        {
            var original = new object[] { 123, "hello!" };
            var result   = CloneOperator.Clone(original);

            Assert.Equal(original, result);
            Assert.NotSame(original, result);
        }
Ejemplo n.º 14
0
        static void Main(string[] args)
        {
            /*
             *   在此之前,你需要右键,选择工程文件,在你的.csproj里面
             *
             *   写上这样一句浪漫的话:
             *
             *      <PreserveCompilationContext>true</PreserveCompilationContext>
             */


            string text = @"namespace HelloWorld
{
    public class Test
    {
        public Test(){
            Name=""111"";
        }

        public string Name;
        public int Age{get;set;}
    }
}";
            //根据脚本创建动态类
            Type type = ClassBuilder.GetType(text);
            //创建动态类实例代理
            DynamicOperator instance = type;

            if (instance["Name"].StringValue == "111")
            {
                //调用动态委托赋值
                instance["Name"].StringValue = "222";
            }
            //调用动态类
            Console.WriteLine(instance["Name"].StringValue);

            TestB b = new TestB();

            b.Name = "abc";
            var result = CloneOperator.Clone(b);


            //创建动态类实例代理
            DynamicOperator <TestB> instance2 = new DynamicOperator <TestB>();

            if (instance2["Name"].StringValue == "111")
            {
                //调用动态委托赋值
                instance2["Name"].StringValue = "222";
            }
            //调用动态类
            Console.WriteLine(instance2["Name"].StringValue);


            Console.ReadKey();
        }
Ejemplo n.º 15
0
        public void RegressionTest_20()
        {
            var original = new Dictionary <int, Component>()
            {
                { 1, new Component() },
            };
            var result = CloneOperator.Clone(original);

            GC.GetTotalMemory(true); // force full GC
        }
Ejemplo n.º 16
0
        public void CloneDictionaryArrayTest()
        {
            CloneDictArrayModel model = new CloneDictArrayModel
            {
                Dicts = new Dictionary <string, FieldCloneNormalModel[]> [5]
            };

            for (int i = 0; i < 5; i++)
            {
                model.Dicts[i] = new Dictionary <string, FieldCloneNormalModel[]>();
                for (int j = 0; j < 5; j++)
                {
                    model.Dicts[i][j.ToString()] = new FieldCloneNormalModel[5];
                    for (int z = 0; z < 5; z++)
                    {
                        model.Dicts[i][j.ToString()][z] = new FieldCloneNormalModel
                        {
                            Age   = 1000,
                            Name  = "ababab1",
                            Timer = DateTime.Now,
                            money = 100000,
                            Flag  = CloneEnum.B,
                            Title = true,
                            Id    = 0
                        };
                    }
                }
            }

            var newModel = CloneOperator.Clone(model);

            for (int i = 0; i < 5; i++)
            {
                Assert.Equal(model.Dicts[i].Count, newModel.Dicts[i].Count);
                for (int j = 0; j < 5; j++)
                {
                    Assert.Equal(model.Dicts[i][j.ToString()].Length, newModel.Dicts[i][j.ToString()].Length);
                    for (int z = 0; z < 5; z++)
                    {
                        Assert.Equal(model.Dicts[i][j.ToString()][z].Name, newModel.Dicts[i][j.ToString()][z].Name);
                        Assert.Equal(model.Dicts[i][j.ToString()][z].Age, newModel.Dicts[i][j.ToString()][z].Age);
                        Assert.Equal(model.Dicts[i][j.ToString()][z].Flag, newModel.Dicts[i][j.ToString()][z].Flag);
                        Assert.Equal(model.Dicts[i][j.ToString()][z].Id, newModel.Dicts[i][j.ToString()][z].Id);
                        Assert.Equal(model.Dicts[i][j.ToString()][z].Timer, newModel.Dicts[i][j.ToString()][z].Timer);
                        Assert.Equal(model.Dicts[i][j.ToString()][z].Title, newModel.Dicts[i][j.ToString()][z].Title);
                    }
                    model.Dicts[i][j.ToString()] = new FieldCloneNormalModel[0];
                    Assert.NotEqual(model.Dicts[i][j.ToString()].Length, newModel.Dicts[i][j.ToString()].Length);
                }

                model.Dicts[i].Clear();
                Assert.NotSame(model.Dicts[i], newModel.Dicts[i]);
                Assert.NotEqual(model.Dicts[i].Count, newModel.Dicts[i].Count);
            }
        }
Ejemplo n.º 17
0
        public void CanCopyInterfaceField()
        {
            PocoWithInterface original = new PocoWithInterface();

            original.Collection.Add("A");

            var result = CloneOperator.Clone(original);

            Assert.NotSame(original, result);
            Assert.NotSame(original.Collection, result.Collection);
        }
Ejemplo n.º 18
0
        public void ListOfSimpleClassDifferentInstances_DeepCopy()
        {
            var clone = CloneOperator.Clone(this._listOfSimpleClassDifferentInstances);

            Assert.NotSame(clone, this._listOfSimpleClassDifferentInstances);
            var firstInstance = clone[0];

            for (int i = 1; i < clone.Count; i++)
            {
                Assert.NotSame(firstInstance, clone[i]);
            }
        }
Ejemplo n.º 19
0
        public void Clone1DimWithSimple()
        {
            string[] arrIns0  = null;
            var      arrIns1  = new sbyte[] { 1, 2, 3, sbyte.MinValue, sbyte.MaxValue };
            var      arrIns2  = new short[] { 4, 5, 6, short.MinValue, short.MaxValue };
            var      arrIns3  = new int[] { 7, -8, 9, -10, int.MinValue, int.MaxValue };
            var      arrIns4  = new long[] { 12345, 23456, long.MinValue, long.MaxValue };
            var      arrIns5  = new byte[] { 123, 234, 56, byte.MinValue, byte.MaxValue };
            var      arrIns6  = new ushort[] { 123, 567, ushort.MinValue, ushort.MaxValue };
            var      arrIns7  = new uint[] { 678, 349, uint.MinValue, uint.MaxValue };
            var      arrIns8  = new ulong[] { 789, 2345, ulong.MinValue, ulong.MaxValue };
            var      arrIns9  = new float[] { 678.234F, 789, 234.000F, float.MinValue, float.MaxValue };
            var      arrIns10 = new double[] { 567, 678.56789, double.MinValue, double.MaxValue };
            var      arrIns11 = new decimal[] { 45678, 678.00M, 56789.234M, decimal.MinValue, decimal.MaxValue };
            var      arrIns12 = new GenderEnum[] { GenderEnum.Female, GenderEnum.Secrecy };
            var      arrIns13 = new bool[] { true, false, true };
            var      arrIns14 = new char[] { '1', '2', 'a', 'Z' };
            var      arrIns15 = new string[] { "Vito", "AzulX", "guodf", "wxn401", "myFirstway" };

            var arrIns0_Clone  = CloneOperator.Clone(arrIns0);
            var arrIns1_Clone  = CloneOperator.Clone(arrIns1);
            var arrIns2_Clone  = CloneOperator.Clone(arrIns2);
            var arrIns3_Clone  = CloneOperator.Clone(arrIns3);
            var arrIns4_Clone  = CloneOperator.Clone(arrIns4);
            var arrIns5_Clone  = CloneOperator.Clone(arrIns5);
            var arrIns6_Clone  = CloneOperator.Clone(arrIns6);
            var arrIns7_Clone  = CloneOperator.Clone(arrIns7);
            var arrIns8_Clone  = CloneOperator.Clone(arrIns8);
            var arrIns9_Clone  = CloneOperator.Clone(arrIns9);
            var arrIns10_Clone = CloneOperator.Clone(arrIns10);
            var arrIns11_Clone = CloneOperator.Clone(arrIns11);
            var arrIns12_Clone = CloneOperator.Clone(arrIns12);
            var arrIns13_Clone = CloneOperator.Clone(arrIns13);
            var arrIns14_Clone = CloneOperator.Clone(arrIns14);
            var arrIns15_Clone = CloneOperator.Clone(arrIns15);

            Assert.Equal(arrIns0_Clone, arrIns0);
            Assert.Equal(arrIns1_Clone, arrIns1);
            Assert.Equal(arrIns2_Clone, arrIns2);
            Assert.Equal(arrIns3_Clone, arrIns3);
            Assert.Equal(arrIns4_Clone, arrIns4);
            Assert.Equal(arrIns5_Clone, arrIns5);
            Assert.Equal(arrIns6_Clone, arrIns6);
            Assert.Equal(arrIns7_Clone, arrIns7);
            Assert.Equal(arrIns8_Clone, arrIns8);
            Assert.Equal(arrIns9_Clone, arrIns9);
            Assert.Equal(arrIns10_Clone, arrIns10);
            Assert.Equal(arrIns11_Clone, arrIns11);
            Assert.Equal(arrIns12_Clone, arrIns12);
            Assert.Equal(arrIns13_Clone, arrIns13);
            Assert.Equal(arrIns14_Clone, arrIns14);
            Assert.Equal(arrIns15_Clone, arrIns15);
        }
Ejemplo n.º 20
0
        public void ListOfSimpleClassSameInstance_DeepCopy()
        {
            var clone = CloneOperator.Clone(this._listOfSimpleClassSameInstance);

            Assert.NotSame(clone, this._listOfSimpleClassSameInstance);
            var firstInstance = clone[0];

            for (int i = 1; i < clone.Count; i++)
            {
                Assert.NotSame(firstInstance, clone[i]);
                Assert.Equal(firstInstance.String, clone[i].String);
            }
        }
Ejemplo n.º 21
0
        public void SubClassArray()
        {
            FieldCloneSubNodeModel model = new FieldCloneSubNodeModel();

            model.Node = new FieldCloneNormalModel()
            {
                Age = 1, Name = "111"
            };

            var newModel = CloneOperator.Clone(model);

            Assert.Equal(model.Node.Name, newModel.Node.Name);
            Assert.Equal(model.Node.Age, newModel.Node.Age);
        }
Ejemplo n.º 22
0
        public void ClassInnerTest()
        {
            TestModel.InnerClass model = new TestModel.InnerClass();
            model.Name     = "abc";
            model.SelfList = new List <TestModel> {
                new TestModel {
                    B = "l"
                }
            };
            var testModel = CloneOperator.Clone(model);

            Assert.NotSame(model, testModel);
            Assert.NotSame(model.SelfList, testModel.SelfList);
            Assert.Equal(model.SelfList[0].B, testModel.SelfList[0].B);
        }
Ejemplo n.º 23
0
        public void CloneDictionaryTest()
        {
            CloneDictModel model = new CloneDictModel();

            model.Dicts      = new Dictionary <string, string>();
            model.Dicts["1"] = "2";
            model.Dicts["2"] = "3";
            var newModel = CloneOperator.Clone(model);

            foreach (var item in newModel.Dicts)
            {
                Assert.Equal(model.Dicts[item.Key], item.Value);
            }
            model.Dicts["1"] = "4";
            Assert.NotEqual(model.Dicts, newModel.Dicts);
        }
Ejemplo n.º 24
0
        public void Clone1DimWithComplex()
        {
            var random = new Random();

            Member[] arrIns0 = null;
            // var arrIns1 = new object[] { new Member(), new Member(), new Member() };
            var arrIns2 = Mocker.MockArrayMember(notNull: true);
            var arrIns3 = new Dictionary <int, int>[] {
                Mocker.MockDict(),
                Mocker.MockDict()
            };
            var arrIns4 = new List <int>[] {
                Mocker.MockList(),
                Mocker.MockList()
            };
            // var arrIns5 = new dynamic[] { };

            var arrIns0_Clone = CloneOperator.Clone(arrIns0);
            // var arrIns1_Clone = CloneOperator.Clone(arrIns1);
            var arrIns2_Clone = CloneOperator.Clone(arrIns2);
            var arrIns3_Clone = CloneOperator.Clone(arrIns3);
            var arrIns4_Clone = CloneOperator.Clone(arrIns4);

            // var arrIns5_Clone = CloneOperator.Clone(arrIns5);

            Assert.Null(arrIns0_Clone);
            Assert.Equal(arrIns0_Clone, arrIns0);

            // Assert.Equal(arrIns1_Clone, arrIns1);

            Assert.NotNull(arrIns2_Clone);
            Assert.NotSame(arrIns2_Clone, arrIns2);
            Assert.True(arrIns2_Clone.Length == arrIns2.Length);
            Assert.Equal(arrIns2_Clone, arrIns2, new MemberArrayEqualityComparer());

            Assert.NotNull(arrIns3_Clone);
            Assert.NotSame(arrIns3_Clone, arrIns3);
            Assert.True(arrIns3_Clone.Length == arrIns3.Length);
            Assert.Equal(arrIns3_Clone, arrIns3, new DictArrayEqualityComparer());

            Assert.NotNull(arrIns4_Clone);
            Assert.NotSame(arrIns4_Clone, arrIns4);
            Assert.True(arrIns4_Clone.Length == arrIns4.Length);
            Assert.Equal(arrIns4_Clone, arrIns4, new ListArrayEqualityComparer());

            // Assert.Equal(arrIns5_Clone, arrIns5);
        }
Ejemplo n.º 25
0
        public void FluentSheetMetadataCloneTest()
        {
            var metadata = new FluentSheetMetadata()
            {
                Name           = "test",
                FieldMetadatas = new Dictionary <string, FluentFieldMetadata>()
                {
                    ["ApplicationName"] = new FluentFieldMetadata()
                    {
                        Name = "ApplicationName", Header = new[] { "申请单位名称" }, Required = true
                    },
                }
            };
            var cloneMetadata = CloneOperator.Clone(metadata);

            Assert.NotSame(metadata, cloneMetadata);
        }
Ejemplo n.º 26
0
        public void PropSubClassArray()
        {
            PropCloneSubNodeModel model = new PropCloneSubNodeModel
            {
                Node = new PropCloneNormalModel()
                {
                    Age = 1, Name = "111"
                }
            };


            var newModel = CloneOperator.Clone(model);


            Assert.Equal(model.Node.Name, newModel.Node.Name);
            Assert.Equal(model.Node.Age, newModel.Node.Age);
        }
Ejemplo n.º 27
0
        public void NotClassArray()
        {
            FieldCloneArrayModel model = new FieldCloneArrayModel();

            model.Name = new string[10];
            for (int i = 0; i < 10; i++)
            {
                model.Name[i] = i.ToString();
            }

            var newModel = CloneOperator.Clone(model);


            for (int i = 0; i < 10; i++)
            {
                Assert.Equal(model.Name[i], newModel.Name[i]);
            }
        }
Ejemplo n.º 28
0
        public void ClassCloneTest()
        {
            var model = new TestModel
            {
                B      = "B",
                Model1 = new TestModel1("Model1"),
                Model2 = new TestModel2 {
                    A = "A", B = 1
                }
            };
            var testModel = CloneOperator.Clone(model);

            Assert.NotSame(model, testModel);
            Assert.Equal(model.B, testModel.B);
            Assert.Null(model.Model1);
            Assert.NotSame(model.Model2, testModel.Model2);
            Assert.Equal(model.Model2.A, testModel.Model2.A);
            Assert.Equal(model.Model2.B, testModel.Model2.B);
        }
Ejemplo n.º 29
0
        public void PropNotClassArray()
        {
            PropCloneArrayModel model = new PropCloneArrayModel
            {
                Name = new string[10]
            };

            for (int i = 0; i < 10; i++)
            {
                model.Name[i] = i.ToString();
            }

            var newModel = CloneOperator.Clone(model);


            for (int i = 0; i < 10; i++)
            {
                Assert.Equal(model.Name[i], newModel.Name[i]);
            }
        }
Ejemplo n.º 30
0
        public void CloneSelfTest()
        {
            FieldSelfLinkModel model = new FieldSelfLinkModel()
            {
                Name = "1",
                Age  = 1
            };

            model.Next = new FieldSelfLinkModel()
            {
                Name = "2",
                Age  = 2
            };


            var newModel = CloneOperator.Clone(model);

            Assert.NotEqual(model.Next, newModel.Next);
            Assert.Equal(model.Next.Name, newModel.Next.Name);
        }