private PageTypePropertyUpdater CreatePageTypePropertyUpdaterWithFakePageDefinitionFactoryAndFakeUpdatePageDefinitionValuesMethod() { MockRepository fakes = new MockRepository(); PageTypePropertyUpdater pageTypePropertyUpdater = PageTypePropertyUpdaterFactory.PartialMock(fakes); pageTypePropertyUpdater.Stub( utility => utility.UpdatePageDefinitionValues( Arg <PageDefinition> .Is.Anything, Arg <PageTypePropertyDefinition> .Is.Anything)); pageTypePropertyUpdater.Replay(); PageDefinitionFactory fakeFactory = fakes.Stub <PageDefinitionFactory>(); fakeFactory.Stub(factory => factory.Save(Arg <PageDefinition> .Is.Anything)); fakeFactory.Replay(); pageTypePropertyUpdater.PageDefinitionFactory = fakeFactory; return(pageTypePropertyUpdater); }
private PageTypePropertyUpdater CreatePageTypePropertyUpdaterWithFakePageDefinitionFactoryAndFakedSetPageDefinitionTypeMethod() { MockRepository fakes = new MockRepository(); PageDefinitionFactory fakePageDefinitionFactory = fakes.Stub <PageDefinitionFactory>(); fakePageDefinitionFactory.Stub(factory => factory.Save(Arg <PageDefinition> .Is.Anything)); fakePageDefinitionFactory.Replay(); PageTypePropertyUpdater partiallyMockedUtility = PageTypePropertyUpdaterFactory.PartialMock(fakes); partiallyMockedUtility.Stub( utility => utility.SetPageDefinitionType( Arg <PageDefinition> .Is.Anything, Arg <PageTypePropertyDefinition> .Is.Anything)); partiallyMockedUtility.PageDefinitionFactory = fakePageDefinitionFactory; partiallyMockedUtility.Replay(); return(partiallyMockedUtility); }
public void GivenUpdatedPropertyDefinition_UpdatePageDefinition_CallsPageDefinitionFactorySave() { PageDefinition pageDefinitionToUpdate = new PageDefinition(); MockRepository fakes = new MockRepository(); PageTypePropertyUpdater pageTypePropertyUpdater = PageTypePropertyUpdaterFactory.PartialMock(fakes); pageTypePropertyUpdater.Stub( utility => utility.UpdatePageDefinitionValues( Arg <PageDefinition> .Is.Anything, Arg <PageTypePropertyDefinition> .Is.Anything)); PageDefinitionFactory fakeFactory = fakes.Stub <PageDefinitionFactory>(); fakeFactory.Stub(factory => factory.Save(Arg <PageDefinition> .Is.Anything)); fakeFactory.Replay(); pageTypePropertyUpdater.PageDefinitionFactory = fakeFactory; pageTypePropertyUpdater.Stub(updater => updater.SerializeValues(pageDefinitionToUpdate)).Return(Guid.NewGuid().ToString()).Repeat.Once(); pageTypePropertyUpdater.Stub(updater => updater.SerializeValues(pageDefinitionToUpdate)).Return(Guid.NewGuid().ToString()); pageTypePropertyUpdater.Replay(); PageTypePropertyDefinition propertyDefinition = CreatePageTypePropertyDefinition(); pageTypePropertyUpdater.UpdatePageDefinition(pageDefinitionToUpdate, propertyDefinition); pageTypePropertyUpdater.PageDefinitionFactory.AssertWasCalled(factory => factory.Save(pageDefinitionToUpdate)); }