• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# IMessageLogger类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中IMessageLogger的典型用法代码示例。如果您正苦于以下问题:C# IMessageLogger类的具体用法?C# IMessageLogger怎么用?C# IMessageLogger使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IMessageLogger类属于命名空间,在下文中一共展示了IMessageLogger类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: AddLogger

 public static void AddLogger(this ITestLogger logger, IMessageLogger childLogger)
 {
     if (logger != null)
     {
         logger.AddLogger(l => l.Logger == childLogger, () => new TestMessageTestLogger(childLogger));
     }
 }
开发者ID:jbijlsma,项目名称:JsTestAdapter,代码行数:7,代码来源:TestLoggerExtensions.cs


示例2: DiagnosticMessageVisitor

 public DiagnosticMessageVisitor(IMessageLogger logger, string assemblyDisplayName, bool showDiagnostics, Stopwatch stopwatch)
 {
     this.logger = logger;
     this.assemblyDisplayName = assemblyDisplayName;
     this.showDiagnostics = showDiagnostics;
     this.stopwatch = stopwatch;
 }
开发者ID:modulexcite,项目名称:visualstudio.xunit,代码行数:7,代码来源:DiagnosticMessageVisitor.cs


示例3: AddLogger

 public void AddLogger(IMessageLogger logger)
 {
     if (logger != null)
     {
         _loggers.Add(new KarmaTestMessageLogger(logger));
     }
 }
开发者ID:jischebeck,项目名称:KarmaTestAdapter,代码行数:7,代码来源:KarmaLogger.cs


示例4: DiscoverTests

 public virtual void DiscoverTests(IEnumerable<string> sources, IDiscoveryContext discoveryContext, IMessageLogger logger, ITestCaseDiscoverySink discoverySink)
 {
     TestAdapterInfo = CreateTestAdapterInfo();
     var testLogger = TestAdapterInfo.CreateLogger(logger);
     var discoverLogger = new TestLogger(testLogger, "Discover");
     var testSettings = discoveryContext.RunSettings.GetTestSettings(TestAdapterInfo.SettingsName);
     var count = 0;
     var testCount = 0;
     foreach (var source in sources)
     {
         var sourceSettings = GetSourceSettings(source, testSettings);
         if (sourceSettings != null)
         {
             testCount += DiscoverTests(sourceSettings, testLogger, discoverySink).Result;
             count += 1;
         }
         else
         {
             discoverLogger.Warn("Could not get settings for {0}", source);
         }
     }
     if (count > 0 || testCount > 0)
     {
         discoverLogger.Info("{0} tests discovered in {1} test containers", testCount, count);
     }
 }
开发者ID:jbijlsma,项目名称:JsTestAdapter,代码行数:26,代码来源:TestRunner.cs


示例5: ParseTests

 private void ParseTests(StreamReader standardOutput, ITestCaseDiscoverySink discoverySink, IMessageLogger logger, string source)
 {
     string testcase = "";
     bool testsStarted = false;
     Regex testCaseMatch = new Regex(@".*\.$");
     while (standardOutput.Peek() != -1)
     {
         string line = standardOutput.ReadLine();
         if (!string.IsNullOrEmpty(line))
         {
             if (testCaseMatch.IsMatch(line))
             {
                 testsStarted = true;
                 testcase = line.Trim();
                 logger.SendMessage(TestMessageLevel.Informational, string.Format("Found test case {0}", testcase.Trim('.')));
             }
             else if(testsStarted)
             {
                 TestCase test = new TestCase(testcase + line.Trim(), Plugin.VisualStudio2012.GTest.GTestExecutor.ExecutorUri, source);
                 discoverySink.SendTestCase(test);
                 logger.SendMessage(TestMessageLevel.Informational, string.Format("Found test {0}", testcase + line.Trim()));
             }
         }
     }
 }
开发者ID:etinquis,项目名称:gtest-gbar-1,代码行数:25,代码来源:GTestDiscoverer.cs


