本文整理汇总了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 );
}
示例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 );
}
示例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));
}