static void Main(string[] args) { ImplementationClass implementationClass = new ImplementationClass(); implementationClass.Add(20, 40); implementationClass.Sub(60, 40); implementationClass.Mul(80, 50); implementationClass.Div(100, 3); ITestInterface1 iReference1 = implementationClass; iReference1.Add(22, 66); ITestInterface3 iReference3 = new ImplementationClass(); iReference3.Add(88, 88); Rectangle rectangle = new Rectangle(22.33, 12.22); Circle circle = new Circle(12.33); Cone cone = new Cone(33.2, 44.3); Triangle triangle = new Triangle(66.2, 12.3); Console.WriteLine("The area of Rectangle is :: {0}", rectangle.GetArea()); Console.WriteLine("The area of Circle is :: {0}", circle.GetArea()); Console.WriteLine("The area of Cone is :: {0}", cone.GetArea()); Console.WriteLine("The area of Triangle is :: {0}", triangle.GetArea()); Console.Read(); }
public void MissingFunctionAllow() { TestClass1 orig = new TestClass1(); ITestInterface1 asInterface = ReflectedCaster.Default.CastToInterface <ITestInterface1>(orig, CastUsageOptions.AllowMissingFunctions); Assert.Throws <ReflectedCastNotImplementedInSourceException>(() => asInterface.Method()); }
public void Test() { TestClass tc = /*[a]*/ TypeAccessor /*[/a]*/ <TestClass> .CreateInstance(); ITestInterface1 i1 = (ITestInterface1)tc; ITestInterface2 i2 = (ITestInterface2)tc; Assert.AreEqual(/*[a]*/ 10 /*[/a]*/, i1.TestMethod(/*[a]*/ 10 /*[/a]*/)); Assert.AreEqual(/*[a]*/ 15 /*[/a]*/, i2.TestMethod1(/*[a]*/ 20 /*[/a]*/)); Assert.AreEqual(/*[a]*/ 30 /*[/a]*/, i2.TestMethod2(/*[a]*/ 30 /*[/a]*/)); }
/// <summary> /// TestMethodWithOneParam2 /// </summary> /// <param name="param1">ITestInterface1</param> /// <returns>ITestInterface3</returns> public ITestInterface3 TestMethodWithOneParam2(ITestInterface1 param1) { throw new NotImplementedException(); }
public TestClass2(ITestInterface1 dependency) { m_dependency = dependency; }
public string TestMethodWithOneParam1(ITestInterface1 param1) { throw new System.NotImplementedException(); }
public TestClass3(ITestInterface1 testInterface1) { TestInterface1 = testInterface1; Name = "created via injection"; }