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


C# Kernel.DelegatingSpecimenBuilder類代碼示例

本文整理匯總了C#中Ploeh.AutoFixtureUnitTest.Kernel.DelegatingSpecimenBuilder的典型用法代碼示例。如果您正苦於以下問題:C# DelegatingSpecimenBuilder類的具體用法?C# DelegatingSpecimenBuilder怎麽用?C# DelegatingSpecimenBuilder使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


DelegatingSpecimenBuilder類屬於Ploeh.AutoFixtureUnitTest.Kernel命名空間,在下文中一共展示了DelegatingSpecimenBuilder類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: ComposeReturnsCorrectResult

        public void ComposeReturnsCorrectResult()
        {
            // Fixture setup
            var targetType = typeof(string);
            var factory = new DelegatingSpecimenBuilder();
            var sut = new TypedBuilderComposer(targetType, factory);
            // Exercise system
            var result = sut.Compose();
            // Verify outcome
            var filter = Assert.IsAssignableFrom<FilteringSpecimenBuilder>(result);

            var orSpec = Assert.IsAssignableFrom<OrRequestSpecification>(filter.Specification);
            Assert.Equal(targetType, orSpec.Specifications.OfType<SeedRequestSpecification>().Single().TargetType);
            Assert.Equal(targetType, orSpec.Specifications.OfType<ExactTypeSpecification>().Single().TargetType);

            var composite = Assert.IsAssignableFrom<CompositeSpecimenBuilder>(filter.Builder);
            var outputGuard = Assert.IsAssignableFrom<NoSpecimenOutputGuard>(composite.Builders.First());
            Assert.IsAssignableFrom<SeedIgnoringRelay>(composite.Builders.Last());

            Assert.Equal(factory, outputGuard.Builder);

            var inverseSpec = Assert.IsAssignableFrom<InverseRequestSpecification>(outputGuard.Specification);
            var seedSpec = Assert.IsAssignableFrom<SeedRequestSpecification>(inverseSpec.Specification);
            Assert.Equal(targetType, seedSpec.TargetType);
            // Teardown
        }
開發者ID:rajeshgupthar,項目名稱:AutoFixture,代碼行數:26,代碼來源:TypedBuilderComposerTest.cs

示例2: CreateTypedNodeReturnsCorrectResult

        public void CreateTypedNodeReturnsCorrectResult(Type targetType)
        {
            // Fixture setup
            var factory = new DelegatingSpecimenBuilder();
            // Exercise system
            FilteringSpecimenBuilder actual =
                SpecimenBuilderNodeFactory.CreateTypedNode(
                    targetType,
                    factory);
            // Verify outcome
            var expected = new FilteringSpecimenBuilder(
                new CompositeSpecimenBuilder(
                    new NoSpecimenOutputGuard(
                        factory,
                        new InverseRequestSpecification(
                            new SeedRequestSpecification(
                                targetType))),
                    new SeedIgnoringRelay()),
                new OrRequestSpecification(
                    new SeedRequestSpecification(targetType),
                    new ExactTypeSpecification(targetType)));

            Assert.True(expected.GraphEquals(actual, new NodeComparer()));
            // Teardown
        }
開發者ID:RyanLiu99,項目名稱:AutoFixture,代碼行數:25,代碼來源:SpecimenBuilderNodeFactoryTests.cs

示例3: InitializeDoubleActionWithNullActionThrows

 public void InitializeDoubleActionWithNullActionThrows()
 {
     // Fixture setup
     var dummyBuilder = new DelegatingSpecimenBuilder();
     // Exercise system and verify outcome
     Assert.Throws<ArgumentNullException>(() => new Postprocessor<string>(dummyBuilder, (Action<string, ISpecimenContext>)null));
     // Teardown
 }
開發者ID:RyanLiu99,項目名稱:AutoFixture,代碼行數:8,代碼來源:PostprocessorGenericTest.cs

示例4: InitializeWithNullSpecificationWillThrow

 public void InitializeWithNullSpecificationWillThrow()
 {
     // Fixture setup
     var dummyBuilder = new DelegatingSpecimenBuilder();
     // Exercise system and verify outcome
     Assert.Throws<ArgumentNullException>(() => new FilteringSpecimenBuilder(dummyBuilder, null));
     // Teardown
 }
開發者ID:RyanLiu99,項目名稱:AutoFixture,代碼行數:8,代碼來源:FilteringSpecimenBuilderTest.cs

示例5: ConstructorThrowsOnNullComparer

 public void ConstructorThrowsOnNullComparer()
 {
     // Fixture setup
     var dummy = new DelegatingSpecimenBuilder();
     // Exercise system and verify outcome
     Assert.Throws<ArgumentNullException>(() =>
         new OmitOnRecursionGuard(dummy, null));
     // Teardown
 }
開發者ID:rajeshgupthar,項目名稱:AutoFixture,代碼行數:9,代碼來源:OmitOnRecursionGuardTest.cs

示例6: InitializeWithNullSpecificationThrows

 public void InitializeWithNullSpecificationThrows()
 {
     // Fixture setup
     var dummyBuilder = new DelegatingSpecimenBuilder();
     Action<object, ISpecimenContext> dummyAction = (s, c) => { };
     // Exercise system and verify outcome
     Assert.Throws<ArgumentNullException>(() => new Postprocessor(dummyBuilder, dummyAction, null));
     // Teardown
 }