示例6: DiscoverTests

        public void DiscoverTests(IEnumerable<string> sources, IDiscoveryContext discoveryContext, IMessageLogger log, ITestCaseDiscoverySink discoverySink)
        {
            log.Version();

            RemotingUtility.CleanUpRegisteredChannels();

            foreach (var assemblyPath in sources)
            {
                try
                {
                    if (AssemblyDirectoryContainsFixie(assemblyPath))
                    {
                        log.Info("Processing " + assemblyPath);

                        using (var environment = new ExecutionEnvironment(assemblyPath))
                        {
                            var methodGroups = environment.DiscoverTestMethodGroups(new Options());

                            foreach (var methodGroup in methodGroups)
                                discoverySink.SendTestCase(new TestCase(methodGroup.FullName, VsTestExecutor.Uri, assemblyPath));
                        }
                    }
                    else
                    {
                        log.Info("Skipping " + assemblyPath + " because it is not a test assembly.");
                    }
                }
                catch (Exception exception)
                {
                    log.Error(exception);
                }
            }
        }
开发者ID:scichelli,项目名称:fixie,代码行数:33,代码来源:VsTestDiscoverer.cs


示例7: DiscoverTests

        public void DiscoverTests(IEnumerable<string> sources, IDiscoveryContext discoveryContext
            , IMessageLogger logger, ITestCaseDiscoverySink discoverySink)
        {
            #if DEBUG && LAUNCH_DEBUGGER
            System.Diagnostics.Debugger.Launch();
            #endif

            try
            {
                Logger.Initialize(logger);

                var sourceGroups = sources.GroupBy(Path.GetExtension);
                foreach (IGrouping<string, string> sourceGroup in sourceGroups)
                {
                    IIutestTestDiscoverer discoverer = iutestTestDiscovererFactory.GetTestDiscoverer(sourceGroup.Key);
                    if( discoverer != null )
                    {
                        discoverer.DiscoverTests(sourceGroup, discoveryContext, logger, discoverySink);
                    }
                }
            }
            catch( Exception e )
            {
                Logger.Error("iutest_adapter: Exception caught while DiscoverTests: {0}, {1} ", e.Message, e.HResult );
                Logger.Error(e.StackTrace);
            }
            finally
            {
                Logger.Uninitialize();
            }
        }
开发者ID:srz-zumix,项目名称:vs-iutest-adapter,代码行数:31,代码来源:iutestTestDiscoverer.cs


示例8: GetTests

        public static List<TestCase> GetTests(IEnumerable<string> sources, ITestCaseDiscoverySink discoverySink, IMessageLogger logger = null)
        {
            var tests = new List<TestCase>();
            foreach (var source in sources)
            {
                var testType = TestType.Pester;

                var scriptContents = System.IO.File.ReadAllText(source);
                if (scriptContents.StartsWith("#pester", StringComparison.OrdinalIgnoreCase))
                {
                    testType = TestType.Pester;
                }
                else if (scriptContents.StartsWith("#psate", StringComparison.OrdinalIgnoreCase))
                {
                    testType = TestType.PSate;
                }

                if (testType == TestType.Pester)
                {
                    DiscoverPesterTests(discoverySink, logger, source, tests);    
                }
                else if (testType == TestType.PSate)
                {
                    DiscoverPsateTests(discoverySink, source, tests);    
                }
            }
            return tests;
        }
开发者ID:vairam-svs,项目名称:poshtools,代码行数:28,代码来源:PowerShellTestDiscoverer.cs


示例9: DiscoverTests

        /// <summary>
        /// Finds tests in Catch unit test binaries. Note: We have to run the binary to enumerate tests.
        /// </summary>
        /// <param name="sources">Binaries to search for tests.</param>
        public void DiscoverTests(IEnumerable<string> sources, IDiscoveryContext context, IMessageLogger logger, ITestCaseDiscoverySink discoverySink)
        {
            currentLogger = logger;

            foreach (var source in sources)
            {
                switch (checkCatchTestBinaryFormat(source))
                {
                    case CatchBinaryFormat.NoCatchTestBinary:
                        continue;
                    case CatchBinaryFormat.CatchTestBinary:
                        foreach (var testCase in ListTestsInBinary(source))
                        {
                            discoverySink.SendTestCase(testCase);
                        }
                        continue;
                    case CatchBinaryFormat.CatchTestBinaryWithXmlTestList:
                        foreach (var testCase in ListTestsInBinaryXml(source))
                        {
                            discoverySink.SendTestCase(testCase);
                        }
                        break;
                }
            }
        }
