Exemplo n.º 1
0
        public override void SetUp()
        {
            base.SetUp();

            finder = new FakeTypeFinder(typeof(XmlableItem).Assembly, typeof(XmlableItem), typeof(XmlableItem2));
            notifier = mocks.Stub<IItemNotifier>();
            mocks.Replay(notifier);

            activator = new ContentActivator(new N2.Edit.Workflow.StateChanger(), notifier, new InterceptingProxyFactory());
            definitions = new DefinitionManager(
                new[] {new DefinitionProvider(new DefinitionBuilder(new DefinitionMap(), 
                    finder, 
                    new TransformerBase<IUniquelyNamed>[0],
                    TestSupport.SetupEngineSection()))}, 
                activator, new StateChanger(), new DefinitionMap());
            definitions.Start();
            parser = mocks.StrictMock<IUrlParser>();
            Expect.On(parser)
                .Call(parser.BuildUrl(null))
                .IgnoreArguments()
                .Do(new BuildUrl(delegate(ContentItem itemToBuild)
                                    {
                                        string url = "/" + itemToBuild.Name + ".aspx";
                                        foreach (ContentItem parent in Find.EnumerateParents(itemToBuild, null))
                                        {
                                            if (parent.Parent != null)
                                                url = "/" + parent.Name + url;
                                        }
                                        return url.ToUrl();
                                    }))
                .Repeat.Any();
            mocks.Replay(parser);

            persister = TestSupport.SetupFakePersister();
        }
		public override void SetUp()
		{
			base.SetUp();

			finder = new FakeTypeFinder(typeof(XmlableItem).Assembly, typeof(XmlableItem), typeof(XmlableItem2));
			notifier = mocks.Stub<IItemNotifier>();
			mocks.Replay(notifier);

			activator = new ContentActivator(new N2.Edit.Workflow.StateChanger(), notifier, new InterceptingProxyFactory());
			definitions = new DefinitionManager(
				new[] {new DefinitionProvider(new DefinitionBuilder(new DefinitionMap(), 
					finder, 
					new TransformerBase<IUniquelyNamed>[0],
					TestSupport.SetupEngineSection()))}, 
				activator, new StateChanger(), new DefinitionMap());
			definitions.Start();
			parser = mocks.StrictMock<IUrlParser>();
			Expect.On(parser)
				.Call(parser.BuildUrl(null))
				.IgnoreArguments()
				.Do(new BuildUrl(delegate(ContentItem itemToBuild)
									{
										string url = "/" + itemToBuild.Name + ".aspx";
										foreach (ContentItem parent in Find.EnumerateParents(itemToBuild, null))
										{
											if (parent.Parent != null)
												url = "/" + parent.Name + url;
										}
										return url.ToUrl();
									}))
				.Repeat.Any();
			mocks.Replay(parser);

			persister = TestSupport.SetupFakePersister();
		}