開發者ID:rajeshgupthar,項目名稱:AutoFixture,代碼行數:9,代碼來源:PostprocessorTest.cs

示例7: SutCanBeInitializedWithDoubleAction

 public void SutCanBeInitializedWithDoubleAction()
 {
     // Fixture setup
     var dummyBuilder = new DelegatingSpecimenBuilder();
     Action<object, ISpecimenContext> dummyAction = (s, c) => { };
     // Exercise system and verify outcome
     Assert.DoesNotThrow(() => new Postprocessor(dummyBuilder, dummyAction));
     // Teardown
 }
開發者ID:rajeshgupthar,項目名稱:AutoFixture,代碼行數:9,代碼來源:PostprocessorTest.cs

示例8: InitializeGreedyCtorWithNullSpecificationThrows

 public void InitializeGreedyCtorWithNullSpecificationThrows()
 {
     // Fixture setup
     var dummyBuilder = new DelegatingSpecimenBuilder();
     // Exercise system and verify outcome
     Assert.Throws<ArgumentNullException>(() =>
         new NoSpecimenOutputGuard(dummyBuilder, null));
     // Teardown
 }
開發者ID:rajeshgupthar,項目名稱:AutoFixture,代碼行數:9,代碼來源:NoSpecimenOutputGuardTest.cs

示例9: InitializeWithNullTypeThrows

 public void InitializeWithNullTypeThrows()
 {
     // Fixture setup
     var dummyBuilder = new DelegatingSpecimenBuilder();
     // Exercise system and verify outcome
     Assert.Throws<ArgumentNullException>(() =>
         new TypedBuilderComposer(null, dummyBuilder));
     // Teardown
 }
開發者ID:rajeshgupthar,項目名稱:AutoFixture,代碼行數:9,代碼來源:TypedBuilderComposerTest.cs

示例10: SutIsSpecimenBuilder

 public void SutIsSpecimenBuilder()
 {
     // Fixture setup
     var dummyBuilder = new DelegatingSpecimenBuilder();
     // Exercise system
     var sut = new DisposableTracker(dummyBuilder);
     // Verify outcome
     Assert.IsAssignableFrom<ISpecimenBuilder>(sut);
     // Teardown
 }
開發者ID:rajeshgupthar,項目名稱:AutoFixture,代碼行數:10,代碼來源:DisposableTrackerTest.cs

示例11: SutIsRecursionGuard

 public void SutIsRecursionGuard()
 {
     // Fixture setup
     // Exercise system
     var dummy = new DelegatingSpecimenBuilder();
     var sut = new OmitOnRecursionGuard(dummy);
     // Verify outcome
     Assert.IsAssignableFrom<RecursionGuard>(sut);
     // Teardown
 }
開發者ID:rajeshgupthar,項目名稱:AutoFixture,代碼行數:10,代碼來源:OmitOnRecursionGuardTest.cs

示例12: SutIsSpecimenBuilderComposer

 public void SutIsSpecimenBuilderComposer()
 {
     // Fixture setup
     var dummyType = typeof(object);
     var dummyBuilder = new DelegatingSpecimenBuilder();
     // Exercise system
     var sut = new TypedBuilderComposer(dummyType, dummyBuilder);
     // Verify outcome
     Assert.IsAssignableFrom<ISpecimenBuilderComposer>(sut);
     // Teardown
 }
開發者ID:rajeshgupthar,項目名稱:AutoFixture,代碼行數:11,代碼來源:TypedBuilderComposerTest.cs

示例13: SutIsSpecimenBuilder

 public void SutIsSpecimenBuilder()
 {
     // Fixture setup
     var dummySpecification = new DelegatingRequestSpecification();
     var dummyBuilder = new DelegatingSpecimenBuilder();
     // Exercise system
     var sut = new FilteringSpecimenBuilder(dummyBuilder, dummySpecification);
     // Verify outcome
     Assert.IsAssignableFrom<ISpecimenBuilder>(sut);
     // Teardown
 }
開發者ID:RyanLiu99,項目名稱:AutoFixture,代碼行數:11,代碼來源:FilteringSpecimenBuilderTest.cs

示例14: SutIsNode

 public void SutIsNode()
 {
     // Fixture setup
     var dummyBuilder = new DelegatingSpecimenBuilder();
     var dummyCommand = new DelegatingSpecimenCommand();
     // Exercise system
     var sut = new Postprocessor<Version>(dummyBuilder, dummyCommand);
     // Verify outcome
     Assert.IsAssignableFrom<ISpecimenBuilderNode>(sut);
     // Teardown
 }
開發者ID:RyanLiu99,項目名稱:AutoFixture,代碼行數:11,代碼來源:PostprocessorGenericTest.cs

示例15: SutIsSpecimenBuilder

 public void SutIsSpecimenBuilder()
 {
     // Fixture setup
     var dummyBuilder = new DelegatingSpecimenBuilder();
     Action<object> dummyAction = s => { };
     // Exercise system
     var sut = new Postprocessor(dummyBuilder, dummyAction);
     // Verify outcome
     Assert.IsAssignableFrom<ISpecimenBuilder>(sut);
     // Teardown
 }
開發者ID:rajeshgupthar,項目名稱:AutoFixture,代碼行數:11,代碼來源:PostprocessorTest.cs


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