예제 #1
0
        public void TestCast()
        {
            SimpleAdaptable adaptable = null;

            // test null check
            Assert.Throws <AdaptationException>(delegate() { adaptable.Cast(typeof(object)); });
            Assert.Throws <AdaptationException>(delegate() { adaptable.Cast(typeof(object)); });

            // test successful adaptation
            adaptable = new SimpleAdaptable();
            Assert.NotNull(adaptable.Cast(typeof(IAdaptable)));
            Assert.False(adaptable.AsCalled);
            adaptable = new SimpleAdaptable();
            Assert.NotNull(adaptable.Cast(typeof(IAdaptable)));
            Assert.False(adaptable.AsCalled);
        }
예제 #2
0
        public void TestCastGeneric()
        {
            SimpleAdaptable adaptable = null;

            // test null check
            Assert.Throws <AdaptationException>(delegate() { Adapters.Cast <object>(adaptable); });
            Assert.Throws <AdaptationException>(delegate() { adaptable.Cast <object>(); });

            // test successful adaptation
            adaptable = new SimpleAdaptable();
            Assert.NotNull(Adapters.Cast <IAdaptable>(adaptable));
            Assert.False(adaptable.AsCalled);
            adaptable = new SimpleAdaptable();
            Assert.NotNull(adaptable.Cast <IAdaptable>());
            Assert.False(adaptable.AsCalled);
        }
예제 #3
0
파일: TestAdapters.cs 프로젝트: Joxx0r/ATF
        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);
        }
예제 #4
0
        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);
        }