Esempio n. 1
0
        public void CloneTest()
        {
            var state1 = new SampleState();

            state1.Entities.Add(new SampleEntity()
            {
                Value = 1
            });
            var state2 = (SampleState)state1.Clone();

            Assert.AreEqual(state1, state2);

            state2.Entities[0].Value = 2;
            Assert.AreNotEqual(state1, state2);
        }
Esempio n. 2
0
        public void CloneTest()
        {
            var sample1 = new SampleState();

            sample1.List = new List <string>()
            {
                "a", "b", "c"
            };

            var sample2 = sample1.Clone <SampleState>();

            sample2.List[1] = "bb";
            Assert.AreEqual(new List <string>()
            {
                "a", "b", "c"
            }, sample1.List);
            Assert.AreEqual(new List <string>()
            {
                "a", "bb", "c"
            }, sample2.List);
        }