CCMTests.IntegrationTests.GetByName C# (CSharp) Метод

GetByName() приватный статический Метод

private static GetByName ( List metrics, string nameOfFunction ) : CCMEngine.ccMetric
metrics List
nameOfFunction string
Результат CCMEngine.ccMetric
        private static ccMetric GetByName(List<ccMetric> metrics, string nameOfFunction)
        {
            foreach (ccMetric m in metrics)
            if (m.Unit == nameOfFunction)
              return m;

              return null;
        }

Usage Example

Пример #1
0
        public void TestFileWithTabAfterEndif()
        {
            string         filename = "FileWithTabAfterEndIf.c"; // this is deployed through local.testsettings
            SortedListener listener = new SortedListener(10, new List <string>(), 0);

            using (StreamReader stream = new StreamReader(filename))
            {
                FileAnalyzer analyzer = new FileAnalyzer(stream, listener, null, true, filename);
                analyzer.Analyze();

                Assert.AreEqual(1, listener.Metrics.Count);

                Assert.IsNotNull(IntegrationTests.GetByName(listener.Metrics, "Foo"));
            }
        }
All Usage Examples Of CCMTests.IntegrationTests::GetByName