public override void SetUp() { base.SetUp(); IPersister persister = mocks.Stub<IPersister>(); Expect.Call(delegate { persister.Save(null); }) .IgnoreArguments() .Do(new Action<ContentItem>(savedItems.Add)) .Repeat.Any(); IEditManager editManager = mocks.Stub<IEditManager>(); Expect.Call(editManager.GetEditorFilter(null)) .IgnoreArguments() .Return(new PageFilter()); IWebContext webContext = mocks.Stub<IWebContext>(); mocks.ReplayAll(); root = CreateOneItem<NormalPage>(1, "root", null); page1 = CreateOneItem<NormalPage>(2, "page1", root); item2 = CreateOneItem<NormalItem>(3, "item2", root); page3 = CreateOneItem<NormalPage>(4, "page3", root); item4 = CreateOneItem<NormalItem>(5, "item4", root); page5 = CreateOneItem<NormalPage>(6, "page5", root); N2.Utility.UpdateSortOrder(root.Children); sorter = new TreeSorter(persister, editManager, webContext); }
public override void SetUp() { base.SetUp(); //definitions = TestSupport.SetupDefinitions(typeof(NormalPage), typeof(NormalItem)); //persister = TestSupport.SetupFakePersister(); definitions = engine.Definitions; persister = engine.Persister; page = CreateOneItem<NormalPage>(0, "root", null); persister.Save(page); worker = new EditableItemMigration(definitions, persister.Repository); }
public void ReferencedItem_IsRenamed_AndDetailIsRemoved() { var part = CreateOneItem<NormalItem>(0, "part", page); persister.Save(part); Details.ContentDetail.New("EditableItem", part).AddTo(page); persister.Save(page); persister.Dispose(); var result = worker.Migrate(new Edit.Installation.DatabaseStatus()); result.UpdatedItems.ShouldBe(1); persister.Dispose(); part = persister.Get<NormalItem>(part.ID); part.Name.ShouldBe("EditableItem"); page = persister.Get<NormalPage>(page.ID); page.Details["EditableItem"].ShouldBe(null); page.EditableItem.ShouldBe(part); }
public override void SetUp() { base.SetUp(); persister = TestSupport.SetupFakePersister(out repository); var webContext = new ThreadContext(); IEditManager editManager = mocks.Stub<IEditManager>(); Expect.Call(editManager.GetEditorFilter(null)) .IgnoreArguments() .Return(new PageFilter()); mocks.ReplayAll(); root = CreateOneItem<NormalPage>(1, "root", null); page1 = CreateOneItem<NormalPage>(2, "page1", root); page2 = CreateOneItem<NormalPage>(3, "page2", root); page2.SortOrder = 1; page3 = CreateOneItem<NormalPage>(4, "page3", root); page3.SortOrder = 2; sorter = new TreeSorter(persister, editManager, webContext, null); }
public override void SetUp() { base.SetUp(); persister = TestSupport.SetupFakePersister(); var webContext = new ThreadContext(); IEditManager editManager = mocks.Stub<IEditManager>(); Expect.Call(editManager.GetEditorFilter(null)) .IgnoreArguments() .Return(new PageFilter()); mocks.ReplayAll(); root = CreateOneItem<NormalPage>(1, "root", null); page1 = CreateOneItem<NormalPage>(2, "page1", root); item2 = CreateOneItem<NormalItem>(3, "item2", root); page3 = CreateOneItem<NormalPage>(4, "page3", root); item4 = CreateOneItem<NormalItem>(5, "item4", root); page5 = CreateOneItem<NormalPage>(6, "page5", root); N2.Utility.UpdateSortOrder(root.Children); sorter = new TreeSorter(persister, editManager, webContext, null); }