/// <summary>
		/// Shared with PublishMediaStoreTests
		/// </summary>
		/// <param name="id"></param>
		/// <param name="umbracoContext"></param>
		/// <returns></returns>
		internal static IPublishedContent GetNode(int id, UmbracoContext umbracoContext)
		{
			var ctx = umbracoContext;
			var mediaStore = new DefaultPublishedMediaStore();
			var doc = mediaStore.GetDocumentById(ctx, id);
			Assert.IsNotNull(doc);
			return doc;
		}
	    public void Ensure_Children_Sorted_With_Examine()
	    {
            var newIndexFolder = new DirectoryInfo(Path.Combine("App_Data\\CWSIndexSetTest", Guid.NewGuid().ToString()));
            var indexInit = new IndexInitializer();
            var indexer = indexInit.GetUmbracoIndexer(newIndexFolder);
            indexer.RebuildIndex();

            var store = new DefaultPublishedMediaStore(
                indexInit.GetUmbracoSearcher(newIndexFolder),
                indexInit.GetUmbracoIndexer(newIndexFolder));

            //we are using the media.xml media to test the examine results implementation, see the media.xml file in the ExamineHelpers namespace
            var publishedMedia = store.GetDocumentById(GetUmbracoContext("/test", 1234), 1111);
	        var rootChildren = publishedMedia.Children().ToArray();
	        var currSort = 0;
            for (var i = 0; i < rootChildren.Count(); i++)
            {
                Assert.GreaterOrEqual(rootChildren[i].SortOrder, currSort);
                currSort = rootChildren[i].SortOrder;
            }

                

	    }
	    public void Do_Not_Find_In_Recycle_Bin()
	    {
            var newIndexFolder = new DirectoryInfo(Path.Combine("App_Data\\CWSIndexSetTest", Guid.NewGuid().ToString()));
            var indexInit = new IndexInitializer();
            var indexer = indexInit.GetUmbracoIndexer(newIndexFolder);	        
            indexer.RebuildIndex();
            var searcher = indexInit.GetUmbracoSearcher(newIndexFolder);
            var store = new DefaultPublishedMediaStore(searcher, indexer);
	        var ctx = GetUmbracoContext("/test", 1234);

            //ensure it is found
            var publishedMedia = store.GetDocumentById(ctx, 3113);
	        Assert.IsNotNull(publishedMedia);

            //move item to recycle bin
            var newXml = XElement.Parse(@"<node id='3113' version='5b3e46ab-3e37-4cfa-ab70-014234b5bd33' parentID='-21' level='1' writerID='0' nodeType='1032' template='0' sortOrder='2' createDate='2010-05-19T17:32:46' updateDate='2010-05-19T17:32:46' nodeName='Another Umbraco Image' urlName='acnestressscrub' writerName='Administrator' nodeTypeAlias='Image' path='-1,-21,3113'>
					<data alias='umbracoFile'><![CDATA[/media/1234/blah.pdf]]></data>
					<data alias='umbracoWidth'>115</data>
					<data alias='umbracoHeight'>268</data>
					<data alias='umbracoBytes'>10726</data>
					<data alias='umbracoExtension'>jpg</data>
				</node>");
            indexer.ReIndexNode(newXml, "media");

            //ensure it still exists in the index (raw examine search)
            var criteria = searcher.CreateSearchCriteria();
            var filter = criteria.Id(3113);
            var found = searcher.Search(filter.Compile());
            Assert.IsNotNull(found);
            Assert.AreEqual(1, found.TotalItemCount);

            //ensure it does not show up in the published media store
            var recycledMedia = store.GetDocumentById(ctx, 3113);
            Assert.IsNull(recycledMedia);
	    }
		public void AncestorsOrSelf_With_Examine()
		{
			var newIndexFolder = new DirectoryInfo(Path.Combine("App_Data\\CWSIndexSetTest", Guid.NewGuid().ToString()));
			var indexInit = new IndexInitializer();
			var indexer = indexInit.GetUmbracoIndexer(newIndexFolder);
			indexer.RebuildIndex();

            var store = new DefaultPublishedMediaStore(
                indexInit.GetUmbracoSearcher(newIndexFolder),
                indexInit.GetUmbracoIndexer(newIndexFolder));

			//we are using the media.xml media to test the examine results implementation, see the media.xml file in the ExamineHelpers namespace
			var publishedMedia = store.GetDocumentById(GetUmbracoContext("/test", 1234), 3113);
			var ancestors = publishedMedia.AncestorsOrSelf();
			Assert.IsTrue(ancestors.Select(x => x.Id).ContainsAll(new[] { 3113, 2112, 2222, 1111 }));
		}