public void NonGenericInterface_OneInterfaceClass2() { dynamic d = new OneExplicitlyImplementedNonGenericInterface3(); Assert.Equal(2, d.Foo()); Assert.Throws<InvalidCastException>(() => Helpers.Cast<NonGenericInterface3>(d)); Assert.Throws<InvalidCastException>(() => ((NonGenericInterface3)d).Foo()); }
public void NonGenericInterface_OneInterfaceClass2() { dynamic d = new OneExplicitlyImplementedNonGenericInterface3(); Assert.Equal(2, d.Foo()); Assert.Throws <InvalidCastException>(() => Helpers.Cast <NonGenericInterface3>(d)); Assert.Throws <InvalidCastException>(() => ((NonGenericInterface3)d).Foo()); }