本文整理汇总了C#中DelegatingSpecimenBuilder类的典型用法代码示例。如果您正苦于以下问题:C# DelegatingSpecimenBuilder类的具体用法?C# DelegatingSpecimenBuilder怎么用?C# DelegatingSpecimenBuilder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DelegatingSpecimenBuilder类属于命名空间,在下文中一共展示了DelegatingSpecimenBuilder类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: InitializeWithNullEqualityComparerThrows
public void InitializeWithNullEqualityComparerThrows()
{
// Fixture setup
var dummyBuilder = new DelegatingSpecimenBuilder();
// Exercise system and verify outcome
Assert.Throws<ArgumentNullException>(() => new DelegatingRecursionGuard(dummyBuilder, null));
// Teardown
}
开发者ID:robertlyson,项目名称:AutoFixture,代码行数:8,代码来源:RecursionGuardTest.cs
示例2: IndexOfReturnsCorrectResultWhenItemIsNotInNode
public void IndexOfReturnsCorrectResultWhenItemIsNotInNode()
{
// Fixture setup
var item = new DelegatingSpecimenBuilder();
// Exercise system
var actual = this.sut.IndexOf(item);
// Verify outcome
Assert.Equal(-1, actual);
// Teardown
}
开发者ID:ptrelford,项目名称:AutoFixture,代码行数:10,代码来源:SpecimenBuilderNodeAdapterCollectionTest.cs
示例3: SutIsNode
public void SutIsNode()
{
// Fixture setup
var dummyBuilder = new DelegatingSpecimenBuilder();
// Exercise system
var sut = new DelegatingRecursionGuard(dummyBuilder);
// Verify outcome
Assert.IsAssignableFrom<ISpecimenBuilderNode>(sut);
// Teardown
}
开发者ID:robertlyson,项目名称:AutoFixture,代码行数:10,代码来源:RecursionGuardTest.cs
示例4: TransformReturnsCorrectResult
public void TransformReturnsCorrectResult()
{
// Fixture setup
var sut = new ThrowingRecursionBehavior();
// Exercise system
var dummyBuilder = new DelegatingSpecimenBuilder();
var result = sut.Transform(dummyBuilder);
// Verify outcome
Assert.IsAssignableFrom<ThrowingRecursionGuard>(result);
// Teardown
}
开发者ID:rajeshgupthar,项目名称:AutoFixture,代码行数:11,代码来源:ThrowingRecursionBehaviorTest.cs
示例5: InsertsCorrectlyInsertsItem
public void InsertsCorrectlyInsertsItem(int expected)
{
// Fixture setup
var item = new DelegatingSpecimenBuilder();
// Exercise system
this.sut.Insert(expected, item);
// Verify outcome
var actual = this.sut.IndexOf(item);
Assert.Equal(expected, actual);
// Teardown
}
开发者ID:ptrelford,项目名称:AutoFixture,代码行数:11,代码来源:SpecimenBuilderNodeAdapterCollectionTest.cs
示例6: SutYieldsInjectedBuilder
public void SutYieldsInjectedBuilder()
{
// Fixture setup
var expected = new DelegatingSpecimenBuilder();
var sut = new DelegatingRecursionGuard(expected);
// Exercise system
// Verify outcome
Assert.Equal(expected, sut.Single());
Assert.Equal(expected, ((System.Collections.IEnumerable)sut).Cast<object>().Single());
// Teardown
}
开发者ID:robertlyson,项目名称:AutoFixture,代码行数:11,代码来源:RecursionGuardTest.cs
示例7: AddAddsItemToEndOfNode
public void AddAddsItemToEndOfNode()
{
// Fixture setup
var item = new DelegatingSpecimenBuilder();
var expected = this.FindMarkedNode().Concat(new[] { item });
// Exercise system
this.sut.Add(item);
// Verify outcome
Assert.True(expected.SequenceEqual(this.sut));
// Teardown
}
开发者ID:dhilgarth,项目名称:AutoFixture,代码行数:11,代码来源:SpecimenBuilderNodeAdapterCollectionTest.cs
示例8: TransformResultCorrectlyDecoratesInput
public void TransformResultCorrectlyDecoratesInput()
{
// Fixture setup
var sut = new OmitOnRecursionBehavior();
var expectedBuilder = new DelegatingSpecimenBuilder();
// Exercise system
var result = sut.Transform(expectedBuilder);
// Verify outcome
var guard = Assert.IsAssignableFrom<RecursionGuard>(result);
Assert.Equal(expectedBuilder, guard.Builder);
// Teardown
}
开发者ID:nrjohnstone,项目名称:AutoFixture,代码行数:12,代码来源:OmitOnRecursionBehaviorTest.cs
示例9: TransformReturnsCorrectResult
public void TransformReturnsCorrectResult()
{
// Fixture setup
var sut = new TracingBehavior();
var builder = new DelegatingSpecimenBuilder();
// Exercise system
var result = sut.Transform(builder);
// Verify outcome
var tw = Assert.IsAssignableFrom<TraceWriter>(result);
Assert.Equal(builder, tw.Tracer.Builder);
// Teardown
}
开发者ID:RyanLiu99,项目名称:AutoFixture,代码行数:12,代码来源:TracingBehaviorTest.cs
示例10: AddRaisesGraphChanged
public void AddRaisesGraphChanged()
{
// Fixture setup
var verified = false;
this.sut.GraphChanged += (s, e) => verified = s != null && e != null;
// Exercise system
var dummyItem = new DelegatingSpecimenBuilder();
this.sut.Add(dummyItem);
// Verify outcome
Assert.True(verified);
// Teardown
}
开发者ID:dhilgarth,项目名称:AutoFixture,代码行数:12,代码来源:SpecimenBuilderNodeAdapterCollectionTest.cs
示例11: ComparerIsCorrect
public void ComparerIsCorrect()
{
// Fixture setup
var dummyBuilder = new DelegatingSpecimenBuilder();
var expected = new DelegatingEqualityComparer();
var sut = new DelegatingRecursionGuard(dummyBuilder, expected);
// Exercise system
IEqualityComparer actual = sut.Comparer;
// Verify outcome
Assert.Equal(expected, actual);
// Teardown
}
开发者ID:robertlyson,项目名称:AutoFixture,代码行数:12,代码来源:RecursionGuardTest.cs
示例12: TransformReturnsCorrectResultForDefaultRecursionDepth
public void TransformReturnsCorrectResultForDefaultRecursionDepth()
{
// Fixture setup
var sut = new OmitOnRecursionBehavior();
// Exercise system
var dummyBuilder = new DelegatingSpecimenBuilder();
var result = sut.Transform(dummyBuilder);
// Verify outcome
var rg = Assert.IsAssignableFrom<RecursionGuard>(result);
Assert.IsAssignableFrom<OmitOnRecursionHandler>(rg.RecursionHandler);
Assert.Equal(1, rg.RecursionDepth);
// Teardown
}
开发者ID:nrjohnstone,项目名称:AutoFixture,代码行数:13,代码来源:OmitOnRecursionBehaviorTest.cs
示例13: ComposeRetainsHandler
public void ComposeRetainsHandler()
{
// Fixture setup
var dummyBuilder = new DelegatingSpecimenBuilder();
var expected = new DelegatingRecursionHandler();
var dummyComparer = new DelegatingEqualityComparer();
var sut = new RecursionGuard(dummyBuilder, expected, dummyComparer);
// Exercise system
var actual = sut.Compose(new ISpecimenBuilder[0]);
// Verify outcome
var rg = Assert.IsAssignableFrom<RecursionGuard>(actual);
Assert.Equal(expected, rg.RecursionHandler);
// Teardown
}
开发者ID:dhilgarth,项目名称:AutoFixture,代码行数:14,代码来源:RecursionGuardTest.cs
示例14: TransformReturnsCorrectResultForSpecificRecursionDepth
public void TransformReturnsCorrectResultForSpecificRecursionDepth()
{
// Fixture setup
const int explicitRecursionDepth = 2;
var sut = new NullRecursionBehavior(explicitRecursionDepth);
// Exercise system
var dummyBuilder = new DelegatingSpecimenBuilder();
var result = sut.Transform(dummyBuilder);
// Verify outcome
var rg = Assert.IsAssignableFrom<RecursionGuard>(result);
Assert.IsAssignableFrom<NullRecursionHandler>(rg.RecursionHandler);
Assert.Equal(explicitRecursionDepth, rg.RecursionDepth);
// Teardown
}
开发者ID:TeaDrivenDev,项目名称:AutoFixture,代码行数:14,代码来源:NullRecursionBehaviorTest.cs
示例15: SingleParameterDoWillInvokeMethodWithCorrectParameter
public void SingleParameterDoWillInvokeMethodWithCorrectParameter(
int expected)
{
// Fixture setup
var builder = new DelegatingSpecimenBuilder();
builder.OnCreate = (r, c) => expected;
var verified = false;
var mock = new CommandMock<int>();
mock.OnCommand = x => verified = expected == x;
// Exercise system
builder.Do((int i) => mock.Command(i));
// Verify outcome
Assert.True(verified, "Mock wasn't verified.");
// Teardown
}
开发者ID:ptrelford,项目名称:AutoFixture,代码行数:16,代码来源:SpecimenCommandTests.cs
示例16: CreateAnonymousOnSpecimenBuilderComposerReturnsCorrectResult
public void CreateAnonymousOnSpecimenBuilderComposerReturnsCorrectResult()
{
// Fixture setup
var expectedResult = new DateTime(2010, 5, 31, 14, 52, 19);
var specimenBuilder = new DelegatingSpecimenBuilder();
specimenBuilder.OnCreate = (r, c) =>
{
Assert.NotNull(c);
Assert.Equal(new SeededRequest(typeof(DateTime), default(DateTime)), r);
return expectedResult;
};
ISpecimenBuilder composer = new DelegatingComposer { OnCreate = specimenBuilder.OnCreate };
// Exercise system
var result = composer.Create<DateTime>();
// Verify outcome
Assert.Equal(expectedResult, result);
// Teardown
}
开发者ID:nandhakumaran,项目名称:AutoFixture,代码行数:19,代码来源:SpecimenFactoryTest.cs
示例17: ComposeReturnsCorrectResult
public void ComposeReturnsCorrectResult()
{
// Fixture setup
var dummyBuilder = new DelegatingSpecimenBuilder();
var dummyHandler = new DelegatingRecursionHandler();
var dummyComparer = new DelegatingEqualityComparer();
var sut = new RecursionGuard(dummyBuilder, dummyHandler, dummyComparer);
// Exercise system
var expectedBuilders = new[]
{
new DelegatingSpecimenBuilder(),
new DelegatingSpecimenBuilder(),
new DelegatingSpecimenBuilder()
};
var actual = sut.Compose(expectedBuilders);
// Verify outcome
var rg = Assert.IsAssignableFrom<RecursionGuard>(actual);
var composite = Assert.IsAssignableFrom<CompositeSpecimenBuilder>(rg.Builder);
Assert.True(expectedBuilders.SequenceEqual(composite));
// Teardown
}
开发者ID:dhilgarth,项目名称:AutoFixture,代码行数:21,代码来源:RecursionGuardTest.cs
示例18: BuildAndCreateOnUnregisteredAbstractionWillInvokeResidueCollectorWithCorrectType
public void BuildAndCreateOnUnregisteredAbstractionWillInvokeResidueCollectorWithCorrectType()
{
// Fixture setup
var residueCollector = new DelegatingSpecimenBuilder();
residueCollector.OnCreate = (r, c) =>
{
Assert.Equal(typeof(AbstractType), r);
return new ConcreteType();
};
var sut = new Fixture();
sut.ResidueCollectors.Add(residueCollector);
// Exercise system
sut.Build<PropertyHolder<AbstractType>>().Create();
// Verify outcome (done by callback)
// Teardown
}
开发者ID:dhilgarth,项目名称:AutoFixture,代码行数:17,代码来源:FixtureTest.cs
示例19: SettingRepeatCountWillCorrectlyUpdateMany
public void SettingRepeatCountWillCorrectlyUpdateMany()
{
// Fixture setup
var dummyBuilder = new DelegatingSpecimenBuilder();
var many = new MultipleRelay();
var sut = new Fixture(dummyBuilder, many);
// Exercise system
sut.RepeatCount = 26;
// Verify outcome
Assert.Equal(sut.RepeatCount, many.Count);
// Teardown
}
开发者ID:dhilgarth,项目名称:AutoFixture,代码行数:12,代码来源:FixtureTest.cs
示例20: ResidueCollectorsIsStable
public void ResidueCollectorsIsStable()
{
// Fixture setup
var sut = new Fixture();
var builder = new DelegatingSpecimenBuilder();
// Exercise system
sut.ResidueCollectors.Add(builder);
// Verify outcome
Assert.Contains(builder, sut.ResidueCollectors);
// Teardown
}
开发者ID:dhilgarth,项目名称:AutoFixture,代码行数:11,代码来源:FixtureTest.cs
注:本文中的DelegatingSpecimenBuilder类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论