예제 #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="translationUnit"></param>
        /// <param name="signature"></param>
        /// <returns></returns>
        public static MethodSignatureDeclarationTranslationUnit AddSignature(this InterfaceDeclarationTranslationUnit translationUnit, string signature)
        {
            var methodSignatureDeclaration = MethodSignatureDeclarationTranslationUnit.Create(VisibilityToken.Public, null, IdentifierTranslationUnit.Create(signature));

            translationUnit.AddSignature(methodSignatureDeclaration);
            return(methodSignatureDeclaration);
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="visibility"></param>
        /// <param name="name"></param>
        /// <returns></returns>
        public static ITranslationUnit BuildInterfaceTranslationUnit(ModifierTokens visibility, string name)
        {
            if (name == null)
            {
                throw new ArgumentNullException(nameof(name));
            }

            return(InterfaceDeclarationTranslationUnit.Create(
                       visibility, IdentifierTranslationUnit.Create(name)));
        }
예제 #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="InterfaceASTWalker"/> class.
        /// </summary>
        /// <param name="node"></param>
        /// <param name="interfaceDeclaration"></param>
        /// <param name="semanticModel">The semantic model.</param>
        protected InterfaceASTWalker(CSharpSyntaxNode node, InterfaceDeclarationTranslationUnit interfaceDeclaration, SemanticModel semanticModel)
            : base(node, semanticModel)
        {
            var interfaceDeclarationSyntaxNode = node as InterfaceDeclarationSyntax;

            if (interfaceDeclarationSyntaxNode == null)
            {
                throw new ArgumentException(
                          string.Format("Specified node is not of type {0}",
                                        typeof(InterfaceDeclarationSyntax).Name));
            }

            if (interfaceDeclaration == null)
            {
                throw new ArgumentNullException(nameof(interfaceDeclaration));
            }

            this.interfaceDeclaration = interfaceDeclaration;
        }
 /// <summary>
 /// Creates the translation unit.
 /// </summary>
 /// <remarks>
 /// Must return a type inheriting from <see cref="InterfaceDeclarationTranslationUnit"/>.
 /// </remarks>
 /// <param name="visibility"></param>
 /// <param name="name"></param>
 /// <returns></returns>
 protected virtual ITranslationUnit CreateTranslationUnit(VisibilityToken visibility, ITranslationUnit name)
 {
     return(InterfaceDeclarationTranslationUnit.Create(visibility, name));
 }
 public static MockedInterfaceDeclarationTranslationUnit Create(InterfaceDeclarationTranslationUnit interfaceDeclarationTranslationUnit)
 {
     return(new MockedInterfaceDeclarationTranslationUnit(interfaceDeclarationTranslationUnit));
 }
 protected MockedInterfaceDeclarationTranslationUnit(InterfaceDeclarationTranslationUnit original)
     : base(original)
 {
 }
예제 #7
0
 /// <summary>
 /// Copy initializes a new instance of the <see cref="InterfaceASTWalker"/> class.
 /// </summary>
 /// <param name="other"></param>
 /// <remarks>
 /// For testability.
 /// </remarks>
 public InterfaceASTWalker(InterfaceASTWalker other)
     : base(other)
 {
     this.interfaceDeclaration = other.interfaceDeclaration;
 }
예제 #8
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="translationUnit"></param>
 /// <param name="interfaceName"></param>
 public static void AddExtendedInterface(this InterfaceDeclarationTranslationUnit translationUnit, string interfaceName)
 {
     translationUnit.AddExtendedInterface(IdentifierTranslationUnit.Create(interfaceName));
 }