Ejemplo n.º 1
0
        public void IsControllerType()
        {
            // Act
            bool isController1 = ControllerTypeCache.IsControllerType(null);
            bool isController2 = ControllerTypeCache.IsControllerType(typeof(NonPublicController));
            bool isController3 = ControllerTypeCache.IsControllerType(typeof(MisspelledKontroller));
            bool isController4 = ControllerTypeCache.IsControllerType(typeof(AbstractController));
            bool isController5 = ControllerTypeCache.IsControllerType(typeof(NonIControllerController));
            bool isController6 = ControllerTypeCache.IsControllerType(typeof(Goodcontroller));

            // Assert
            Assert.False(isController1);
            Assert.False(isController2);
            Assert.False(isController3);
            Assert.False(isController4);
            Assert.False(isController5);
            Assert.True(isController6);
        }
Ejemplo n.º 2
0
        public void IsControllerType()
        {
            // Act
            bool isController1 = ControllerTypeCache.IsControllerType(null);
            bool isController2 = ControllerTypeCache.IsControllerType(typeof(NonPublicController));
            bool isController3 = ControllerTypeCache.IsControllerType(typeof(MisspelledKontroller));
            bool isController4 = ControllerTypeCache.IsControllerType(typeof(AbstractController));
            bool isController5 = ControllerTypeCache.IsControllerType(typeof(NonIControllerController));
            bool isController6 = ControllerTypeCache.IsControllerType(typeof(Goodcontroller));

            // Assert
            Assert.IsFalse(isController1, "IsControllerType(null) should return false.");
            Assert.IsFalse(isController2, "Non-public types should not be considered controller types.");
            Assert.IsFalse(isController3, "Types not ending in 'Controller' should not be considered controller types.");
            Assert.IsFalse(isController4, "Abstract types should not be considered controller types.");
            Assert.IsFalse(isController5, "Types not implementing IController should not be considered controller types.");
            Assert.IsTrue(isController6, "The 'Controller' suffix on controller types is not required to be case-sensitive.");
        }