當前位置: 首頁>>代碼示例>>C#>>正文


C# MockRepository.CreateSpecificationMock方法代碼示例

本文整理匯總了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


注:本文中的Moq.MockRepository.CreateSpecificationMock方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。