public void TestAs_CastAndGetAdapterFail() { SimpleAdaptable adaptable = new SimpleAdaptable(); Assert.Null(Adapters.As(adaptable, typeof(TestAdapters))); Assert.True(adaptable.AsCalled); }
public void TestAs_GetAdapterIfCastFails() { SimpleAdaptable adaptable = new SimpleAdaptable(); Assert.NotNull(Adapters.As(adaptable, typeof(string))); Assert.True(adaptable.AsCalled); }
public void TestAsGeneric_CastFirst() { SimpleAdaptable adaptable = new SimpleAdaptable(); Assert.AreSame(Adapters.As <IAdaptable>(adaptable), adaptable); Assert.False(adaptable.AsCalled); }
public void TestAsGeneric_GetAdapterIfCastFails() { SimpleAdaptable adaptable = new SimpleAdaptable(); Assert.NotNull(Adapters.As <string>(adaptable)); Assert.True(adaptable.AsCalled); }
public void TestAsGeneric_CastAndGetAdapterFail() { SimpleAdaptable adaptable = new SimpleAdaptable(); Assert.Null(Adapters.As <TestAdapters>(adaptable)); Assert.True(adaptable.AsCalled); }
public void TestAs_CastFirst() { SimpleAdaptable adaptable = new SimpleAdaptable(); Assert.AreSame(Adapters.As(adaptable, typeof(IAdaptable)), adaptable); Assert.False(adaptable.AsCalled); }
public void TestCast() { SimpleAdaptable adaptable = null; // test null check Assert.Throws <AdaptationException>(delegate() { Adapters.Cast(adaptable, typeof(object)); }); Assert.Throws <AdaptationException>(delegate() { adaptable.Cast(typeof(object)); }); // test successful adaptation adaptable = new SimpleAdaptable(); Assert.NotNull(Adapters.Cast(adaptable, typeof(IAdaptable))); Assert.False(adaptable.AsCalled); adaptable = new SimpleAdaptable(); Assert.NotNull(adaptable.Cast(typeof(IAdaptable))); Assert.False(adaptable.AsCalled); }
public void TestCastGeneric() { SimpleAdaptable adaptable = null; // test null check Assert.Throws <AdaptationException>(delegate() { adaptable.Cast <object>(); }); Assert.Throws <AdaptationException>(delegate() { adaptable.Cast <object>(); }); // test successful adaptation adaptable = new SimpleAdaptable(); Assert.NotNull(adaptable.Cast <IAdaptable>()); Assert.False(adaptable.AsCalled); adaptable = new SimpleAdaptable(); Assert.NotNull(adaptable.Cast <IAdaptable>()); Assert.False(adaptable.AsCalled); }
public void TestIsGeneric() { SimpleAdaptable adaptable = null; // test null check Assert.False(Adapters.Is <object>(adaptable)); Assert.False(adaptable.Is <object>()); // test successful adaptation adaptable = new SimpleAdaptable(); Assert.True(Adapters.Is <IAdaptable>(adaptable)); adaptable = new SimpleAdaptable(); Assert.NotNull(adaptable.Is <IAdaptable>()); // test failed adaptation adaptable = new SimpleAdaptable(); Assert.False(Adapters.Is <TestAdapters>(adaptable)); adaptable = new SimpleAdaptable(); Assert.False(adaptable.Is <TestAdapters>()); }
public void TestIs() { SimpleAdaptable adaptable = null; // test null check Assert.False(Adapters.Is(adaptable, typeof(object))); Assert.False(adaptable.Is(typeof(object))); // test successful adaptation adaptable = new SimpleAdaptable(); Assert.True(Adapters.Is(adaptable, typeof(IAdaptable))); adaptable = new SimpleAdaptable(); Assert.NotNull(adaptable.Is(typeof(IAdaptable))); // test failed adaptation adaptable = new SimpleAdaptable(); Assert.False(Adapters.Is(adaptable, typeof(TestAdapters))); adaptable = new SimpleAdaptable(); Assert.False(adaptable.Is(typeof(TestAdapters))); }
public void TestCast() { SimpleAdaptable adaptable = null; // test null check Assert.Throws<AdaptationException>(delegate() { Adapters.Cast(adaptable, typeof(object)); }); Assert.Throws<AdaptationException>(delegate() { adaptable.Cast(typeof(object)); }); // test successful adaptation adaptable = new SimpleAdaptable(); Assert.NotNull(Adapters.Cast(adaptable, typeof(IAdaptable))); Assert.False(adaptable.AsCalled); adaptable = new SimpleAdaptable(); Assert.NotNull(adaptable.Cast(typeof(IAdaptable))); Assert.False(adaptable.AsCalled); }
public void TestIsGeneric() { SimpleAdaptable adaptable = null; // test null check Assert.False(Adapters.Is<object>(adaptable)); Assert.False(adaptable.Is<object>()); // test successful adaptation adaptable = new SimpleAdaptable(); Assert.True(Adapters.Is<IAdaptable>(adaptable)); adaptable = new SimpleAdaptable(); Assert.NotNull(adaptable.Is<IAdaptable>()); // test failed adaptation adaptable = new SimpleAdaptable(); Assert.False(Adapters.Is<TestAdapters>(adaptable)); adaptable = new SimpleAdaptable(); Assert.False(adaptable.Is<TestAdapters>()); }
public void TestAsGeneric_CastFirst() { SimpleAdaptable adaptable = new SimpleAdaptable(); Assert.AreSame(Adapters.As<IAdaptable>(adaptable), adaptable); Assert.False(adaptable.AsCalled); }
public void TestCastGeneric() { SimpleAdaptable adaptable = null; // test null check Assert.Throws<AdaptationException>(delegate() { adaptable.Cast<object>(); }); Assert.Throws<AdaptationException>(delegate() { adaptable.Cast<object>(); }); // test successful adaptation adaptable = new SimpleAdaptable(); Assert.NotNull(adaptable.Cast<IAdaptable>()); Assert.False(adaptable.AsCalled); adaptable = new SimpleAdaptable(); Assert.NotNull(adaptable.Cast<IAdaptable>()); Assert.False(adaptable.AsCalled); }
public void TestAsGeneric_CastAndGetAdapterFail() { SimpleAdaptable adaptable = new SimpleAdaptable(); Assert.Null(Adapters.As<TestAdapters>(adaptable)); Assert.True(adaptable.AsCalled); }
public void TestAsGeneric_GetAdapterIfCastFails() { SimpleAdaptable adaptable = new SimpleAdaptable(); Assert.NotNull(Adapters.As<string>(adaptable)); Assert.True(adaptable.AsCalled); }