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


C# Specification.And方法代码示例

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


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

示例1: AndShouldNotAllowNull

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

示例2: AndShouldReturnCombinedSpecification

        public void AndShouldReturnCombinedSpecification()
        {
            // arrange
            var s1 = new Specification<string>( s => true );
            var s2 = new Specification<string>( s => false );

            // act
            var actual = s1.And( s2 );

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

示例3: It_should_return_zero_entities_not_matching_any_specifications

        public void It_should_return_zero_entities_not_matching_any_specifications()
        {
            //	ARRANGE
            var repository = Fixture.CreateRepository();
            var nonExistingAge = -999;
            var existingLastName = "Tran";

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

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

示例4: It_should_return_entities_matching_all_specifications

        public void It_should_return_entities_matching_all_specifications()
        {
            //	ARRANGE
            var repository = Fixture.CreateRepository();
            var existingAge = 40;
            var existingLastName = "Tran";

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

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

示例5: Should_return_itself_on_adding_and_operator_when_other_specification_is_null

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


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