This repository has been archived by the owner on Jan 19, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 659
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2767 from CaPa-Creative-Ltd/dev-tests
New Placeholder Unit Tests for future creation
- Loading branch information
Showing
452 changed files
with
37,714 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
using System; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
using System.Management.Automation.Runspaces; | ||
|
||
namespace SharePointPnP.PowerShell.Tests.Admin | ||
{ | ||
[TestClass] | ||
public class AddHubSiteAssociationTests | ||
{ | ||
#region Test Setup/CleanUp | ||
[ClassInitialize] | ||
public static void Initialize(TestContext testContext) | ||
{ | ||
// This runs on class level once before all tests run | ||
//using (var ctx = TestCommon.CreateClientContext()) | ||
//{ | ||
//} | ||
} | ||
|
||
[ClassCleanup] | ||
public static void Cleanup(TestContext testContext) | ||
{ | ||
// This runs on class level once | ||
//using (var ctx = TestCommon.CreateClientContext()) | ||
//{ | ||
//} | ||
} | ||
|
||
[TestInitialize] | ||
public void Initialize() | ||
{ | ||
using (var scope = new PSTestScope()) | ||
{ | ||
// Example | ||
// scope.ExecuteCommand("cmdlet", new CommandParameter("param1", prop)); | ||
} | ||
} | ||
|
||
[TestCleanup] | ||
public void Cleanup() | ||
{ | ||
using (var scope = new PSTestScope()) | ||
{ | ||
try | ||
{ | ||
// Do Test Setup - Note, this runs PER test | ||
} | ||
catch (Exception) | ||
{ | ||
// Describe Exception | ||
} | ||
} | ||
} | ||
#endregion | ||
|
||
#region Scaffolded Cmdlet Tests | ||
//TODO: This is a scaffold of the cmdlet - complete the unit test | ||
//[TestMethod] | ||
public void AddPnPHubSiteAssociationTest() | ||
{ | ||
using (var scope = new PSTestScope(true)) | ||
{ | ||
// Complete writing cmd parameters | ||
|
||
// This is a mandatory parameter | ||
// From Cmdlet Help: The site to connect to the hubsite | ||
var site = ""; | ||
// This is a mandatory parameter | ||
// From Cmdlet Help: The hubsite to connect the site to | ||
var hubSite = ""; | ||
|
||
var results = scope.ExecuteCommand("Add-PnPHubSiteAssociation", | ||
new CommandParameter("Site", site), | ||
new CommandParameter("HubSite", hubSite)); | ||
|
||
Assert.IsNotNull(results); | ||
} | ||
} | ||
#endregion | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
using System; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
using System.Management.Automation.Runspaces; | ||
|
||
namespace SharePointPnP.PowerShell.Tests.Admin | ||
{ | ||
[TestClass] | ||
public class AddOffice365GroupToSiteTests | ||
{ | ||
#region Test Setup/CleanUp | ||
[ClassInitialize] | ||
public static void Initialize(TestContext testContext) | ||
{ | ||
// This runs on class level once before all tests run | ||
//using (var ctx = TestCommon.CreateClientContext()) | ||
//{ | ||
//} | ||
} | ||
|
||
[ClassCleanup] | ||
public static void Cleanup(TestContext testContext) | ||
{ | ||
// This runs on class level once | ||
//using (var ctx = TestCommon.CreateClientContext()) | ||
//{ | ||
//} | ||
} | ||
|
||
[TestInitialize] | ||
public void Initialize() | ||
{ | ||
using (var scope = new PSTestScope()) | ||
{ | ||
// Example | ||
// scope.ExecuteCommand("cmdlet", new CommandParameter("param1", prop)); | ||
} | ||
} | ||
|
||
[TestCleanup] | ||
public void Cleanup() | ||
{ | ||
using (var scope = new PSTestScope()) | ||
{ | ||
try | ||
{ | ||
// Do Test Setup - Note, this runs PER test | ||
} | ||
catch (Exception) | ||
{ | ||
// Describe Exception | ||
} | ||
} | ||
} | ||
#endregion | ||
|
||
#region Scaffolded Cmdlet Tests | ||
//TODO: This is a scaffold of the cmdlet - complete the unit test | ||
//[TestMethod] | ||
public void AddPnPOffice365GroupToSiteTest() | ||
{ | ||
using (var scope = new PSTestScope(true)) | ||
{ | ||
// Complete writing cmd parameters | ||
|
||
// This is a mandatory parameter | ||
// From Cmdlet Help: Url of the site to be connected to an Microsoft 365 Group | ||
var url = ""; | ||
// This is a mandatory parameter | ||
// From Cmdlet Help: Specifies the alias of the group. Cannot contain spaces. | ||
var alias = ""; | ||
// From Cmdlet Help: The optional description of the group | ||
var description = ""; | ||
// This is a mandatory parameter | ||
// From Cmdlet Help: The display name of the group | ||
var displayName = ""; | ||
// From Cmdlet Help: Specifies the classification of the group | ||
var classification = ""; | ||
// From Cmdlet Help: Specifies if the group is public. Defaults to false. | ||
var isPublic = ""; | ||
// From Cmdlet Help: Specifies if the current site home page is kept. Defaults to false. | ||
var keepOldHomePage = ""; | ||
// From Cmdlet Help: If specified the site will be associated to the hubsite as identified by this id | ||
var hubSiteId = ""; | ||
// From Cmdlet Help: The array UPN values of the group's owners. | ||
var owners = ""; | ||
|
||
var results = scope.ExecuteCommand("Add-PnPOffice365GroupToSite", | ||
new CommandParameter("Url", url), | ||
new CommandParameter("Alias", alias), | ||
new CommandParameter("Description", description), | ||
new CommandParameter("DisplayName", displayName), | ||
new CommandParameter("Classification", classification), | ||
new CommandParameter("IsPublic", isPublic), | ||
new CommandParameter("KeepOldHomePage", keepOldHomePage), | ||
new CommandParameter("HubSiteId", hubSiteId), | ||
new CommandParameter("Owners", owners)); | ||
|
||
Assert.IsNotNull(results); | ||
} | ||
} | ||
#endregion | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
using System; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
using System.Management.Automation.Runspaces; | ||
|
||
namespace SharePointPnP.PowerShell.Tests.Admin | ||
{ | ||
[TestClass] | ||
public class AddOrgAssetsLibraryTests | ||
{ | ||
#region Test Setup/CleanUp | ||
[ClassInitialize] | ||
public static void Initialize(TestContext testContext) | ||
{ | ||
// This runs on class level once before all tests run | ||
//using (var ctx = TestCommon.CreateClientContext()) | ||
//{ | ||
//} | ||
} | ||
|
||
[ClassCleanup] | ||
public static void Cleanup(TestContext testContext) | ||
{ | ||
// This runs on class level once | ||
//using (var ctx = TestCommon.CreateClientContext()) | ||
//{ | ||
//} | ||
} | ||
|
||
[TestInitialize] | ||
public void Initialize() | ||
{ | ||
using (var scope = new PSTestScope()) | ||
{ | ||
// Example | ||
// scope.ExecuteCommand("cmdlet", new CommandParameter("param1", prop)); | ||
} | ||
} | ||
|
||
[TestCleanup] | ||
public void Cleanup() | ||
{ | ||
using (var scope = new PSTestScope()) | ||
{ | ||
try | ||
{ | ||
// Do Test Setup - Note, this runs PER test | ||
} | ||
catch (Exception) | ||
{ | ||
// Describe Exception | ||
} | ||
} | ||
} | ||
#endregion | ||
|
||
#region Scaffolded Cmdlet Tests | ||
//TODO: This is a scaffold of the cmdlet - complete the unit test | ||
//[TestMethod] | ||
public void AddPnPOrgAssetsLibraryTest() | ||
{ | ||
using (var scope = new PSTestScope(true)) | ||
{ | ||
// Complete writing cmd parameters | ||
|
||
// This is a mandatory parameter | ||
// From Cmdlet Help: The full url of the document library to be marked as one of organization's assets sources | ||
var libraryUrl = ""; | ||
// From Cmdlet Help: The full url to an image that should be used as a thumbnail for showing this source. The image must reside in the same site as the document library you specify. | ||
var thumbnailUrl = ""; | ||
// From Cmdlet Help: Indicates what type of Office 365 CDN source the document library will be added to | ||
var cdnType = ""; | ||
|
||
var results = scope.ExecuteCommand("Add-PnPOrgAssetsLibrary", | ||
new CommandParameter("LibraryUrl", libraryUrl), | ||
new CommandParameter("ThumbnailUrl", thumbnailUrl), | ||
new CommandParameter("CdnType", cdnType)); | ||
|
||
Assert.IsNotNull(results); | ||
} | ||
} | ||
#endregion | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
using System; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
using System.Management.Automation.Runspaces; | ||
|
||
namespace SharePointPnP.PowerShell.Tests.Admin | ||
{ | ||
[TestClass] | ||
public class AddOrgNewsSiteTests | ||
{ | ||
#region Test Setup/CleanUp | ||
[ClassInitialize] | ||
public static void Initialize(TestContext testContext) | ||
{ | ||
// This runs on class level once before all tests run | ||
//using (var ctx = TestCommon.CreateClientContext()) | ||
//{ | ||
//} | ||
} | ||
|
||
[ClassCleanup] | ||
public static void Cleanup(TestContext testContext) | ||
{ | ||
// This runs on class level once | ||
//using (var ctx = TestCommon.CreateClientContext()) | ||
//{ | ||
//} | ||
} | ||
|
||
[TestInitialize] | ||
public void Initialize() | ||
{ | ||
using (var scope = new PSTestScope()) | ||
{ | ||
// Example | ||
// scope.ExecuteCommand("cmdlet", new CommandParameter("param1", prop)); | ||
} | ||
} | ||
|
||
[TestCleanup] | ||
public void Cleanup() | ||
{ | ||
using (var scope = new PSTestScope()) | ||
{ | ||
try | ||
{ | ||
// Do Test Setup - Note, this runs PER test | ||
} | ||
catch (Exception) | ||
{ | ||
// Describe Exception | ||
} | ||
} | ||
} | ||
#endregion | ||
|
||
#region Scaffolded Cmdlet Tests | ||
//TODO: This is a scaffold of the cmdlet - complete the unit test | ||
//[TestMethod] | ||
public void AddPnPOrgNewsSiteTest() | ||
{ | ||
using (var scope = new PSTestScope(true)) | ||
{ | ||
// Complete writing cmd parameters | ||
|
||
// This is a mandatory parameter | ||
// From Cmdlet Help: The url of the site to be marked as one of organization's news sites | ||
var orgNewsSiteUrl = ""; | ||
|
||
var results = scope.ExecuteCommand("Add-PnPOrgNewsSite", | ||
new CommandParameter("OrgNewsSiteUrl", orgNewsSiteUrl)); | ||
|
||
Assert.IsNotNull(results); | ||
} | ||
} | ||
#endregion | ||
} | ||
} | ||
|
Oops, something went wrong.