Exemple #1
0
        public void When_controller_has_ApiExplorerSettingsAttribute_with_IgnoreApi_then_it_is_ignored()
        {
            //// Arrange

            //// Act
            var controllers = WebApiToSwaggerGenerator.GetControllerClasses(typeof(ApiExplorerIgnoredController).Assembly);

            //// Assert
            Assert.IsFalse(controllers.Any(c => c.Name == "ApiExplorerIgnoredController"));
        }
Exemple #2
0
        public void When_class_is_abstract_then_it_is_ignored()
        {
            //// Arrange


            //// Act
            var controllerClasses = WebApiToSwaggerGenerator.GetControllerClasses(typeof(ControllerClassesTests).Assembly);

            //// Assert
            Assert.IsFalse(controllerClasses.Contains(typeof(MyAbstractController)));
        }
Exemple #3
0
        public void When_class_inherits_from_ApiController_then_it_is_found()
        {
            //// Arrange


            //// Act
            var controllerClasses = WebApiToSwaggerGenerator.GetControllerClasses(typeof(ControllerClassesTests).Assembly);

            //// Assert
            Assert.IsTrue(controllerClasses.Contains(typeof(MyWebApi)));
        }