本文整理汇总了C#中Moq.MockRepository.CreateSpecificationMock方法的典型用法代码示例。如果您正苦于以下问题:C# MockRepository.CreateSpecificationMock方法的具体用法?C# MockRepository.CreateSpecificationMock怎么用?C# MockRepository.CreateSpecificationMock使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Moq.MockRepository
的用法示例。
在下文中一共展示了MockRepository.CreateSpecificationMock方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SpecificationExtensions_Or_OrSpecificationProduced
public void SpecificationExtensions_Or_OrSpecificationProduced()
{
var mockRepository = new MockRepository(MockBehavior.Strict);
var specification1 = mockRepository.CreateSpecificationMock<string>();
var specification2 = mockRepository.CreateSpecificationMock<string>();
var orSpecification = specification1.Or(specification2) as OrSpecification<string>;
Assert.IsNotNull(orSpecification);
Assert.AreEqual(specification1, orSpecification.LeftSpecification);
Assert.AreEqual(specification2, orSpecification.RightSpecification);
}
开发者ID:aescharfenberg,项目名称:neverminddreams-patterns-specification,代码行数:10,代码来源:SpecificationExtensionsTests.cs
示例2: AssertIsSatisfiedBy
private void AssertIsSatisfiedBy(bool leftSpecificationIsSatisfiedBy, bool rightSpecificationIsSatisfiedBy,
bool expected)
{
var mockRepository = new MockRepository(MockBehavior.Strict);
var leftSpecification = mockRepository.CreateSpecificationMock<string>(leftSpecificationIsSatisfiedBy);
var rightSpecification = leftSpecificationIsSatisfiedBy
? mockRepository.CreateSpecificationMock<string>()
: mockRepository.CreateSpecificationMock<string>(rightSpecificationIsSatisfiedBy);
var specification = new OrSpecification<string>(leftSpecification, rightSpecification);
Assert.AreEqual(expected, specification.IsSatisfiedBy("test"));
mockRepository.VerifyAll();
}
开发者ID:aescharfenberg,项目名称:neverminddreams-patterns-specification,代码行数:12,代码来源:OrSpecificationTests.cs
示例3: OrSpecification_Constructor_RightSpecificationNull_Exception
public void OrSpecification_Constructor_RightSpecificationNull_Exception()
{
var mockRepository = new MockRepository(MockBehavior.Strict);
var specification = mockRepository.CreateSpecificationMock<string>();
// ReSharper disable ObjectCreationAsStatement
new OrSpecification<string>(specification, null);
// ReSharper restore ObjectCreationAsStatement
}
开发者ID:aescharfenberg,项目名称:neverminddreams-patterns-specification,代码行数:8,代码来源:OrSpecificationTests.cs
示例4: NotSpecification_IsSatisfiedBy_SpecificationTrue_False
public void NotSpecification_IsSatisfiedBy_SpecificationTrue_False()
{
var mockRepository = new MockRepository(MockBehavior.Strict);
var singleSpecification = mockRepository.CreateSpecificationMock<string>(true);
var specification = new NotSpecification<string>(singleSpecification);
Assert.AreEqual(false, specification.IsSatisfiedBy("test"));
mockRepository.VerifyAll();
}
开发者ID:aescharfenberg,项目名称:neverminddreams-patterns-specification,代码行数:8,代码来源:NotSpecificationTests.cs
示例5: SpecificationExtensions_Not_NotSpecificationProduced
public void SpecificationExtensions_Not_NotSpecificationProduced()
{
var mockRepository = new MockRepository(MockBehavior.Strict);
var specification = mockRepository.CreateSpecificationMock<string>();
var notSpecification = specification.Not() as NotSpecification<string>;
Assert.IsNotNull(notSpecification);
Assert.AreEqual(specification, notSpecification.Specification);
}
开发者ID:aescharfenberg,项目名称:neverminddreams-patterns-specification,代码行数:8,代码来源:SpecificationExtensionsTests.cs