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


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

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


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

示例1: Roslyn_DynamicIEnumerable

        public void Roslyn_DynamicIEnumerable()
        {
            RunTestHelper(service =>
            {
                const string template = @"@Enumerable.Count(Model.Data)";
                const string expected = "3";
                var anonArray = new[] { new { InnerData = 1 }, new { InnerData = 2 }, new { InnerData = 3 } };
                var model = new { Data = anonArray.Select(a => a) };
                string result = service.RunCompile(template, "test", null, model, null);

                Assert.That(result == expected, "Result does not match expected: " + result);
            });
        }
开发者ID:MatthewSJones,项目名称:RazorEngine,代码行数:13,代码来源:RoslynCompilerTestFixture.cs

示例2: AddManyUnrelatedElements

		public void AddManyUnrelatedElements()
		{
			// Arrange
			var sut = new OrderedRangedSet<int>();
			int[] arr = new [] { 1234, 123, 456, 5678, 789 };

			// Act
			foreach(int v in arr)
				sut.Add(v);

			// Assert
			Assert.That(sut.IsEmpty, Is.False);
			Assert.That(sut.Count, Is.EqualTo(arr.Length));
			Assert.That(sut, Is.EquivalentTo(arr.OrderBy(i => i)));
			foreach(int v in arr)
				Assert.That(sut.Contains(v), Is.True);
			Assert.That(sut.GetRanges(), Is.EquivalentTo(arr.Select(i => new Interval<int>(i, i + 1))));
		}
开发者ID:Virtlink,项目名称:noofax,代码行数:18,代码来源:OrderedRangedSetTests.cs

示例3: AddManyUnrelatedElements

		public void AddManyUnrelatedElements()
		{
			// Arrange
			var sut = new CodePointSet();
			var arr = new [] { new CodePoint(1234), new CodePoint(123), new CodePoint(456), new CodePoint(5678), new CodePoint(789) };

			// Act
			foreach(var v in arr)
				sut.Add(v);

			// Assert
			Assert.That(sut.IsEmpty, Is.False);
			Assert.That(sut.Count, Is.EqualTo(arr.Length));
			Assert.That(sut, Is.EquivalentTo(arr.OrderBy(i => i)));
			foreach(var v in arr)
				Assert.That(sut.Contains(v), Is.True);
			Assert.That(sut.GetRanges(), Is.EquivalentTo(arr.Select(i => new CodePointRange(i, i))));
		}
开发者ID:Virtlink,项目名称:noofax,代码行数:18,代码来源:CodePointSetTests.cs

示例4: Roslyn_AnonymousTypeWithinTemplate

        public void Roslyn_AnonymousTypeWithinTemplate()
        {
            RunTestHelper(service =>
            {
                const string template_child = "@Enumerable.Count(Model.Data)";
                const string template_parent = @"@Include(""Child"", new { Data = Model.Data})";
                const string expected = "3";
                service.Compile(template_child, "Child", null);
                var anonArray = new[] { new { InnerData = 1 }, new { InnerData = 2 }, new { InnerData = 3 } };
                var model = new { Data = anonArray.Select(a => a) };
                string result = service.RunCompile(template_parent, "test", null, model, null);

                Assert.That(result == expected, "Result does not match expected: " + result);
            });
        }
开发者ID:MatthewSJones,项目名称:RazorEngine,代码行数:15,代码来源:RoslynCompilerTestFixture.cs


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