public void TestIsGeneric()
        {
            SimpleAdaptable adaptable = null;

            // test null check
            Assert.False(adaptable.Is <object>());
            Assert.False(adaptable.Is <object>());

            // test successful adaptation
            adaptable = new SimpleAdaptable();
            Assert.True(adaptable.Is <IAdaptable>());
            adaptable = new SimpleAdaptable();
            Assert.NotNull(adaptable.Is <IAdaptable>());

            // test failed adaptation
            adaptable = new SimpleAdaptable();
            Assert.False(adaptable.Is <TestAdapters>());
            adaptable = new SimpleAdaptable();
            Assert.False(adaptable.Is <TestAdapters>());
        }
        public void TestIs()
        {
            SimpleAdaptable adaptable = null;

            // test null check
            Assert.False(adaptable.Is(typeof(object)));
            Assert.False(adaptable.Is(typeof(object)));

            // test successful adaptation
            adaptable = new SimpleAdaptable();
            Assert.True(adaptable.Is(typeof(IAdaptable)));
            adaptable = new SimpleAdaptable();
            Assert.NotNull(adaptable.Is(typeof(IAdaptable)));

            // test failed adaptation
            adaptable = new SimpleAdaptable();
            Assert.False(adaptable.Is(typeof(TestAdapters)));
            adaptable = new SimpleAdaptable();
            Assert.False(adaptable.Is(typeof(TestAdapters)));
        }
示例#3
0
        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>());
        }
示例#4
0
        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)));
        }