开发者ID:mrpi,项目名称:CatchVsTestAdapter,代码行数:29,代码来源:CatchTestDiscoverer.cs


示例10: DiscoverTests

        public void DiscoverTests(IEnumerable<string> sources, IDiscoveryContext discoveryContext, IMessageLogger logger, ITestCaseDiscoverySink discoverySink)
        {
            testLogger = new TestLogger(logger);

            testLogger.SendMainMessage("Discovery started");

            foreach (var source in sources)
            {
                testLogger.SendDebugMessage(String.Format("Processing: '{0}'", source));

                try
                {
                    using (var sandbox = new Sandbox<Discoverer>(source))
                    {
                        if (sandbox.Content != null)
                        {
                            sandbox.Content
                                .DiscoverTests()
                                .Select(name => name.ToTestCase(source))
                                .ForEach(discoverySink.SendTestCase);
                        }
                    }
                }
                catch (Exception ex)
                {
                    testLogger.SendErrorMessage(ex, String.Format("Exception found while discovering tests in source '{0}'", source));

                    // just go on with the next
                }
            }

            testLogger.SendMainMessage("Discovery finished");
        }
开发者ID:laynor,项目名称:NSpecTestAdapter,代码行数:33,代码来源:NSpecTestDiscoverer.cs


示例11: CreatePlayers

        internal static ICollection<IPlayer> CreatePlayers(GameType gameType, IMessageLogger messageLogger)
        {
            logger = messageLogger;
            ICollection<IPlayer> players = new List<IPlayer>();

            switch (gameType)
            {
                case GameType.SinglePlayer:
                    var humanPlayer = CreateHumanPlayer();
                    var computerPlayer = CreateComputerPlayer();
                    players.Add(humanPlayer);
                    players.Add(computerPlayer);
                    break;

                case GameType.MultiPlayer:
                    var firstPlayer = CreateHumanPlayer();
                    var secondPlayer = CreateHumanPlayer();
                    players.Add(firstPlayer);
                    players.Add(secondPlayer);
                    break;
                default:
                    BullsAndCowsException.GameTypeException();
                    break;
            }

            return players;
        }
开发者ID:siderisltd,项目名称:HQC-Team-BullsAndCows4,代码行数:27,代码来源:PlayerFactory.cs


示例12: DiscoverTests

        public void DiscoverTests(IEnumerable<string> sources, IDiscoveryContext discoveryContext, IMessageLogger logger, ITestCaseDiscoverySink discoverySink)
        {
            Code.Require(sources, "sources");
            Code.Require(discoverySink, "discoverySink");

            BoostTestAdapterSettings settings = BoostTestAdapterSettingsProvider.GetSettings(discoveryContext);
            _sourceFilters = SourceFilterFactory.Get(settings);
            IDictionary<string, ProjectInfo> solutioninfo = null;

            var numberOfAttempts = 100;

            // try several times to overcome "Application is Busy" COMException
            while (numberOfAttempts > 0)
            {
                try
                {
                    solutioninfo = PrepareTestCaseData(sources);
                    // set numberOfAttempts = 0, because there is no need to try again,
                    // since obviously no exception was thrown at this point
                    numberOfAttempts = 0;
                }
                catch (COMException)
                {
                    --numberOfAttempts;

                    // re-throw after all attempts have failed
                    if (numberOfAttempts == 0)
                    {
                        throw;
                    }
                }
            }

            GetBoostTests(solutioninfo, discoverySink);
        }
开发者ID:timopk,项目名称:vs-boost-unit-test-adapter,代码行数:35,代码来源:SourceCodeDiscoverer.cs


