internal virtual Methods DescribeMethods()
        {
            Methods methods = new Methods();

            methods.Add(new Method("GetWorklistItems", MethodType.List, new MetaData("Get Worklist Items", "Returns a collection of worklist items."), GetRequiredProperties("GetWorklistItems"), GetMethodParameters("GetWorklistItems"), GetInputProperties("GetWorklistItems"), GetReturnProperties("GetWorklistItems")));
            methods.Add(new Method("LoadWorklistItem", MethodType.Read, new MetaData("Load Worklist Item", "Returns the specified worklist item."), GetRequiredProperties("LoadWorklistItem"), GetMethodParameters("LoadWorklistItem"), GetInputProperties("LoadWorklistItem"), GetReturnProperties("LoadWorklistItem")));
            return(methods);
        }
        private SourceCode.SmartObjects.Services.ServiceSDK.Objects.Methods DescribeMethods()
        {
            SourceCode.SmartObjects.Services.ServiceSDK.Objects.Methods methods = new Methods();
            methods.Add(new Method("ExcelDataList", MethodType.List, new MetaData("ExcelDataList", "Returns a collection Excel sheet."), GetRequiredProperties("ExcelList"), GetMethodParameters(), GetInputProperties("ExcelList"), GetReturnProperties("ExcelList")));
            ////Method to Save File to
            methods.Add(new Method("SaveExcelData", MethodType.List, new MetaData("SaveExcelData", "Returns a collection Excel sheet."), GetRequiredProperties("SaveData"), GetMethodParameters(), GetInputProperties("SaveData"), GetReturnProperties("SaveData")));

            return(methods);
        }
        private void SetupDataMultipleModule()
        {
            Lines lines = new Lines
            {
                { 1, 1 }, // covered
                { 2, 0 }, // not covered
                { 3, 0 } // not covered
            };

            Branches branches = new Branches
            {
                new BranchInfo {
                    Line = 1, Hits = 1, Offset = 1, Path = 0, Ordinal = 1
                },                                                                        // covered
                new BranchInfo {
                    Line = 1, Hits = 1, Offset = 1, Path = 1, Ordinal = 2
                },                                                                        // covered
                new BranchInfo {
                    Line = 1, Hits = 0, Offset = 1, Path = 1, Ordinal = 2
                }                                                                        // not covered
            };

            Methods methods = new Methods();

            string[] methodString =
            {
                "System.Void Coverlet.Core.Tests.CoverageSummaryTests::TestCalculateSummary()",         // covered
                "System.Void Coverlet.Core.Tests.CoverageSummaryTests::TestAditionalCalculateSummary()" // not covered
            };
            methods.Add(methodString[0], new Method());
            methods[methodString[0]].Lines    = lines;
            methods[methodString[0]].Branches = branches;

            methods.Add(methodString[1], new Method());
            methods[methodString[1]].Lines = new Lines
            {
                { 1, 0 } // not covered
            };

            Classes classes = new Classes
            {
                { "Coverlet.Core.Tests.CoverageSummaryTests", methods }
            };

            Documents documents = new Documents
            {
                { "doc.cs", classes }
            };

            _averageCalculationMultiModule = new Modules
            {
                { "module", _averageCalculationSingleModule["module"] },
                { "aditionalModule", documents }
            };
        }
