Exemplo n.º 1
0
 public void TestMoreComplexClass()
 {
     AnOptionClass a = new AnOptionClass() { AnInt = 5, AString = "Test" };
     AnotherOptionClass c = new AnotherOptionClass(15.5) { PublicInt = 15, PublicString = "15", MoreOptions = a };
     AnotherOptionClass b = c.Clone() as AnotherOptionClass;
     Assert.That(b, Is.TypeOf(c.GetType()));
     Assert.That(b.PublicInt, Is.EqualTo(c.PublicInt));
     Assert.That(b.PublicString, Is.EqualTo(c.PublicString));
     Assert.That(a.AnInt, Is.EqualTo(b.MoreOptions.AnInt));
     Assert.That(a.AString, Is.EqualTo(b.MoreOptions.AString));
     Assert.That(b.PrivateVal, Is.Not.EqualTo(c.PrivateVal));
 }
Exemplo n.º 2
0
 public void TestComplexClassAfterChange()
 {
     AnOptionClass a = new AnOptionClass() { AnInt = 5, AString = "Test" };
     AnotherOptionClass c = new AnotherOptionClass(15.5) { PublicInt = 15, PublicString = "15", MoreOptions = a };
     AnotherOptionClass b = c.Clone() as AnotherOptionClass;
     a.AnInt--;
     a.AString = "different now!";
     c.PublicInt--;
     c.PublicString = "public but different";
     Assert.That(b, Is.TypeOf(c.GetType()));
     Assert.That(b.PublicInt, Is.Not.EqualTo(c.PublicInt));
     Assert.That(b.PublicString, Is.Not.EqualTo(c.PublicString));
     Assert.That(a.AnInt, Is.Not.EqualTo(b.MoreOptions.AnInt));
     Assert.That(a.AString, Is.Not.EqualTo(b.MoreOptions.AString));
 }
Exemplo n.º 3
0
        public void TestMoreComplexClass()
        {
            AnOptionClass a = new AnOptionClass()
            {
                AnInt = 5, AString = "Test"
            };
            AnotherOptionClass c = new AnotherOptionClass(15.5)
            {
                PublicInt = 15, PublicString = "15", MoreOptions = a
            };
            AnotherOptionClass b = c.Clone() as AnotherOptionClass;

            Assert.That(b, Is.TypeOf(c.GetType()));
            Assert.That(b.PublicInt, Is.EqualTo(c.PublicInt));
            Assert.That(b.PublicString, Is.EqualTo(c.PublicString));
            Assert.That(a.AnInt, Is.EqualTo(b.MoreOptions.AnInt));
            Assert.That(a.AString, Is.EqualTo(b.MoreOptions.AString));
            Assert.That(b.PrivateVal, Is.Not.EqualTo(c.PrivateVal));
        }
Exemplo n.º 4
0
        public void TestComplexClassAfterChange()
        {
            AnOptionClass a = new AnOptionClass()
            {
                AnInt = 5, AString = "Test"
            };
            AnotherOptionClass c = new AnotherOptionClass(15.5)
            {
                PublicInt = 15, PublicString = "15", MoreOptions = a
            };
            AnotherOptionClass b = c.Clone() as AnotherOptionClass;

            a.AnInt--;
            a.AString = "different now!";
            c.PublicInt--;
            c.PublicString = "public but different";
            Assert.That(b, Is.TypeOf(c.GetType()));
            Assert.That(b.PublicInt, Is.Not.EqualTo(c.PublicInt));
            Assert.That(b.PublicString, Is.Not.EqualTo(c.PublicString));
            Assert.That(a.AnInt, Is.Not.EqualTo(b.MoreOptions.AnInt));
            Assert.That(a.AString, Is.Not.EqualTo(b.MoreOptions.AString));
        }