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


C# Kernel.CompositeSpecimenBuilder类代码示例

本文整理汇总了C#中Ploeh.AutoFixture.Kernel.CompositeSpecimenBuilder的典型用法代码示例。如果您正苦于以下问题:C# CompositeSpecimenBuilder类的具体用法?C# CompositeSpecimenBuilder怎么用?C# CompositeSpecimenBuilder使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


CompositeSpecimenBuilder类属于Ploeh.AutoFixture.Kernel命名空间,在下文中一共展示了CompositeSpecimenBuilder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CombineExplictPropertyWithAutoProperties

        public void CombineExplictPropertyWithAutoProperties()
        {
            // Fixture setup
            var expectedText = "Fnaah";

            var specifiedCommand = new BindingCommand<DoublePropertyHolder<string, int>, string>(ph => ph.Property1, expectedText);
            var reservedProperty = new InverseRequestSpecification(specifiedCommand);

            var customizedBuilder = new Postprocessor<DoublePropertyHolder<string, int>>(
                new Postprocessor<DoublePropertyHolder<string, int>>(
                    new MethodInvoker(new ModestConstructorQuery()),
                    specifiedCommand),
                new AutoPropertiesCommand<DoublePropertyHolder<string, int>>(reservedProperty),
                new AnyTypeSpecification());

            var builder = new CompositeSpecimenBuilder(
                customizedBuilder,
                Scenario.CreateAutoPropertyBuilder());
            var container = new SpecimenContext(builder);
            // Exercise system
            var result = container.Resolve(typeof(DoublePropertyHolder<string, int>));
            // Verify outcome
            var actual = Assert.IsAssignableFrom<DoublePropertyHolder<string, int>>(result);
            Assert.Equal(expectedText, actual.Property1);
            Assert.Equal(1, actual.Property2);
            // Teardown
        }
开发者ID:nandhakumaran,项目名称:AutoFixture,代码行数:27,代码来源:Scenario.cs

示例2: SutIsNode

 public void SutIsNode()
 {
     // Fixture setup
     // Exercise system
     var sut = new CompositeSpecimenBuilder();
     // Verify outcome
     Assert.IsAssignableFrom<ISpecimenBuilderNode>(sut);
     // Teardown
 }
开发者ID:RyanLiu99,项目名称:AutoFixture,代码行数:9,代码来源:CompositeSpecimenBuilderTest.cs

示例3: SutIsSequenceOfSpecimenBuilders

 public void SutIsSequenceOfSpecimenBuilders()
 {
     // Fixture setup
     // Exercise system
     var sut = new CompositeSpecimenBuilder();
     // Verify outcome
     Assert.IsAssignableFrom<IEnumerable<ISpecimenBuilder>>(sut);
     // Teardown
 }
开发者ID:RyanLiu99,项目名称:AutoFixture,代码行数:9,代码来源:CompositeSpecimenBuilderTest.cs

示例4: SutIsSpecimenBuilder

 public void SutIsSpecimenBuilder()
 {
     // Fixture setup
     // Exercise system
     var sut = new CompositeSpecimenBuilder();
     // Verify outcome
     Assert.IsInstanceOfType(sut, typeof(ISpecimenBuilder));
     // Teardown
 }
开发者ID:RyanLiu99,项目名称:AutoFixture,代码行数:9,代码来源:CompositeSpecimenBuilderTest.cs

示例5: SutIsComposer

 public void SutIsComposer()
 {
     // Fixture setup
     var dummyNode = new CompositeSpecimenBuilder();
     // Exercise system
     var sut = new CompositeNodeComposer<object>(dummyNode);
     // Verify outcome
     Assert.IsAssignableFrom<ICustomizationComposer<object>>(sut);
     // Teardown
 }
开发者ID:jpierson,项目名称:AutoFixture,代码行数:10,代码来源:CompositeNodeComposerTests.cs

