public static void Initialize(TestContext testContext) { var results = TestScope.ExecuteCommand("Get-PnPList"); var list = results[0].BaseObject as Microsoft.SharePoint.Client.List; listTitle = list.Title; }
public void GetPnPFolderTest() { var results = TestScope.ExecuteCommand("Get-PnPFolder", new CommandParameter("Url", "Shared Documents")); Assert.AreEqual(results.Count, 1); }
public static void Cleanup() { TestScope.ExecuteCommand("Remove-PnPFolder", new CommandParameter("Name", folderName), new CommandParameter("Folder", "Shared Documents"), new CommandParameter("Force")); }
public static void Initialize(TestContext testContext) { listTitle = $"TempList {Guid.NewGuid()}"; TestScope.ExecuteCommand("New-PnPList", new CommandParameter("Title", listTitle), new CommandParameter("Template", Microsoft.SharePoint.Client.ListTemplateType.GenericList)); }
public void RequestPnPReIndexListTest() { var results = TestScope.ExecuteCommand("Request-PnPReIndexList", new CommandParameter("Identity", listTitle)); Assert.AreEqual(results.Count, 0); }
public void GetPnPViewTest() { var results = TestScope.ExecuteCommand("Get-PnPView", new CommandParameter("List", listTitle)); Assert.IsTrue(results.Count > 0); }
public static void Initialize(TestContext testContext) { folderName = $"Folder_{Guid.NewGuid()}"; TestScope.ExecuteCommand("Add-PnPFolder", new CommandParameter("Name", folderName), new CommandParameter("Folder", "Shared Documents")); }
public void RemovePnPListTest() { var results = TestScope.ExecuteCommand("Remove-PnPList", new CommandParameter("Identity", listTitle), new CommandParameter("Force")); Assert.IsNotNull(results); }
public void NewPnPListTest() { var results = TestScope.ExecuteCommand("New-PnPList", new CommandParameter("Title", listTitle), new CommandParameter("Template", Microsoft.SharePoint.Client.ListTemplateType.GenericList)); Assert.AreEqual(results.Count, 1); }
public static void Initialize(TestContext testContext) { listTitle = $"TempList {Guid.NewGuid()}"; viewTitle = "TestView"; TestScope.ExecuteCommand("New-PnPList", new CommandParameter("Title", listTitle), new CommandParameter("Template", ListTemplateType.GenericList)); }
public void GetPnPListItemTest() { var results = TestScope.ExecuteCommand("Get-PnPListItem", new CommandParameter("List", listTitle), new CommandParameter("Id", itemId)); Assert.AreEqual(results.Count, 1); }
public void GetPnPFolderItemTest() { var results = TestScope.ExecuteCommand("Get-PnPFolderItem", new CommandParameter("FolderSiteRelativeUrl", "Shared Documents") ); Assert.IsTrue(results.Count > 0); }
public void AddPnPFolderTest() { var results = TestScope.ExecuteCommand("Add-PnPFolder", new CommandParameter("Name", folderName), new CommandParameter("Folder", "Shared Documents")); Assert.AreEqual(results.Count, 1); }
//TODO: This is a scaffold of the cmdlet - complete the unit test //[TestMethod] public void RemovePnPFieldTest() { var results = TestScope.ExecuteCommand("Remove-PnPField", new CommandParameter("Identity", fieldName), new CommandParameter("Force")); Assert.AreEqual(results.Count, 0); }
//TODO: This is a scaffold of the cmdlet - complete the unit test //[TestMethod] public void RemovePnPFileTest() { var results = TestScope.ExecuteCommand("Remove-PnPFile", new CommandParameter("SiteRelativeUrl", $"Shared Documents/{fileName}"), new CommandParameter("Force")); Assert.AreEqual(results.Count, 0); }
public void GetPnPSpecifiedViewTest() { var results = TestScope.ExecuteCommand("Get-PnPView", new CommandParameter("List", listTitle), new CommandParameter("Identity", viewTitle)); Assert.AreEqual(results.Count, 1); }
public void GetPnPFileAsListItemTest() { var results = TestScope.ExecuteCommand("Get-PnPFile", new CommandParameter("Url", $"Shared Documents/{fileName}"), new CommandParameter("AsListItem")); Assert.AreEqual(results.Count, 1); Assert.IsInstanceOfType(results[0].BaseObject, typeof(Microsoft.SharePoint.Client.ListItem)); }
//TODO: This is a scaffold of the cmdlet - complete the unit test //[TestMethod] public void AddPnPFieldTest() { var results = TestScope.ExecuteCommand("Add-PnPField", new CommandParameter("DisplayName", fieldName), new CommandParameter("InternalName", fieldName), new CommandParameter("Type", Microsoft.SharePoint.Client.FieldType.Text)); Assert.IsTrue(results.Count > 0); }
public void RemovePnPViewTest() { var results = TestScope.ExecuteCommand("Remove-PnPView", new CommandParameter("Identity", viewTitle), new CommandParameter("List", listTitle), new CommandParameter("Force")); Assert.AreEqual(results.Count, 0); }
public void GetPnPFileAsStringTest() { var results = TestScope.ExecuteCommand("Get-PnPFile", new CommandParameter("Url", $"Shared Documents/{fileName}"), new CommandParameter("AsString")); Assert.AreEqual(results.Count, 1); Assert.IsInstanceOfType(results[0].BaseObject, typeof(string)); }
public static void Initialize(TestContext testContext) { fileName = $"{Guid.NewGuid()}.txt"; var filePath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @$ "Resources{System.IO.Path.DirectorySeparatorChar}template.xml"); TestScope.ExecuteCommand("Add-PnPFile", new CommandParameter("Path", filePath), new CommandParameter("NewFileName", fileName), new CommandParameter("Folder", "Shared Documents")); }
public void AddPnPFileTest() { var filePath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @$ "Resources{System.IO.Path.DirectorySeparatorChar}template.xml"); var results = TestScope.ExecuteCommand("Add-PnPFile", new CommandParameter("Path", filePath), new CommandParameter("NewFileName", fileName), new CommandParameter("Folder", "Shared Documents")); Assert.IsTrue(results.Count > 0); }
public static void Cleanup(TestContext testContext) { TestScope.ExecuteCommand("Remove-PnPField", new CommandParameter("Identity", fieldName), new CommandParameter("Force")); TestScope.ExecuteCommand("Remove-PnPField", new CommandParameter("Identity", $"{fieldName}2"), new CommandParameter("List", list.Title), new CommandParameter("Force")); }
public static void Initialize(TestContext testContext) { fieldName = $"Field{Guid.NewGuid()}"; var listResults = TestScope.ExecuteCommand("Get-PnPList"); if (listResults.Count > 0) { list = listResults[0].BaseObject as Microsoft.SharePoint.Client.List; } }
public void AddPnPViewTest() { var fields = new List <string>(); fields.Add("Title"); var results = TestScope.ExecuteCommand("Add-PnPView", new CommandParameter("List", listTitle), new CommandParameter("Title", viewTitle), new CommandParameter("Fields", fields)); Assert.AreEqual(results.Count, 1); }
public void AddPnPListItemTest() { Hashtable values = new Hashtable(); values.Add("Title", "Test Item"); var results = TestScope.ExecuteCommand("Add-PnPListItem", new CommandParameter("List", listTitle), new CommandParameter("Values", values)); Assert.AreEqual(results.Count, 1); }
public static void Initialize(TestContext testContext) { listTitle = $"TempList {Guid.NewGuid()}"; TestScope.ExecuteCommand("New-PnPList", new CommandParameter("Title", listTitle), new CommandParameter("Template", Microsoft.SharePoint.Client.ListTemplateType.GenericList)); viewTitle = "TempView"; TestScope.ExecuteCommand("Add-PnPView", new CommandParameter("List", listTitle), new CommandParameter("Title", viewTitle), new CommandParameter("Fields", new string[] { "Title" })); }
public void GetPnPFieldForListTest() { var listResults = TestScope.ExecuteCommand("Get-PnPList"); if (listResults.Count > 0) { var list = listResults[0].BaseObject as Microsoft.SharePoint.Client.List; var results = TestScope.ExecuteCommand("Get-PnPField", new CommandParameter("List", list)); Assert.IsTrue(results.Count > 0); } else { Assert.Fail(); } }
//TODO: This is a scaffold of the cmdlet - complete the unit test //[TestMethod] public void SetPnPListItemTest() { Hashtable values = new Hashtable(); values.Add("Title", "Updated Item"); var results = TestScope.ExecuteCommand("Set-PnPListItem", new CommandParameter("List", listTitle), new CommandParameter("Identity", itemId), new CommandParameter("Values", values)); Assert.AreEqual(results.Count, 1); var item = (ListItem)results[0].BaseObject; Assert.AreEqual(item["Title"], "Updated Item"); }
public void AddPnPFieldToListTest() { if (list != null) { var results = TestScope.ExecuteCommand("Add-PnPField", new CommandParameter("List", list.Title), new CommandParameter("DisplayName", $"{fieldName}2"), new CommandParameter("InternalName", $"{fieldName}2"), new CommandParameter("Type", Microsoft.SharePoint.Client.FieldType.Text)); Assert.IsTrue(results.Count > 0); } else { Assert.Fail(); } }