Пример #4
0
        public CoverageResultTests()
        {
            Lines lines = new Lines();

            lines.Add(1, 1);
            lines.Add(2, 1);
            lines.Add(3, 1);
            Branches branches = new Branches();

            branches.Add(new BranchInfo {
                Line = 1, Hits = 1, Offset = 1, Path = 0, Ordinal = 1
            });
            branches.Add(new BranchInfo {
                Line = 1, Hits = 1, Offset = 1, Path = 1, Ordinal = 2
            });
            branches.Add(new BranchInfo {
                Line = 2, Hits = 0, Offset = 1, Path = 0, Ordinal = 1
            });

            // System.Void Coverlet.Core.Tests.CoverageResultTests::CoverageResultTests - 3/3 100% line 2/3 66.7% branch coverage
            Methods methods      = new Methods();
            var     methodString = "System.Void Coverlet.Core.Tests.CoverageResultTests::CoverageResultTests()";

            methods.Add(methodString, new Method());
            methods[methodString].Lines    = lines;
            methods[methodString].Branches = branches;

            // System.Void Coverlet.Core.Tests.CoverageResultTests::GetThresholdTypesBelowThreshold - 0/2 0% line
            methodString = "System.Void Coverlet.Core.Tests.CoverageResultTests::GetThresholdTypesBelowThreshold()";
            methods.Add(methodString, new Method());
            methods[methodString].Lines = new Lines()
            {
                { 1, 0 },
                { 2, 0 },
            };

            Classes classes = new Classes();

            classes.Add("Coverlet.Core.Tests.CoverageResultTests", methods);
            // Methods  - 1/2 (50%)
            // Lines    - 3/5 (60%)
            // Branches - 2/3 (66.67%)

            Documents documents = new Documents();

            documents.Add("doc.cs", classes);

            _modules = new Modules();
            _modules.Add("module", documents);
        }
Пример #5
0
        private SourceCode.SmartObjects.Services.ServiceSDK.Objects.Methods DescribeMethods()
        {
            SourceCode.SmartObjects.Services.ServiceSDK.Objects.Methods methods = new Methods();

            //methods.Add(new Method("GetRoleUsersEmailAddress", MethodType.List, new MetaData("GetRoleUsersEmailAddress", "Returns Role Users Email Address."), GetRequiredProperties("GetRoleUserEmailAddress"), GetMethodParameters(), GetInputProperties("GetRoleUserEmailAddress"), GetReturnProperties("GetRoleUserEmailAddress")));

            methods.Add(new Method("IsInRole", MethodType.List, new MetaData("IsInRole", "Return User presence in the K2 Role."), GetRequiredProperties("IsInRole"), GetMethodParameters(), GetInputProperties("IsInRole"), GetReturnProperties("IsInRole")));

            methods.Add(new Method("GetRoleUsersEmailsonIndex", MethodType.List, new MetaData("GetRoleUsersEmailsonIndex", "Returns Role Users Email Address."), GetRequiredProperties("GetRoleUsersEmailsonIndex"), GetMethodParameters(), GetInputProperties("GetRoleUsersEmailsonIndex"), GetReturnProperties("GetRoleUsersEmailsonIndex")));

            methods.Add(new Method("GetRoleUsersEmails", MethodType.List, new MetaData("GetRoleUsersEmails", "Returns Role Users Email Address."), GetRequiredProperties("GetRoleUsersEmails"), GetMethodParameters(), GetInputProperties("GetRoleUsersEmails"), GetReturnProperties("GetRoleUsersEmails")));

            return(methods);
        }
        internal void Initialize(ClassDeclarationSyntax cds)
        {
            Name = cds.Identifier.ToString();
            foreach (var mds in cds.DescendantNodes().OfType <MethodDeclarationSyntax>())
            {
                SyntaxToken publicToken = mds.ChildTokens().ToList().Find(token => token.ValueText == "public");
                if (publicToken == default(SyntaxToken))
                {
                    continue;
                }

                BaseMethodInfo miToAdd = new BaseMethodInfo();
                miToAdd.Initialize(mds);
                Methods.Add(miToAdd);
            }

            foreach (var ctor in cds.DescendantNodes().OfType <ConstructorDeclarationSyntax>())
            {
                SyntaxToken publicToken = cds.ChildTokens().ToList().Find(token => token.ValueText == "public");
                if (publicToken == default(SyntaxToken))
                {
                    continue;
                }

                BaseMethodInfo miToAdd = new BaseMethodInfo();
                miToAdd.Initialize(ctor);
                Constructors.Add(miToAdd);
            }
        }
        public void CopyAll(Scope other, Scope getter)
        {
            other.IterateElements(true, true, iterate => {
                // Add the element.
                if (iterate.Element is IVariable variable)
                {
                    Variables.Add(variable);
                }
                if (iterate.Element is IMethod method)
                {
                    Methods.Add(method);
                }

                if (iterate.Container.PrivateCatch || iterate.Container.CompletionCatch)
                {
                    return(ScopeIterateAction.StopAfterScope);
                }
                return(ScopeIterateAction.Continue);
            }, scope => {
                // On empty scope.
                if (scope.PrivateCatch || scope.CompletionCatch)
                {
                    return(ScopeIterateAction.StopAfterScope);
                }
                return(ScopeIterateAction.Continue);
            });
        }
