public void Test_01_ListChildrenOf_ForWebSite( ) { Proxy.NavigatorRef.Navigator nav = new Proxy.NavigatorRef.Navigator( ); nav.Url = Globals.NavigatorUrl( ); // Very important line - You must specify your credentials if the web service // is using trusted connections. nav.Credentials = System.Net.CredentialCache.DefaultCredentials.GetCredential( new Uri( Globals.SharePointTestServer ), "" ); Proxy.NavigatorRef.Item[ ] items = nav.ListChildrenOf( Globals.SiteCollectionForTests( ) ); Assert.IsTrue( items.Length != 0, "There must be SOMETHING there..." ); Proxy.NavigatorRef.Item item1 = Helper_GetSpecificItem( items, "SubSite1" ); Proxy.NavigatorRef.Item item2 = Helper_GetSpecificItem( items, "SubSite2" ); Proxy.NavigatorRef.Item docLib1 = Helper_GetSpecificItem( items, "Custom Document Library" ); Proxy.NavigatorRef.Item docLib2 = Helper_GetSpecificItem( items, "Shared Documents" ); Assert.IsTrue( item1 != null && item2 != null, "An expected item was missing. Has someone modified the TestingOnly Top Level Site?" ); Assert.IsTrue( item1.Kind == Proxy.NavigatorRef.ItemKind.WebSite, "This item is supposed to be labelled a website." ); Assert.IsTrue( item1.Url.ToLower( ) == ( Globals.SiteCollectionForTests( ) + "/subsite1" ).ToLower( ), "The Url for the subitem (1) is wrong!" ); Assert.IsTrue( item2.Kind == Proxy.NavigatorRef.ItemKind.WebSite, "This item is supposed to be labelled a website." ); Assert.IsTrue( item2.Url.ToLower( ) == ( Globals.SiteCollectionForTests( ) + "/subsite2" ).ToLower( ), "The Url for the subitem (2) is wrong!" ); Assert.IsTrue( docLib1.Kind == Proxy.NavigatorRef.ItemKind.DocumentLibrary, "This item is supposed to be labelled a document library." ); Assert.IsTrue( docLib1.Url.ToLower( ) == ( Globals.SiteCollectionForTests( ) + "/Custom Document Library" ).ToLower( ), "The Url for the document library (\"Custom\") is wrong!" ); Assert.IsTrue( docLib2.Kind == Proxy.NavigatorRef.ItemKind.DocumentLibrary, "This item is supposed to be labelled a document library." ); Assert.IsTrue( docLib2.Url.ToLower( ) == ( Globals.SiteCollectionForTests( ) + "/Shared Documents" ).ToLower( ), "The Url for the document library (\"Shared\") is wrong!" ); items = nav.ListChildrenOf( item1.Url ); Assert.IsTrue( items.Length != 0, "There must be SOMETHING there..." ); item1 = Helper_GetSpecificItem( items, "Deeper1" ); docLib1 = Helper_GetSpecificItem( items, "Shared Documents" ); Assert.IsTrue( item1 != null, "This site DOES have a subsite called Deeper1!" ); Assert.IsTrue( item1.Title == "Deeper1", "An expected item was WRONG!! Has someone modified the TestingOnly/SubSite1 site?" ); Assert.IsTrue( item1.Url.ToLower( ) == ( Globals.SiteCollectionForTests( ) + "/subsite1/deeper1" ).ToLower( ), "The Url for the sub-subitem is wrong!" ); Assert.IsTrue( docLib1 != null, "This site DOES have a Shared Documents list." ); Assert.IsTrue( docLib1.Title == "Shared Documents", "An expected item was WRONG!! Has someone modified the TestingOnly/SubSite1/deeper1 site?" ); Assert.IsTrue( docLib1.Url.ToLower( ) == ( Globals.SiteCollectionForTests( ) + "/subsite1/Shared Documents" ).ToLower( ), "The Url for the document library is wrong!" ); }
public void Test_02_ListChildrenOf_ForDocumentLibraray( ) { Proxy.NavigatorRef.Navigator nav = new Proxy.NavigatorRef.Navigator( ); nav.Url = Globals.NavigatorUrl( ); nav.Credentials = System.Net.CredentialCache.DefaultCredentials.GetCredential( new Uri( Globals.SharePointTestServer ), "" ); Proxy.NavigatorRef.Item[ ] items = nav.ListChildrenOf( Globals.DocumentLibForTests( ) ); Assert.IsTrue( items.Length == 2, "There should only be two word documents in this Library" ); Proxy.NavigatorRef.Item document1 = Helper_GetSpecificItem( items, "Expected Test Document 1.doc" ); Proxy.NavigatorRef.Item document2 = Helper_GetSpecificItem( items, "Expected Test Document 2.doc" ); Assert.IsTrue( document1 != null, "Failed to retrieve the first test document from the server." ); Assert.IsTrue( document2 != null, "Failed to retrieve the second test document from the server." ); Assert.IsTrue( document1.Kind == Proxy.NavigatorRef.ItemKind.File, "It's a file. Trust me on this one!" ); Assert.IsTrue( document2.Kind == Proxy.NavigatorRef.ItemKind.File, "It's also a file. Trust me on this one!" ); Assert.IsTrue( document1.Title.ToLower( ) == "expected test document 1.doc", "Failed to populate the item's title." ); Assert.IsTrue( document2.Title.ToLower( ) == "expected test document 2.doc", "Failed to populate the other item's title." ); Assert.IsTrue( document1.Url.ToLower( ) == ( Globals.DocumentLibForTests( ) + "/" + document1.Title ).ToLower( ), "Document 1 Url wrong." ); Assert.IsTrue( document2.Url.ToLower( ) == ( Globals.DocumentLibForTests( ) + "/" + document2.Title ).ToLower( ), "Document 2 Url wrong." ); }
public void Test_03_ListChildrenOf_ForDocumentLibraryWithSubFolder( ) { Proxy.NavigatorRef.Navigator nav = new Proxy.NavigatorRef.Navigator( ); nav.Url = Globals.NavigatorUrl( ); nav.Credentials = System.Net.CredentialCache.DefaultCredentials.GetCredential( new Uri( Globals.SharePointTestServer ), "" ); Proxy.NavigatorRef.Item[ ] items = nav.ListChildrenOf( Globals.DocumentLibForTestsWithSubFolders( ) ); Assert.IsTrue( items.Length == 2, "There should only be two word documents in this Library" ); Proxy.NavigatorRef.Item document1 = Helper_GetSpecificItem( items, "Please please leave this file here.doc" ); Proxy.NavigatorRef.Item folder1 = Helper_GetSpecificItem( items, "SubFolderLevel1" ); Assert.IsTrue( document1 != null, "Failed to retrieve the first test document from the server." ); Assert.IsTrue( folder1 != null, "Failed to retrieve the folder from the server." ); Assert.IsTrue( document1.Kind == Proxy.NavigatorRef.ItemKind.File, "It's a file. Trust me on this one!" ); Assert.IsTrue( folder1.Kind == Proxy.NavigatorRef.ItemKind.Folder, "It's a folder. Trust me on this one!" ); Assert.IsTrue( document1.Title == "Please please leave this file here.doc", "Um, there is something wrong with title." ); Assert.IsTrue( folder1.Title == "SubFolderLevel1", "Um, there is something wrong with title." ); Assert.IsTrue( document1.Url.ToLower( ) == ( Globals.DocumentLibForTestsWithSubFolders( ) + "/" + document1.Title ).ToLower( ), "The Url for the file is wrong." ); Assert.IsTrue( folder1.Url.ToLower( ) == ( Globals.DocumentLibForTestsWithSubFolders( ) + "/" + folder1.Title ).ToLower( ), "The Url for the folder is wrong." ); }