Ejemplo n.º 1
0
        public void InitializeEmptyTest()
        {
            var obj = new StoredObj();

            Assert.That(obj.Main, Is.Null);
            obj.DeserializeMain();             // implicitly new()
            Assert.That(obj.Main, Is.Not.Null);
            Assert.That(obj.Exposed, Is.Null); // not yet copied
            obj.LoadMembers();
            Assert.That(obj.Exposed, Is.EqualTo(TESTVALUE));
        }
Ejemplo n.º 2
0
        public void SerializeDeserializeTest()
        {
            var obj = new StoredObj();

            Assert.That(obj.Main, Is.Null);
            obj.Main = new TestObj(); // instantiate Main explicitly
            obj.SerializeMain();
            obj.Main = null;          // delete Main
            obj.DeserializeMain();    // reconstruct Main from ViewState
            Assert.That(obj.Main, Is.Not.Null);
            obj.LoadMembers();        // expose the reconstructed members
            Assert.That(obj.Exposed, Is.EqualTo(TESTVALUE));
        }