Ejemplo n.º 1
0
        public void TestMethodDefaultPropertyDelegated3()
        {
            DefaultImplementation2 implementation = new DefaultImplementation2();
            BeethovenFactory       factory        = new BeethovenFactory();
            ITestProperties        test           = factory.Generate <ITestProperties>(
                new DefaultProperty()
                .DelegatedSetter(implementation, nameof(implementation.DelegatedSetter)));

            Assert.AreEqual(0, test.Property1);
            test.Property2 = "Nothing";
            test.Property2 = "Some value";
            test.Property1 = 55;
            CollectionAssert.AreEquivalent(new object[] { 55, "Some value" }, implementation.GetObjects());
        }
Ejemplo n.º 2
0
        public void TestMethodDefaultPropertyDelegated4()
        {
            DefaultImplementation2 implementation = new DefaultImplementation2();
            BeethovenFactory       factory        = new BeethovenFactory();
            ITestProperties        test           = factory.Generate <ITestProperties>(
                new DefaultProperty()
                .DelegatedSetter(implementation, nameof(implementation.DelegatedSetter))
                .DelegatedGetter(implementation, nameof(implementation.DelegatedGetter)));

            Assert.AreEqual(0, test.Property1);
            test.Property2 = "Nothing";
            test.Property2 = "Some value";
            Assert.AreEqual("Some value", test.Property2);
            test.Property1 = 55;
            Assert.AreEqual(55, test.Property1);
        }