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


C# NUnit.Framework.Count方法代码示例

本文整理汇总了C#中NUnit.Framework.Count方法的典型用法代码示例。如果您正苦于以下问题:C# NUnit.Framework.Count方法的具体用法?C# NUnit.Framework.Count怎么用?C# NUnit.Framework.Count使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在NUnit.Framework的用法示例。


在下文中一共展示了NUnit.Framework.Count方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TestConcurrentAccess

        public void TestConcurrentAccess() {
            var sourceFiles1 = new[]
                               {
                                   [email protected]"\xyzzy\Example.cs",
                                   [email protected]"\foo\bar\MissingFile.cs",
                                   [email protected]"\zork\Example.cs",
                                   [email protected]"\path\to\file\data.cpp",
                                   [email protected]"\path\to\file\data1.cpp",
                                   [email protected]"\path\to\file\data2.cpp",
                                   [email protected]"\path\to\file\data3.cpp",
                                   [email protected]"\path\to\file\data4.cpp",
                                   [email protected]"\path\to\file\data5.cpp",
                                   [email protected]"\path\to\file\data6.cpp",
                                   [email protected]"\path\to\file\data7.cpp",
                                   [email protected]"\path\to\file\data8.cpp",
                                   [email protected]"\path\to\file\data9.cpp",
                                   [email protected]"\path\to\file\data10.cpp",
                                   [email protected]"\path\to\file\data11.c"
                               };
            var sourceFiles2 = new[]
                               {
                                   [email protected]"\foo\bar\Example.cs",
                                   [email protected]"\path\to\file\data.cpp",
                                   [email protected]"\path\to\file\data1.cpp",
                                   [email protected]"\path\to\file\data2.cpp",
                                   [email protected]"\foo\bar\ImportantData.cpp",
                                   [email protected]"\path\to\file\data3.cpp",
                                   [email protected]"\path\to\file\data4.cpp",
                                   [email protected]"\path\to\file\data5.cpp",
                                   [email protected]"\path\to\file\data6.cpp",
                                   [email protected]"\path\to\file\data7.cpp",
                                   [email protected]"\path\to\file\data8.cpp",
                                   [email protected]"\path\to\file\data9.cpp",
                                   [email protected]"\other\dir\Sample.h",
                                   [email protected]"\path\to\file\data10.cpp",
                                   [email protected]"\path\to\file\data11.c"
                               };
            var xmlFiles = new[]
                           {
                               [email protected]"\mappingTest\Example.cs.1.xml",
                               [email protected]"\mappingTest\MissingFile.cs.1.xml",
                               [email protected]"\mappingTest\Example.cs.2.xml",
                               [email protected]"\mappingTest\data.cpp.1.xml",
                               [email protected]"\mappingTest\data1.cpp.1.xml",
                               [email protected]"\mappingTest\data2.cpp.1.xml",
                               [email protected]"\mappingTest\data3.cpp.1.xml",
                               [email protected]"\mappingTest\data4.cpp.1.xml",
                               [email protected]"\mappingTest\data5.cpp.1.xml",
                               [email protected]"\mappingTest\data6.cpp.1.xml",
                               [email protected]"\mappingTest\data7.cpp.1.xml",
                               [email protected]"\mappingTest\data8.cpp.1.xml",
                               [email protected]"\mappingTest\data9.cpp.1.xml",
                               [email protected]"\mappingTest\data10.cpp.1.xml",
                               [email protected]"\mappingTest\data11.c.1.xml",
                               [email protected]"\mappingTest\Example.cs.3.xml",
                               [email protected]"\mappingTest\ImportantData.cpp.1.xml",
                               [email protected]"\mappingTest\Sample.h.1.xml",
                           };

            var map = new SrcMLFileNameMapping("mappingTest");
            var worker = new Thread(() => ConcurrentWorker(map, sourceFiles2));
            worker.Start();
            foreach(var file in sourceFiles1) {
                map.GetTargetPath(file);
            }
            worker.Join(5000);
            map.SaveMapping();

            var obsSourceFiles = new HashSet<string>();
            var obsXmlFiles = new HashSet<string>();
            foreach(var entry in File.ReadAllLines("mappingTest\\mapping.txt")) {
                var fields = entry.Split('|');
                obsSourceFiles.Add(fields[0]);
                obsXmlFiles.Add(fields[1]);
            }
            var sourceFiles = sourceFiles1.Union(sourceFiles2);
            Assert.AreEqual(sourceFiles.Count(), obsSourceFiles.Count);
            Assert.AreEqual(xmlFiles.Count(), obsXmlFiles.Count);
            foreach(var file in obsSourceFiles) {
                Assert.IsTrue(sourceFiles.Contains(file));
            }
            foreach(var file in obsXmlFiles) {
                Assert.IsTrue(xmlFiles.Contains(file));
            }
        }
开发者ID:cnewman,项目名称:SrcML.NET,代码行数:85,代码来源:ShortFileNameMappingTests.cs


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