示例6: BuildersWillNotBeNullWhenSutIsCreatedWithDefaultConstructor

 public void BuildersWillNotBeNullWhenSutIsCreatedWithDefaultConstructor()
 {
     // Fixture setup
     var sut = new CompositeSpecimenBuilder();
     // Exercise system
     IEnumerable<ISpecimenBuilder> result = sut.Builders;
     // Verify outcome
     Assert.NotNull(result);
     // Teardown
 }
开发者ID:RyanLiu99,项目名称:AutoFixture,代码行数:10,代码来源:CompositeSpecimenBuilderTest.cs

示例7: SutIsEventArgs

 public void SutIsEventArgs()
 {
     // Fixture setup
     var dummyNode = new CompositeSpecimenBuilder();
     // Exercise system
     var sut = new SpecimenBuilderNodeEventArgs(dummyNode);
     // Verify outcome
     Assert.IsAssignableFrom<EventArgs>(sut);
     // Teardown
 }
开发者ID:RyanLiu99,项目名称:AutoFixture,代码行数:10,代码来源:SpecimenBuilderNodeEventArgsTest.cs

示例8: GraphIsCorrect

 public void GraphIsCorrect()
 {
     // Fixture setup
     var expected = new CompositeSpecimenBuilder();
     var sut = new SpecimenBuilderNodeEventArgs(expected);
     // Exercise system
     ISpecimenBuilderNode actual = sut.Graph;
     // Verify outcome
     Assert.Equal(expected, actual);
     // Teardown
 }
开发者ID:RyanLiu99,项目名称:AutoFixture,代码行数:11,代码来源:SpecimenBuilderNodeEventArgsTest.cs

示例9: BuildersWillNotBeNullWhenSutIsCreatedWithDefaultConstructor

        public void BuildersWillNotBeNullWhenSutIsCreatedWithDefaultConstructor()
        {
            // Fixture setup
            var sut = new CompositeSpecimenBuilder();
            // Exercise system
#pragma warning disable 618
            IList<ISpecimenBuilder> result = sut.Builders;
#pragma warning restore 618
            // Verify outcome
            Assert.NotNull(result);
            // Teardown
        }
开发者ID:ptrelford,项目名称:AutoFixture,代码行数:12,代码来源:CompositeSpecimenBuilderTest.cs

示例10: ComposeSingleNodeReturnsCorrectResult

 public void ComposeSingleNodeReturnsCorrectResult()
 {            
     // Fixture setup
     var dummyNode = new CompositeSpecimenBuilder();
     var sut = new CompositeNodeComposer<uint>(dummyNode);
     ISpecimenBuilderNode expected = new CompositeSpecimenBuilder();
     // Exercise system
     var actual = sut.Compose(new[] { expected });
     // Verify outcome
     var c =
         Assert.IsAssignableFrom<CompositeNodeComposer<uint>>(actual);
     Assert.Equal(expected, c.Node);
     // Teardown
 }
开发者ID:jpierson,项目名称:AutoFixture,代码行数:14,代码来源:CompositeNodeComposerTests.cs

示例11: ComposeWithAutoProperties

 public void ComposeWithAutoProperties()
 {
     // Fixture setup
     var customBuilder = SpecimenBuilderNodeFactory.CreateComposer<DoublePropertyHolder<int, int>>()
         .WithAutoProperties();
     var builder = new CompositeSpecimenBuilder(
         customBuilder,
         Scenario.CreateCoreBuilder());
     // Exercise system
     var result = new SpecimenContext(builder).CreateAnonymous<DoublePropertyHolder<int, int>>();
     // Verify outcome
     Assert.Equal(1, result.Property1);
     Assert.Equal(2, result.Property2);
     // Teardown
 }
开发者ID:nandhakumaran,项目名称:AutoFixture,代码行数:15,代码来源:Scenario.cs

