Exemplo 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);
        }
        public void Equals()
        {
            var sample1 = new SampleState();
            var sample2 = new SampleState();

            Assert.AreEqual(sample1, sample2);

            sample1.List = new List <string>()
            {
                "a", "b", "c"
            };
            Assert.AreNotEqual(sample1, sample2);
            sample2.List = new List <string>()
            {
                "a", "b", "c"
            };
            Assert.AreEqual(sample1, sample2);
        }
Exemplo n.º 3
0
        public void EqualsTest()
        {
            var state1 = new SampleState();
            var state2 = new SampleState();

            Assert.AreEqual(state1, state2);

            state1.Entities.Add(new SampleEntity()
            {
                Value = 1
            });
            state2.Entities.Add(new SampleEntity()
            {
                Value = 2
            });

            Assert.AreNotEqual(state1, state2);

            state2.Entities[0].Value = 1;
        }
Exemplo n.º 4
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);
        }