Пример #8
0
 protected override void InitializeMethods()
 {
     base.InitializeMethods();
     SetMethodsDefInheritance();
     Methods.Add(CreateDeleteImapFolderByEmailSubFolderMethod());
     Methods.Add(CreateGetInitializedImapClientMethod());
 }
Пример #9
0
    public static void Main()
    {
        // Make a Method object.
        Methods m = new Methods();

        // Use 'out' keyword (no need to assign because it is an out).
        int ans;

        m.Add(90, 90, out ans);
        Console.WriteLine("90 + 90 = {0}", ans);

        // Use 'ref'
        string s = "Can you really have sonic hearing for $19.00?";

        Console.WriteLine("Before: " + s);
        m.UpperCaseThisString(ref s);
        Console.WriteLine("After: {0}", s);

        // Make some objects.
        Person p = new Person("Fred", 93);

        m.ArrayOfObjects(777, p, "I really am an instance of System.String");

        // Use 'params' keyword.
        int[] intArray = new int[3] {
            10, 11, 12
        };
        m.ArrayOfInts("Here is an array of ints", intArray);
        m.ArrayOfInts("Enjoy these 3 ints", 1, 2, 3);
        m.ArrayOfInts("Take some more!", 55, 4, 983, 10432, 98, 33);
    }
        void AddMethods(InterfaceGen iface, bool shouldObsolete, CodeGenerationOptions opt)
        {
            foreach (var method in iface.Methods.Where(m => m.IsStatic))
            {
                var original = method.Deprecated;

                if (shouldObsolete && string.IsNullOrWhiteSpace(method.Deprecated))
                {
                    method.Deprecated = $"Use '{iface.FullName}.{method.AdjustedName}'. This class will be removed in a future release.";
                }

                Methods.Add(new BoundMethod(iface, method, opt, true));

                var name_and_jnisig     = method.JavaName + method.JniSignature.Replace("java/lang/CharSequence", "java/lang/String");
                var gen_string_overload = !method.IsOverride && method.Parameters.HasCharSequence && !iface.ContainsMethod(name_and_jnisig);

                if (gen_string_overload || method.IsReturnCharSequence)
                {
                    Methods.Add(new BoundMethodStringOverload(method, opt));
                }

                if (method.Asyncify)
                {
                    Methods.Add(new MethodAsyncWrapper(method, opt));
                }

                method.Deprecated = original;
            }
        }
Пример #11
0
        private static Documents CreateFirstDocuments()
        {
            Lines lines = new Lines();

            lines.Add(1, new LineInfo {
                Hits = 1
            });
            lines.Add(2, new LineInfo {
                Hits = 0
            });
            Branches branches = new Branches();

            branches.Add(1, new List <BranchInfo> {
                new BranchInfo {
                    Hits = 1, Offset = 23, EndOffset = 24, Path = 0, Ordinal = 1
                },
                new BranchInfo {
                    Hits = 0, Offset = 23, EndOffset = 27, Path = 1, Ordinal = 2
                }
            });
            Methods methods      = new Methods();
            var     methodString = "System.Void Coverlet.Core.Reporters.Tests.OpenCoverReporterTests.TestReport()";

            methods.Add(methodString, new Method());
            methods[methodString].Lines    = lines;
            methods[methodString].Branches = branches;
            Classes classes = new Classes();

            classes.Add("Coverlet.Core.Reporters.Tests.OpenCoverReporterTests", methods);
            Documents documents = new Documents();

            documents.Add("doc.cs", classes);
            return(documents);
        }