示例13: GetValueEditor

 public static PropertyValueEditor GetValueEditor(IEnumerable attributes, IMessageLogger exceptionLogger)
 {
     PropertyValueEditor propertyValueEditor = null;
     if (attributes != null)
     {
         foreach (Attribute attribute in attributes)
         {
             EditorAttribute editorAttribute = attribute as EditorAttribute;
             if (editorAttribute != null)
             {
                 try
                 {
                     Type editorType = Type.GetType(editorAttribute.EditorTypeName);
                     if (editorType != null && typeof(PropertyValueEditor).IsAssignableFrom(editorType))
                     {
                         propertyValueEditor = (PropertyValueEditor)Activator.CreateInstance(editorType);
                         break;
                     }
                 }
                 catch (Exception e)
                 {
                     if (exceptionLogger != null)
                     {
                         exceptionLogger.WriteLine(string.Format(CultureInfo.CurrentCulture, ExceptionStringTable.ValueEditorLoadFailed, ExtensibilityMetadataHelper.GetExceptionMessage(e)));
                     }
                 }
             }
         }
     }
     return propertyValueEditor;
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:31,代码来源:ExtensibilityMetadataHelper.cs


示例14: DbDiffChangeLoggerContext

 public DbDiffChangeLoggerContext(DbDiffOptions opts, IMessageLogger logger, DbDiffOptsLogger ltype)
 {
     m_opts = opts;
     m_ltype = ltype;
     m_oldValue = m_opts.DiffLogger;
     m_opts.SetLogger(m_ltype, logger);
 }
开发者ID:dbshell,项目名称:dbshell,代码行数:7,代码来源:DbDiffOptions.cs


示例15: Initialize

        // The Adapter is constructed using the default constructor.
        // We don't have any info to initialize it until one of the
        // ITestDiscovery or ITestExecutor methods is called. The
        // each Discover or Execute method must call this method.
        protected virtual void Initialize(IMessageLogger messageLogger)
        {
            Verbosity = 0; // In case we throw below
            AdapterVersion = Assembly.GetExecutingAssembly().GetName().Version.ToString();

            try
            {
                var registry = RegistryCurrentUser.OpenRegistryCurrentUser(@"Software\nunit.org\VSAdapter");
                UseVsKeepEngineRunning = registry.Exist("UseVsKeepEngineRunning") && (registry.Read<int>("UseVsKeepEngineRunning") == 1);
                ShadowCopy = registry.Exist("ShadowCopy") && (registry.Read<int>("ShadowCopy") == 1);
#if DEBUG && VERBOSE
                Verbosity = 1;
#else
                Verbosity = (registry.Exist("Verbosity")) ? registry.Read<int>("Verbosity") : 0;
#endif
            }
            catch (Exception e)
            {
                messageLogger.SendMessage(TestMessageLevel.Error, "Unable to access registry. Default settings will be used");
                messageLogger.SendMessage(TestMessageLevel.Error, e.ToString());
            }

            TestEngine = new TestEngine();
            TestLog = new TestLogger(messageLogger, Verbosity);
        }
开发者ID:Green-Bug,项目名称:nunit3-vs-adapter,代码行数:29,代码来源:NUnitTestAdapter.cs


示例16: DiscoverTests

        public void DiscoverTests(IEnumerable<string> sources, IDiscoveryContext discoveryContext, IMessageLogger logger, ITestCaseDiscoverySink discoverySink)
        {
            _logger = logger;

            _logger.SendMessage(TestMessageLevel.Informational, ">>> DiscoverTests");
            GetTests(sources, discoverySink);
        }
开发者ID:jgordon615,项目名称:NodeUnitTestAdapter,代码行数:7,代码来源:NodeUnitTestDiscoverer.cs


示例17: DiscoverTests

        public void DiscoverTests(IEnumerable<string> sources, IDiscoveryContext discoveryContext, IMessageLogger logger, ITestCaseDiscoverySink discoverySink)
        {
            ChutzpahTracer.TraceInformation("Begin Test Adapter Discover Tests");

            var settingsProvider = discoveryContext.RunSettings.GetSettings(AdapterConstants.SettingsName) as ChutzpahAdapterSettingsProvider;
            var settings = settingsProvider != null ? settingsProvider.Settings : new ChutzpahAdapterSettings();

            ChutzpahTracingHelper.Toggle(settings.EnabledTracing);

            var testOptions = new TestOptions
            {
                MaxDegreeOfParallelism = settings.MaxDegreeOfParallelism,
                ChutzpahSettingsFileEnvironments = new ChutzpahSettingsFileEnvironments(settings.ChutzpahSettingsFileEnvironments)
            };

            IList<TestError> errors;
            var testCases = testRunner.DiscoverTests(sources, testOptions, out errors);

            ChutzpahTracer.TraceInformation("Sending discovered tests to test case discovery sink");

            foreach (var testCase in testCases)
            {
                var vsTestCase = testCase.ToVsTestCase();
                discoverySink.SendTestCase(vsTestCase);
            }

            foreach (var error in errors)
            {
                logger.SendMessage(TestMessageLevel.Error, RunnerCallback.FormatFileErrorMessage(error));
            }

            ChutzpahTracer.TraceInformation("End Test Adapter Discover Tests");

        }
开发者ID:squadwuschel,项目名称:chutzpah,代码行数:34,代码来源:ChutzpahTestDiscoverer.cs


示例18: Discover

        public IEnumerable<TestCase> Discover(IEnumerable<string> sources, IMessageLogger logger)
        {
            foreach (string source in sources)
            {
                Assembly assembly = Assembly.LoadFrom(source);

                IEnumerable<Type> testGeneratorTypes = assembly.GetTypes()
                    .Where(TypeIsImplementationOfTestGeneratorInterface);

                foreach (Type testGeneratorType in testGeneratorTypes)
                {
                    ITestGenerator testGenerator = Activator.CreateInstance(testGeneratorType) as ITestGenerator;

                    foreach (Test test in testGenerator.Generate())
                    {
                        yield return new TestCase(String.Format("{0}#{1}", testGeneratorType.FullName, test.Name.Replace(" ", "")), TestGeneratorAdapter.ExecutorUri, source)
                        {
                            DisplayName = test.Name,
                            LineNumber = test.LineNumber,
                            CodeFilePath = test.SourceFile
                        };
                    }
                }
            }
        }
开发者ID:allansson,项目名称:brute,代码行数:25,代码来源:AssemblyReflectionTestGeneratorDiscoverer.cs


示例19: DiscoverTests

 public void DiscoverTests(IEnumerable<string> sources,
                             IDiscoveryContext discoveryContext,
                             IMessageLogger logger,
                             ITestCaseDiscoverySink discoverySink)
 {
     GetTests(sources, discoverySink);
 }
开发者ID:Tokiota,项目名称:PildorasALM,代码行数:7,代码来源:JsonTestDiscoverer.cs


示例20: DiscoverTests

        public void DiscoverTests(IEnumerable<string> sources, 
                                  IDiscoveryContext discoveryContext, 
                                  IMessageLogger logger, 
                                  ITestCaseDiscoverySink discoverySink)
        {
            var validSources = from source in sources
                               where source.EndsWith(StringHelper.GetSearchExpression(), StringComparison.CurrentCultureIgnoreCase)
                               select source;

            foreach (var source in validSources) {
                var results = appDomainRunner.ExecuteSpecifications(source);
                var query = from result in results
                            from @group in result.Examples
                            from example in @group.Examples
                            select example;

                foreach (var example in query) {
                    var testCase = new TestCase(example.Reason, DefaultTestExecutor.ExecutorUri, source) {
                        CodeFilePath = example.FileName,
                        LineNumber = example.LineNumber
                    };
                    discoverySink.SendTestCase(testCase);
                }
            }
        }
开发者ID:alexfalkowski,项目名称:System.Spec,代码行数:25,代码来源:DefaultTestDiscoverer.cs



注:本文中的IMessageLogger类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IMessageReceiver类代码示例发布时间:2022-05-24
下一篇:
C# IMessageHandler类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap