Exemplo n.º 1
0
        public void AutoEventBackingFieldsAreClonedWhenValueTypeIsCopied()
        {
            int    count = 0;
            Action a     = () => count++;
            var    s1    = new MS1();

            s1.E += a;
            var s2 = s1;

            s2.E += a;

            s1.RaiseE();
            Assert.AreEqual(count, 1);

            s2.RaiseE();
            Assert.AreEqual(count, 3);
        }
Exemplo n.º 2
0
        public void AutoEventBackingFieldsAreClonedWhenValueTypeIsCopied_SPI_1612()
        {
            int    count = 0;
            Action a     = () => count++;
            var    s1    = new MS1();

            s1.E += a;
            var s2 = s1;

            s2.E += a;

            s1.RaiseE();
            Assert.AreEqual(1, count);

            s2.RaiseE();
            // #1612
            Assert.AreEqual(3, count);
        }