public void creates_and_delegates_to_another_projection() { var context = MockRepository.GenerateMock <IProjectionContext <ProjectionModel> >(); var stub = new FakeProjector(); context.Stub(x => x.Service <FakeProjector>()).Return(stub); var projection = new DelegatingProjection <ProjectionModel, FakeProjector>(); var theNode = new DictionaryMediaNode(); projection.Write(context, theNode); stub.theTarget.ShouldBeTheSameAs(context); stub.theNode.ShouldBeTheSameAs(theNode); }
public void include_inside_a_projection() { var context = MockRepository.GenerateMock <IProjectionContext <ProjectionModel> >(); var stub = new FakeProjector(); context.Stub(x => x.Service <FakeProjector>()).Return(stub); var projection = new Projection <ProjectionModel>(DisplayFormatting.RawValues); projection.Include <FakeProjector>(); var theNode = new DictionaryMediaNode(); projection.As <IProjection <ProjectionModel> >().Write(context, theNode); stub.theTarget.ShouldBeTheSameAs(context); stub.theNode.ShouldBeTheSameAs(theNode); }