Пример #12
0
        /// <summary>
        /// Parse a single method def entrypoint section. For composite R2R images, this method is called multiple times
        /// are method entrypoints are stored separately for each component assembly of the composite R2R executable.
        /// </summary>
        /// <param name="section">Method entrypoint section to parse</param>
        /// <param name="metadataReader">ECMA metadata reader representing this method entrypoint section</param>
        /// <param name="isEntryPoint">Set to true for each runtime function index representing a method entrypoint</param>
        private void ParseMethodDefEntrypointsSection(ReadyToRunSection section, MetadataReader metadataReader, bool[] isEntryPoint)
        {
            int         methodDefEntryPointsOffset = GetOffset(section.RelativeVirtualAddress);
            NativeArray methodEntryPoints          = new NativeArray(Image, (uint)methodDefEntryPointsOffset);
            uint        nMethodEntryPoints         = methodEntryPoints.GetCount();

            for (uint rid = 1; rid <= nMethodEntryPoints; rid++)
            {
                int offset = 0;
                if (methodEntryPoints.TryGetAt(Image, rid - 1, ref offset))
                {
                    EntityHandle methodHandle = MetadataTokens.MethodDefinitionHandle((int)rid);
                    int          runtimeFunctionId;
                    int?         fixupOffset;
                    GetRuntimeFunctionIndexFromOffset(offset, out runtimeFunctionId, out fixupOffset);
                    ReadyToRunMethod method = new ReadyToRunMethod(this, Methods.Count, metadataReader, methodHandle, runtimeFunctionId, owningType: null, constrainedType: null, instanceArgs: null, fixupOffset: fixupOffset);

                    if (method.EntryPointRuntimeFunctionId < 0 || method.EntryPointRuntimeFunctionId >= isEntryPoint.Length)
                    {
                        throw new BadImageFormatException("EntryPointRuntimeFunctionId out of bounds");
                    }
                    isEntryPoint[method.EntryPointRuntimeFunctionId] = true;
                    Methods.Add(method);
                }
            }
        }
Пример #13
0
        public VarEntity(Access access, Usage usage, string name, Compiler.Scope scope) : base(access, usage, name, scope)
        {
            AddAutoProperty(Selector = new VarSelector(Access.Public, Usage.Default, NamingStyleConverter.FromSingleToCamel(VarSelector.StaticTypeName), InnerScope));

            Compiler.Scope[] scopesMergeData = new Compiler.Scope[1];
            for (int i = 0; i < scopesMergeData.Length; i++)
            {
                scopesMergeData[i] = new Compiler.Scope(InnerScope);
            }
            ParameterInfo[] infoMergeData = new ParameterInfo[] {
                new ParameterInfo(
                    (true, VarString.StaticTypeName, "name", scopesMergeData[0]),
                    (true, VarString.StaticTypeName, "data", scopesMergeData[0])
                    )
            };
            Methods.Add("MergeData", (arguments) => {
                (ParameterInfo match, int index) = ParameterInfo.HighestMatch(infoMergeData, arguments);
                match.Grab(arguments);

                switch (index)
                {
                case 0:
                    VarString name = match[0].Value as VarString;
                    VarString data = match[1].Value as VarString;
                    new Spy(null, $"data merge entity {Selector.GetConstant()} {{{name.GetConstant()}:{data.GetConstant()}}}", null);
                    return(null);

                default: throw new MissingOverloadException("MergeData", index, arguments);
                }
            });
        }
