MixinRefactoring.CreateMixinFromInterfaceCommand.CanExecute C# (CSharp) Method

CanExecute() public method

public CanExecute ( ClassWithSourceCode childClass, Settings settings = null ) : bool
childClass ClassWithSourceCode
settings Settings
return bool
        public override bool CanExecute(ClassWithSourceCode childClass, Settings settings = null)
        {
            // this feature is only available if the mixin class is an interface
            if (Mixin == null || !Mixin.Class.IsInterface)
                return false;
            return base.CanExecute(childClass, settings);
        }

Usage Example

        public void CreateMixinFromInterfaceCommand_NoMixin()
        {
            var command = new CreateMixinFromInterfaceCommand(null);
            var childClass = NSubstitute.Substitute.For<ClassWithSourceCode>();

            Assert.IsFalse(command.CanExecute(childClass));
        }