Example #1
0
        public async Task ReferenceTest3()
        {
            var keeper = new ValueKeeper();
            _helper = new RefHelper { Index = 1, Value = "test" };
            keeper.MyRef = _helper;

            Assert.AreEqual(keeper.MyRef.Index, _helper.Index);

            _helper.Index = 2;

            Assert.AreEqual(keeper.MyRef.Index, _helper.Index);

            var h2 = new RefHelper { Index = 6, Value = "test" };

            _helper = h2;

            Assert.AreNotEqual(keeper.MyRef.Index, _helper.Index);

            _helper = await GetHelperAsync();

            Assert.AreNotEqual(keeper.MyRef.Index, _helper.Index);
        }
Example #2
0
        public void ReferenceTest2()
        {
            var keeper = new ValueKeeper();
            var h1 = new RefHelper { Index = 1, Value = "test" };
            keeper.MyRef = h1;

            Assert.AreEqual(keeper.MyRef.Index, h1.Index);

            h1.Index = 2;

            Assert.AreEqual(keeper.MyRef.Index, h1.Index);

            var h2 = new RefHelper { Index = 6, Value = "test" };

            h1 = h2;

            Assert.AreNotEqual(keeper.MyRef.Index, h1.Index);

            h1 = GetHelper();

            Assert.AreNotEqual(keeper.MyRef.Index, h1.Index);
        }