Пример #14
0
        public InterfaceInvokerClass(InterfaceGen iface, CodeGenerationOptions opt, CodeGeneratorContext context)
        {
            Name = $"{iface.Name}Invoker";

            IsInternal       = true;
            IsPartial        = true;
            UsePriorityOrder = true;

            Inherits = "global::Java.Lang.Object";
            Implements.Add(iface.Name);

            Attributes.Add(new RegisterAttr(iface.RawJniName, noAcw: true, additionalProperties: iface.AdditionalAttributeString())
            {
                UseGlobal = true
            });

            Fields.Add(new PeerMembersField(opt, iface.RawJniName, $"{iface.Name}Invoker", false));

            Properties.Add(new InterfaceHandleGetter());
            Properties.Add(new JniPeerMembersGetter());
            Properties.Add(new InterfaceThresholdClassGetter());
            Properties.Add(new ThresholdTypeGetter());

            Fields.Add(new FieldWriter {
                Name = "class_ref", Type = TypeReferenceWriter.IntPtr, IsShadow = opt.BuildingCoreAssembly
            });

            Methods.Add(new GetObjectMethod(iface, opt));
            Methods.Add(new ValidateMethod(iface));
            Methods.Add(new DisposeMethod());

            Constructors.Add(new InterfaceInvokerConstructor(iface, context));

            AddMemberInvokers(iface, new HashSet <string> (), opt, context);
        }
Пример #15
0
 private void GenerateGetNavigationAction(int permissionid, Dictionary <string, int> permissionNavis)
 {
     foreach (var item in Entity.NavigationPropertys.Values)
     {
         ControllerMethodMetadata method;
         var controller = Entity.Definition.Controller;
         if (item.PropertyType.IsCollection)
         {
             method = new ControllerMethodMetadata(EControllerMethodType.GetNavigateQueryable).PermissionAction(permissionid);
             if (controller.DisablePage)
             {
                 method.Write("System.Web.OData.EnableQuery");
             }
             else
             {
                 method.Write("System.Web.OData.EnableQuery", $"PageSize={controller.PageSize}");
             }
         }
         else
         {
             method = new ControllerMethodMetadata(EControllerMethodType.GetNavigateSingleResult).PermissionAction(permissionid);
             method.Write("System.Web.OData.EnableQuery");
         }
         method.Navigation = item;
         if (permissionNavis.ContainsKey(item.Name))
         {
             method.PermissionAction(permissionNavis[item.Name]);
         }
         Methods.Add(method);
     }
 }
Пример #16
0
        public CoverageSummaryTests()
        {
            Lines lines = new Lines();

            lines.Add(1, new LineInfo {
                Hits = 1, IsBranchPoint = true
            });
            lines.Add(2, new LineInfo {
                Hits = 0
            });

            Methods methods = new Methods();

            methods.Add("System.Void Coverlet.Core.Tests.CoverageSummaryTests::TestCalculateSummary()", lines);

            Classes classes = new Classes();

            classes.Add("Coverlet.Core.Tests.CoverageSummaryTests", methods);

            Documents documents = new Documents();

            documents.Add("doc.cs", classes);

            _modules = new Modules();
            _modules.Add("module", documents);
        }
Пример #17
0
 protected override void InitializeMethods()
 {
     base.InitializeMethods();
     SetMethodsDefInheritance();
     Methods.Add(CreateOnBaseSysCultureInsertedMethod());
     Methods.Add(CreateOnBaseSysCultureDeletedMethod());
 }
Пример #18
0
        private static Documents CreateSecondDocuments()
        {
            Lines lines = new Lines();

            lines.Add(1, new LineInfo {
                Hits = 1
            });
            lines.Add(2, new LineInfo {
                Hits = 0
            });

            Methods methods      = new Methods();
            var     methodString = "System.Void Some.Other.Module.TestClass.TestMethod()";

            methods.Add(methodString, new Method());
            methods[methodString].Lines = lines;

            Classes classes2 = new Classes();

            classes2.Add("Some.Other.Module.TestClass", methods);

            var documents = new Documents();

            documents.Add("TestClass.cs", classes2);

            return(documents);
        }
Пример #19
0
        public DefaultMethod AddMethod(string name)
        {
            DefaultMethod method = new DefaultMethod(this, name);

            Methods.Add(method);
            return(method);
        }
