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


C# Specification.Or方法代码示例

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


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

示例1: OrShouldNotAllowNull

 public void OrShouldNotAllowNull()
 {
     // arrange
     ISpecification<string> other = null;
     var target = new Specification<string>( s => true );
     
     // act
     var ex = Assert.Throws<ArgumentNullException>( () => target.Or( other ) );
     
     // assert
     Assert.Equal( "other", ex.ParamName );
 }
开发者ID:WaffleSquirrel,项目名称:More,代码行数:12,代码来源:SpecificationTTest.cs

示例2: It_should_return_zero_entities_not_matching_all_OrSpecification

        public void It_should_return_zero_entities_not_matching_all_OrSpecification()
        {
            //	ARRANGE
            var repository = Fixture.CreateRepository();
            var nonExistingAge = -999;
            var nonExistingLastName = "Jellybean";

            //	ACT
            var over30Match = new Specification<Customer>(p => p.Age == nonExistingAge);
            var lastNameMatch = new Specification<Customer>(p => p.LastName == nonExistingLastName);
            var entities = repository.FindAll<Customer>(over30Match.Or(lastNameMatch)).ToList();

            //	ASSERT
            Assert.AreEqual(0, entities.Count);
        }
开发者ID:ptran123,项目名称:Conceptual,代码行数:15,代码来源:When_using_specification_chaining_with_OrMethod_noMatch.cs

示例3: It_should_return_entities_matching_any_OrSpecification

        public void It_should_return_entities_matching_any_OrSpecification()
        {
            //	ARRANGE
            var repository = Fixture.CreateRepository();
            var existingAge = 40;
            var nonExistingLastName = "Jellybean";

            //	ACT
            var over30Match = new Specification<Customer>(p => p.Age > existingAge);
            var lastNameMatch = new Specification<Customer>(p => p.LastName == nonExistingLastName);
            var entities = repository.FindAll<Customer>(over30Match.Or(lastNameMatch)).ToList();

            //	ASSERT
            Assert.AreEqual(2, entities.Count);
            Assert.AreEqual("Peter Tran", entities[0].GetFullName());
            Assert.AreEqual("Wally Nguyen", entities[1].GetFullName());
        }
开发者ID:ptran123,项目名称:Conceptual,代码行数:17,代码来源:When_using_specification_chaining_with_OrMethod_match.cs

示例4: OrShouldReturnCombinedSpecification

        public void OrShouldReturnCombinedSpecification()
        {
            // arrange
            var s1 = new Specification<string>( s => true );
            var s2 = new Specification<string>( s => false );
            
            // act
            var actual = s1.Or( s2 );

            // assert
            Assert.NotNull( actual );
        }
开发者ID:WaffleSquirrel,项目名称:More,代码行数:12,代码来源:SpecificationTTest.cs

示例5: Should_return_itself_on_adding_or_operator_when_other_specification_is_null

 public void Should_return_itself_on_adding_or_operator_when_other_specification_is_null()
 {
     var expected = new Specification<string>(s => s.Contains("a"));
     var target = expected.Or(null);
     Assert.That(target, Is.SameAs(expected));
 }
开发者ID:marektihkan,项目名称:Arc,代码行数:6,代码来源:SpecificationTests.cs


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