Example #1
0
        public void TestMethodDefaultPropertyDelegated1()
        {
            DefaultImplementation implementation = new DefaultImplementation();
            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());
        }
Example #2
0
        public void TestMethodDefaultPropertyDelegated2()
        {
            DefaultImplementation implementation = new DefaultImplementation();
            BeethovenFactory      factory        = new BeethovenFactory();
            ITestProperties       test           = factory.Generate <ITestProperties>(
                new DefaultProperty()
                .DelegatedSetter(implementation, nameof(implementation.DelegatedSetter))
                .SetterGetter());

            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);
        }