Пример #20
0
        public void TestReport()
        {
            CoverageResult result = new CoverageResult();

            result.Identifier = Guid.NewGuid().ToString();

            Lines lines = new Lines();

            lines.Add(1, 1);
            lines.Add(2, 0);

            Methods methods      = new Methods();
            var     methodString = "System.Void Coverlet.Core.Reporters.Tests.JsonReporterTests.TestReport()";

            methods.Add(methodString, new Method());
            methods[methodString].Lines = lines;

            Classes classes = new Classes();

            classes.Add("Coverlet.Core.Reporters.Tests.JsonReporterTests", methods);

            Documents documents = new Documents();

            documents.Add("doc.cs", classes);

            result.Modules = new Modules();
            result.Modules.Add("module", documents);

            JsonReporter reporter = new JsonReporter();

            Assert.NotEqual("{\n}", reporter.Report(result, new Mock <ISourceRootTranslator>().Object));
            Assert.NotEqual(string.Empty, reporter.Report(result, new Mock <ISourceRootTranslator>().Object));
        }
 protected override void InitializeMethods()
 {
     base.InitializeMethods();
     SetMethodsDefInheritance();
     Methods.Add(CreateGetResultParameterAllValuesMethod());
     Methods.Add(CreateCompleteExecutingMethod());
 }
Пример #22
0
 protected override void InitializeMethods()
 {
     base.InitializeMethods();
     SetMethodsDefInheritance();
     Methods.Add(CreateGetLookupDisplayColumnValueMethod());
     Methods.Add(CreateGetFetchedDisplayColumnValueMethod());
 }
Пример #23
0
            void AddMethod(MethodDefinition method)
            {
                if (IsVisible(method.Attributes))
                {
                    DefaultMethod m = new DefaultMethod(this, method.IsConstructor ? "#ctor" : method.Name);

                    if (method.GenericParameters.Count > 0)
                    {
                        foreach (GenericParameter g in method.GenericParameters)
                        {
                            m.TypeParameters.Add(new DefaultTypeParameter(m, g.Name, g.Position));
                        }
                        int i = 0;
                        foreach (GenericParameter g in method.GenericParameters)
                        {
                            AddConstraintsFromType(m.TypeParameters[i++], g);
                        }
                    }

                    m.ReturnType = CreateType(this.ProjectContent, m, method.ReturnType.ReturnType);
                    if (this.ClassType == ClassType.Interface)
                    {
                        m.Modifiers = ModifierEnum.Public | ModifierEnum.Abstract;
                    }
                    else
                    {
                        m.Modifiers = TranslateModifiers(method);
                    }
                    AddParameters(m, method.Parameters);
                    AddExplicitInterfaceImplementations(method.Overrides, m);
                    Methods.Add(m);
                }
            }
Пример #24
0
        public void AddLambda <T>(T lambda, Type eventType)
        {
            if (eventType == null)
            {
                throw new ArgumentNullException(nameof(eventType));
            }

            if (eventType.IsGenericType && eventType.Closes(typeof(IEvent <>)))
            {
                eventType = eventType.GetGenericArguments().Single();
            }

            var name   = LambdaName + (++_lambdaNumber).ToString();
            var method = lambda.GetType().GetMethod("Invoke");
            var setter = new Setter(typeof(T), name)
            {
                InitialValue = lambda
            };
            var slot = new MethodSlot(setter, method, eventType);

            Methods.Add(slot);

            if (method.IsAsync())
            {
                IsAsync = true;
            }
        }
