コード例 #1
0
 public static Method AddPassingTest(this Class self, string methodName, string output = null, string displayName = null)
 {
     return self.AddMethod(methodName, _ =>
                                           {
                                               if (!string.IsNullOrEmpty(output))
                                                   Console.Write(output);
                                           }, null, new FactAttribute { DisplayName = displayName });
 }
コード例 #2
0
        public static MethodStatement Method(this ClassStatement classStatement, string name,
                                             Action<BlockStatement> block)
        {
            var blockStatement = new BlockStatement();
            block(blockStatement);

            var methodStatement = new MethodStatement(name, blockStatement);
            classStatement.AddMethod(methodStatement);
            return methodStatement;
        }
コード例 #3
0
ファイル: MetaExtensions.cs プロジェクト: tarik-s/Meticulous
        public static MetaClassBuilder AddMethod(this MetaClassBuilder @this, string name, Action<MetaFunctionBuilder> handler)
        {
            Check.This(@this);

            var builder = @this.AddMethod(name);

            if (handler != null)
                handler(builder);

            return @this;
        }
コード例 #4
0
ファイル: Env.cs プロジェクト: takuto-h/rhea
 public static void AddMethod(
     this IEnv env,
     ValueSymbol klass,
     string selectorName,
     IValueFunc func
 )
 {
     env.AddMethod(
         klass, ValueSymbol.Intern(selectorName), func
     );
 }
コード例 #5
0
 public static Method AddSkippedTest(this Class self, string methodName, string skippedReason, string displayName = null)
 {
     return self.AddMethod(methodName, _ => { }, null, new FactAttribute { Skip = skippedReason, DisplayName = displayName });
 }
コード例 #6
0
 public static Method AddTestWithInvalidParameters(this Class self, string methodName)
 {
     return self.AddMethod(methodName, _ => { }, new[] { Parameter.Create<string>("value") }, new FactAttribute());
 }
コード例 #7
0
ファイル: DoxType.cs プロジェクト: codaxy/dox
        /// <summary>
        /// Updating the Base-Type information of an Dox.Type object.
        /// In first pars step, the type has just the BaseType reference
        /// identifier. In this step the identifier got replaced by the 
        /// related BaseType name.
        /// </summary>
        /// <param name="type">
        /// A <see cref="Codaxy.Dox.Type"/>
        /// </param>
        /// <param name="baseType">
        /// A <see cref="Codaxy.Dox.Type"/>
        /// </param>
        public static void UpdateBaseType(this Codaxy.Dox.Type type, Codaxy.Dox.Type baseType)
        {
            if (type.BaseTypes != null)
            foreach (String baseRef in type.BaseTypes)
            {
                if (baseRef.Equals(baseType.RefId))			// found
                {
                    // Methods
                    if (baseType.Methods != null){
                        if (type.Methods ==  null)
                            type.Methods = new List<Method>(baseType.Methods);
                        else
                            foreach (Method method in baseType.Methods)
                                    type.AddMethod(method);
                    }
                    // Properties
                    if (baseType.Properties != null){
                        if (type.Properties ==  null)
                            type.Properties = new List<Property>(baseType.Properties);
                        else
                            foreach (Property property in baseType.Properties)
                                    type.AddProperty(property);
                    }
                    // Fields
                    if (baseType.Fields != null){
                        if (type.Fields ==  null)
                            type.Fields = new List<Field>(baseType.Fields);
                        else
                            foreach (Field field in baseType.Fields)
                                    type.AddFiled(field);
                    }
                    // Events
                    if (baseType.Events != null){
                        if (type.Events ==  null)
                            type.Events = new List<Event>(baseType.Events);
                        else
                            foreach (Event _event in baseType.Events)
                                    type.AddEvent(_event);
                    }

                    type.BaseTypes.Remove(baseRef);
                    type.BaseTypes.Add(baseType.Name);
                    break;
                }
            }
        }