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


C# CompositeSpecimenBuilder.Create方法代码示例

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


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

示例1: CreateWillInvokeBuilderWithCorrectContainer

        public void CreateWillInvokeBuilderWithCorrectContainer()
        {
            // Fixture setup
            var expectedContainer = new DelegatingSpecimenContext();

            var mockVerified = false;
            var builderMock = new DelegatingSpecimenBuilder();
            builderMock.OnCreate = (r, c) =>
                {
                    Assert.Equal(expectedContainer, c);
                    mockVerified = true;
                    return new object();
                };

            var sut = new CompositeSpecimenBuilder(builderMock);
            // Exercise system
            var dummyRequest = new object();
            sut.Create(dummyRequest, expectedContainer);
            // Verify outcome
            Assert.True(mockVerified, "Mock verification");
            // Teardown
        }
开发者ID:RyanLiu99,项目名称:AutoFixture,代码行数:22,代码来源:CompositeSpecimenBuilderTest.cs

示例2: CreateWillReturnFirstSpecimenResultFromBuilders

 public void CreateWillReturnFirstSpecimenResultFromBuilders()
 {
     // Fixture setup
     var expectedResult = new object();
     var builders = new ISpecimenBuilder[]
     {
         new DelegatingSpecimenBuilder { OnCreate = (r, c) => new NoSpecimen() },
         new DelegatingSpecimenBuilder { OnCreate = (r, c) => expectedResult },
         new DelegatingSpecimenBuilder { OnCreate = (r, c) => new object() }
     };
     var sut = new CompositeSpecimenBuilder(builders);
     // Exercise system
     var anonymousRequest = new object();
     var dummyContainer = new DelegatingSpecimenContext();
     var result = sut.Create(anonymousRequest, dummyContainer);
     // Verify outcome
     Assert.Equal(expectedResult, result);
     // Teardown
 }
开发者ID:RyanLiu99,项目名称:AutoFixture,代码行数:19,代码来源:CompositeSpecimenBuilderTest.cs

示例3: CreateWillReturnNoSpecimenIfAllBuildersReturnNoSpecimen

        public void CreateWillReturnNoSpecimenIfAllBuildersReturnNoSpecimen()
        {
            // Fixture setup
            var builders = new ISpecimenBuilder[]
            {
                new DelegatingSpecimenBuilder { OnCreate = (r, c) => new NoSpecimen() },
                new DelegatingSpecimenBuilder { OnCreate = (r, c) => new NoSpecimen() },
                new DelegatingSpecimenBuilder { OnCreate = (r, c) => new NoSpecimen() }
            };
            var sut = new CompositeSpecimenBuilder(builders);
            // Exercise system
            var anonymousRequest = new object();
            var dummyContainer = new DelegatingSpecimenContext();
            var result = sut.Create(anonymousRequest, dummyContainer);
            // Verify outcome
#pragma warning disable 618
            var expected = new NoSpecimen(anonymousRequest);
#pragma warning restore 618
            Assert.Equal(expected, result);
            // Teardown
        }
开发者ID:RyanLiu99,项目名称:AutoFixture,代码行数:21,代码来源:CompositeSpecimenBuilderTest.cs

示例4: CreateWillReturnNullIfAllBuildersReturnNull

 public void CreateWillReturnNullIfAllBuildersReturnNull()
 {
     // Fixture setup
     var builders = new ISpecimenBuilder[]
     {
         new DelegatingSpecimenBuilder { OnCreate = (r, c) => null },
         new DelegatingSpecimenBuilder { OnCreate = (r, c) => null },
         new DelegatingSpecimenBuilder { OnCreate = (r, c) => null }
     };
     var sut = new CompositeSpecimenBuilder(builders);
     // Exercise system
     var anonymousRequest = new object();
     var dummyContainer = new DelegatingSpecimenContainer();
     var result = sut.Create(anonymousRequest, dummyContainer);
     // Verify outcome
     Assert.IsNull(result, "Create");
     // Teardown
 }
开发者ID:RyanLiu99,项目名称:AutoFixture,代码行数:18,代码来源:CompositeSpecimenBuilderTest.cs


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