當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。