Пример #1
0
        public void FindClass_InstanceLocal_TypeInstance()
        {
            var testClass1 = new MockType1();
            var testClass2 = new MockType2();

            testClass1.AssertFoo();
        }
Пример #2
0
        public void FindClass_InstanceClosure_TypeInstance()
        {
            var testClass1 = new MockType1();
            var testClass2 = new MockType2();
            var testClass3 = new MockType2();

            var expression1 = (Expression <Func <object> >)(() => testClass1.Foo);
            var expression2 = (Expression <Func <object> >)(() => testClass2.Foo);

            var(type, instance) = ClassFinder.FindClass(expression2);

            Assert.AreEqual(typeof(MockType2), type);
            Assert.AreSame(testClass2, instance);
        }