예제 #1
0
        public void RunTestMethod(ITypeLibWrapper typeLib, TestMethod test, EventHandler <AssertCompletedEventArgs> assertCompletionHandler, out long duration)
        {
            AssertHandler.OnAssertCompleted += assertCompletionHandler;
            var stopwatch = new Stopwatch();

            try
            {
                var testDeclaration = test.Declaration;

                stopwatch.Start();
                _typeLibsApi.ExecuteCode(typeLib, testDeclaration.ComponentName, testDeclaration.QualifiedName.MemberName);
                stopwatch.Stop();

                duration = stopwatch.ElapsedMilliseconds;
            }
            catch (Exception)
            {
                stopwatch.Stop();
                duration = stopwatch.ElapsedMilliseconds;
                throw;
            }
            finally
            {
                AssertHandler.OnAssertCompleted -= assertCompletionHandler;
            }
        }
예제 #2
0
 public void RunDeclarations(ITypeLibWrapper typeLib, IEnumerable <Declaration> declarations)
 {
     foreach (var declaration in declarations)
     {
         _typeLibsApi.ExecuteCode(typeLib, declaration.QualifiedModuleName.ComponentName,
                                  declaration.QualifiedName.MemberName);
     }
 }
예제 #3
0
 public TypeLibVBEExtensions(ITypeLibWrapper parent, ITypeLibInternal unwrappedTypeLib)
 {
     _name = parent.Name;
     // ReSharper disable once SuspiciousTypeConversion.Global
     // We assume that the caller already has checked the HasVBEExtensions
     // before creating this object for the given type library.
     _target_IVBEProject = (IVBEProject)unwrappedTypeLib;
     VBEReferences       = new TypeLibReferenceCollection(this);
 }
예제 #4
0
 private void RunTestCleanup(ITypeLibWrapper wrapper, List <Declaration> cleanupMethods)
 {
     try
     {
         _declarationRunner.RunDeclarations(wrapper, cleanupMethods);
     }
     catch (COMException cleanupFail)
     {
         // Apparently the user doesn't need to know when test results for subsequent tests could be incorrect
         Logger.Trace(cleanupFail, "Unexpected COMException when running TestCleanup");
     }
 }
예제 #5
0
        private TestResult RunTestMethod(ITypeLibWrapper typeLib, TestMethod test)
        {
            long duration = 0;

            try
            {
                var assertResults = new List <AssertCompletedEventArgs>();
                _declarationRunner.RunTestMethod(typeLib, test, (s, e) => assertResults.Add(e), out duration);
                return(EvaluateResults(assertResults, duration));
            }
            catch (COMException e)
            {
                Logger.Info(e, "Unexpected COM exception while running test method.");
                return(new TestResult(TestOutcome.Inconclusive, AssertMessages.TestRunner_ComException, duration));
            }
            catch (Exception e)
            {
                Logger.Error(e, "Unexpected exceptino while running test method.");
                return(new TestResult(TestOutcome.Inconclusive, AssertMessages.TestRunner_ExceptionDuringRun, duration));
            }
        }
        public static void Document(this ITypeLibWrapper _this, StringLineBuilder output)
        {
            output.AppendLine();
            output.AppendLine("================================================================================");
            output.AppendLine();

            output.AppendLine("ITypeLib: " + _this.Name);
            output.AppendLineNoNullChars("- Documentation: " + _this.DocString);
            output.AppendLineNoNullChars("- HelpContext: " + _this.HelpContext);
            output.AppendLineNoNullChars("- HelpFile: " + _this.HelpFile);
            output.AppendLine("- Guid: " + _this.Attributes.guid);
            output.AppendLine("- Lcid: " + _this.Attributes.lcid);
            output.AppendLine("- SysKind: " + _this.Attributes.syskind);
            output.AppendLine("- LibFlags: " + _this.Attributes.wLibFlags);
            output.AppendLine("- MajorVer: " + _this.Attributes.wMajorVerNum);
            output.AppendLine("- MinorVer: " + _this.Attributes.wMinorVerNum);
            output.AppendLine("- HasVBEExtensions: " + _this.HasVBEExtensions);
            if (_this.HasVBEExtensions)
            {
                output.AppendLine("- VBE Conditional Compilation Arguments: " + _this.VBEExtensions.ConditionalCompilationArgumentsRaw);
                foreach (var reference in _this.VBEExtensions.VBEReferences)
                {
                    reference.Document(output);
                }
            }

            output.AppendLine("- TypeCount: " + _this.TypesCount);

            foreach (var typeInfo in _this.TypeInfos)
            {
                using (typeInfo)
                {
                    typeInfo.Document(output, _this.Name, 0);
                }
            }
        }
예제 #7
0
 public delegate(long Duration, TestResult result) ReturnTestResult(ITypeLibWrapper wrapper, TestMethod method, EventHandler <AssertCompletedEventArgs> assertListener, out long duration);
예제 #8
0
 private static void TraceWrapper(ref ITypeLibWrapper wrapper)
 {
     wrapper = new TypeLibWrapperTracer(wrapper, (ITypeLibInternal)wrapper);
 }
 public TypeInfoWrapperCollection(ITypeLibWrapper parent) => _parent = parent;
 internal TypeLibWrapperTracer(ITypeLibWrapper wrapper, ITypeLibInternal inner)
 {
     _wrapper = wrapper;
     _inner   = inner;
 }