当前位置: 首页>>代码示例>>C#>>正文


C# IMessageLogger类代码示例

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


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


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