Пример #25
0
        /// <summary>
        /// Adds a method to the current scope.
        /// When handling methods added by the user, supply the diagnostics and range to show the syntax error at.
        /// When handling methods added internally, have the diagnostics and range parameters be null. An exception will be thrown instead if there is a syntax error.
        /// </summary>
        /// <param name="method">The method that will be added to the current scope. If the object reference is already in the direct scope, an exception will be thrown.</param>
        /// <param name="diagnostics">The file diagnostics to throw errors with. Should be null when adding methods internally.</param>
        /// <param name="range">The document range to throw errors at. Should be null when adding methods internally.</param>
        public void AddMethod(IMethod method, FileDiagnostics diagnostics, DocRange range, bool checkConflicts = true)
        {
            if (method == null)
            {
                throw new ArgumentNullException(nameof(method));
            }
            if (Methods.Contains(method))
            {
                throw new Exception("method reference is already in scope.");
            }

            if (checkConflicts && HasConflict(method))
            {
                string message = "A method with the same name and parameter types was already defined in this scope.";

                if (diagnostics != null && range != null)
                {
                    diagnostics.Error(message, range);
                    return;
                }
                else
                {
                    throw new Exception(message);
                }
            }

            Methods.Add(method);
        }
        public void GetMeta()
        {
            _staticScope = _scope.Child(true);
            _objectScope = _staticScope.Child(true);

            // Add type args to scopes.
            foreach (var type in GenericTypes)
            {
                _staticScope.AddType(new GenericCodeTypeInitializer(type));
                _objectScope.AddType(new GenericCodeTypeInitializer(type));
            }

            var declarationParseInfo = _parseInfo.SetContextualModifierGroup(_contextualVariableModifiers);

            // Get declarations.
            foreach (var declaration in _context.Declarations)
            {
                var element = ((IDefinedTypeInitializer)this).ApplyDeclaration(declaration, declarationParseInfo);

                if (element is IMethodProvider method)
                {
                    Methods.Add(method);
                }
            }
        }
        private void SetupDataSingleModule()
        {
            Lines lines = new Lines();

            lines.Add(1, 1);
            lines.Add(2, 0);
            Branches branches = new Branches();

            branches.Add(new BranchInfo {
                Line = 1, Hits = 1, Offset = 1, Path = 0, Ordinal = 1
            });
            branches.Add(new BranchInfo {
                Line = 1, Hits = 1, Offset = 1, Path = 1, Ordinal = 2
            });

            Methods methods      = new Methods();
            var     methodString = "System.Void Coverlet.Core.Tests.CoverageSummaryTests::TestCalculateSummary()";

            methods.Add(methodString, new Method());
            methods[methodString].Lines    = lines;
            methods[methodString].Branches = branches;

            Classes classes = new Classes();

            classes.Add("Coverlet.Core.Tests.CoverageSummaryTests", methods);

            Documents documents = new Documents();

            documents.Add("doc.cs", classes);

            _averageCalculationSingleModule = new Modules();
            _averageCalculationSingleModule.Add("module", documents);
        }
Пример #28
0
        // adds all predeclared identifiers and methods
        private void addPredeclared()
        {
            // cbio
            // void read( out int val )
            string   name   = "cbio.read";
            CbType   typm   = CbType.Void;
            CbMethod method = new CbMethod(name, typm);

            method.ArgType.Add(CbType.Int);
            List <CbMethod> read = new List <CbMethod>();

            read.Add(method);
            // void write( int val )
            name   = "cbio.write";
            method = new CbMethod(name, typm);
            method.ArgType.Add(CbType.Int);
            List <CbMethod> writes = new List <CbMethod>();

            writes.Add(method);
            // void write( string val )
            method = new CbMethod(name, typm);
            method.ArgType.Add(CbType.String);
            writes.Add(method);
            Methods.Add(name, writes);
        }
Пример #29
0
        public void TestFormat()
        {
            CoverageResult result = new CoverageResult();

            result.Identifier = Guid.NewGuid().ToString();
            Lines lines = new Lines();

            lines.Add(1, 1);
            lines.Add(2, 0);
            Methods methods = new Methods();

            methods.Add("System.Void Coverlet.Core.Reporters.Tests.JsonReporterTests.TestFormat()", lines);
            Classes classes = new Classes();

            classes.Add("Coverlet.Core.Reporters.Tests.JsonReporterTests", methods);
            Documents documents = new Documents();

            documents.Add("doc.cs", classes);
            result.Modules = new Modules();
            result.Modules.Add("module", documents);

            JsonReporter reporter = new JsonReporter();

            Assert.NotEqual("{\n}", reporter.Format(result));
            Assert.NotEqual(string.Empty, reporter.Format(result));
        }
 protected override void InitializeMethods()
 {
     base.InitializeMethods();
     SetMethodsDefInheritance();
     Methods.Add(CreateGetSelectedValuesMethod());
     Methods.Add(CreateUpdateFiltersRightExprMetaDataByParameterValueMethod());
 }