本文整理汇总了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
}
示例2: SutIsNode
public void SutIsNode()
{
// Fixture setup
// Exercise system
var sut = new CompositeSpecimenBuilder();
// Verify outcome
Assert.IsAssignableFrom<ISpecimenBuilderNode>(sut);
// Teardown
}
示例3: SutIsSequenceOfSpecimenBuilders
public void SutIsSequenceOfSpecimenBuilders()
{
// Fixture setup
// Exercise system
var sut = new CompositeSpecimenBuilder();
// Verify outcome
Assert.IsAssignableFrom<IEnumerable<ISpecimenBuilder>>(sut);
// Teardown
}
示例4: SutIsSpecimenBuilder
public void SutIsSpecimenBuilder()
{
// Fixture setup
// Exercise system
var sut = new CompositeSpecimenBuilder();
// Verify outcome
Assert.IsInstanceOfType(sut, typeof(ISpecimenBuilder));
// Teardown
}
示例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
}
示例6: BuildersWillNotBeNullWhenSutIsCreatedWithDefaultConstructor
public void BuildersWillNotBeNullWhenSutIsCreatedWithDefaultConstructor()
{
// Fixture setup
var sut = new CompositeSpecimenBuilder();
// Exercise system
IEnumerable<ISpecimenBuilder> result = sut.Builders;
// Verify outcome
Assert.NotNull(result);
// Teardown
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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
}