本文整理汇总了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
}
示例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
}
示例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
}
示例4: InitializeWithNullSpecificationWillThrow
public void InitializeWithNullSpecificationWillThrow()
{
// Fixture setup
var dummyBuilder = new DelegatingSpecimenBuilder();
// Exercise system and verify outcome
Assert.Throws<ArgumentNullException>(() => new FilteringSpecimenBuilder(dummyBuilder, null));
// Teardown
}
示例5: ConstructorThrowsOnNullComparer
public void ConstructorThrowsOnNullComparer()
{
// Fixture setup
var dummy = new DelegatingSpecimenBuilder();
// Exercise system and verify outcome
Assert.Throws<ArgumentNullException>(() =>
new OmitOnRecursionGuard(dummy, null));
// Teardown
}
示例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
}
示例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
}
示例8: InitializeGreedyCtorWithNullSpecificationThrows
public void InitializeGreedyCtorWithNullSpecificationThrows()
{
// Fixture setup
var dummyBuilder = new DelegatingSpecimenBuilder();
// Exercise system and verify outcome
Assert.Throws<ArgumentNullException>(() =>
new NoSpecimenOutputGuard(dummyBuilder, null));
// Teardown
}
示例9: InitializeWithNullTypeThrows
public void InitializeWithNullTypeThrows()
{
// Fixture setup
var dummyBuilder = new DelegatingSpecimenBuilder();
// Exercise system and verify outcome
Assert.Throws<ArgumentNullException>(() =>
new TypedBuilderComposer(null, dummyBuilder));
// Teardown
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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
}