示例12: BuildersWillMatchParamsArray

 public void BuildersWillMatchParamsArray()
 {
     // Fixture setup
     var expectedBuilders = new ISpecimenBuilder[]
     {
         new DelegatingSpecimenBuilder(),
         new DelegatingSpecimenBuilder(),
         new DelegatingSpecimenBuilder()
     };
     var sut = new CompositeSpecimenBuilder(expectedBuilders[0], expectedBuilders[1], expectedBuilders[2]);
     // Exercise system
     var result = sut.Builders;
     // Verify outcome
     Assert.True(expectedBuilders.SequenceEqual(result), "Builders");
     // Teardown
 }
开发者ID:rajeshgupthar,项目名称:AutoFixture,代码行数:16,代码来源:CompositeSpecimenBuilderTest.cs

示例13: BuildersWillMatchListParameter

 public void BuildersWillMatchListParameter()
 {
     // Fixture setup
     var expectedBuilders = new ISpecimenBuilder[]
     {
         new DelegatingSpecimenBuilder(),
         new DelegatingSpecimenBuilder(),
         new DelegatingSpecimenBuilder()
     }.AsEnumerable();
     var sut = new CompositeSpecimenBuilder(expectedBuilders);
     // Exercise system
     var result = sut.Builders;
     // Verify outcome
     Assert.True(expectedBuilders.SequenceEqual(result), "Builders");
     // Teardown
 }
开发者ID:RyanLiu99,项目名称:AutoFixture,代码行数:16,代码来源:CompositeSpecimenBuilderTest.cs

示例14: ComposeReturnsCorrectResult

 public void ComposeReturnsCorrectResult()
 {
     // Fixture setup
     var dummyNode = new CompositeSpecimenBuilder();
     var sut = new CompositeNodeComposer<uint>(dummyNode);
     // Exercise system
     var expectedBuilders = new[]
     {
         new DelegatingSpecimenBuilder(),
         new DelegatingSpecimenBuilder(),
         new DelegatingSpecimenBuilder()
     };
     var actual = sut.Compose(expectedBuilders);
     // Verify outcome
     var c =
         Assert.IsAssignableFrom<CompositeNodeComposer<uint>>(actual);
     var composite = 
         Assert.IsAssignableFrom<CompositeSpecimenBuilder>(c.Node);
     Assert.True(expectedBuilders.SequenceEqual(composite));
     // Teardown
 }
开发者ID:jpierson,项目名称:AutoFixture,代码行数:21,代码来源:CompositeNodeComposerTests.cs

示例15: ComposeComplexObjectWithAutoPropertiesAndSomeCustomizations

 public void ComposeComplexObjectWithAutoPropertiesAndSomeCustomizations()
 {
     // Fixture setup
     var builder = new CompositeSpecimenBuilder(
         SpecimenBuilderNodeFactory.CreateComposer<DoublePropertyHolder<long, long>>()
             .With(x => x.Property2, 43)
             .WithAutoProperties(),
         SpecimenBuilderNodeFactory.CreateComposer<DoublePropertyHolder<int, string>>()
             .OmitAutoProperties()
             .With(x => x.Property1),
         SpecimenBuilderNodeFactory.CreateComposer<DoublePropertyHolder<DoublePropertyHolder<long, long>, DoublePropertyHolder<int, string>>>()
             .WithAutoProperties(),
         Scenario.CreateCoreBuilder());
     // Exercise system
     var result = new SpecimenContext(builder).CreateAnonymous<DoublePropertyHolder<DoublePropertyHolder<long, long>, DoublePropertyHolder<int, string>>>();
     // Verify outcome
     Assert.Equal(1, result.Property1.Property1);
     Assert.Equal(43, result.Property1.Property2);
     Assert.Equal(1, result.Property2.Property1);
     Assert.Null(result.Property2.Property2);
     // Teardown
 }
开发者ID:nandhakumaran,项目名称:AutoFixture,代码行数:22,代码来源:Scenario.cs


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