public void ShouldBeAbleToConstructItems() { using (mocks.Record()) { objectBuilder.Expect(x => x.Construct(Arg <int> .Is.Anything)).Return(new SimpleClass()).Repeat.Times(2); } using (mocks.Playback()) { declaration.Construct(); } }
public void DeclarationShouldUseObjectBuilderToConstructItems() { declaration = new RangeDeclaration <SimpleClass>(listBuilderImpl, objectBuilder, 0, 9); using (mocks.Record()) { objectBuilder.Expect(x => x.Construct()).Return(new SimpleClass()).Repeat.Times(10); } using (mocks.Playback()) { declaration.Construct(); } }
public void ShouldBeAbleToConstructItems() { using (mocks.Record()) { objectBuilder.Stub(x => x.BuilderSettings).Return(builderSettings); objectBuilder.Expect(x => x.Construct(Arg <int> .Is.Anything)).Return(new SimpleClass()).Repeat.Times(2); } using (mocks.Playback()) { declaration = new GlobalDeclaration <SimpleClass>(listBuilderImpl, objectBuilder); declaration.Construct(); } }
public void DeclarationShouldUseObjectBuilderToConstructItems() { using (mocks.Record()) { listBuilderImpl.Stub(x => x.BuilderSettings).Return(new BuilderSettings()); objectBuilder.Stub(x => x.BuilderSettings).Return(new BuilderSettings()); objectBuilder.Expect(x => x.Construct(Arg <int> .Is.Anything)).Return(new SimpleClass()).Repeat.Times(10); } using (mocks.Playback()) { declaration = new RangeDeclaration <SimpleClass>(listBuilderImpl, objectBuilder, 0, 9); declaration.Construct(); } }
public void A_component_should_be_subscribed_to_the_pipeline() { TestMessageConsumer <PingMessage> consumer = MockRepository.GenerateMock <TestMessageConsumer <PingMessage> >(); _builder.Expect(x => x.GetInstance <TestMessageConsumer <PingMessage> >()).Return(consumer).Repeat.Once(); _pipeline.Subscribe <TestMessageConsumer <PingMessage> >(); PipelineViewer.Trace(_pipeline); PingMessage message = new PingMessage(); consumer.Expect(x => x.Consume(message)); _pipeline.Dispatch(message); consumer.VerifyAllExpectations(); _builder.VerifyAllExpectations(); }
public void ShouldBeAbleToUseWith() { var builderSetup = new BuilderSetup(); using (mocks.Record()) { operable.Expect(x => x.ObjectBuilder).Return(new ObjectBuilder <MyClass>(null, builderSetup)); objectBuilder.Expect(x => x.With(func)); } OperableExtensions.With((IOperable <MyClass>)operable, func); }