Skip to content
This repository has been archived by the owner on Jan 19, 2021. It is now read-only.

Commit

Permalink
Merge pull request #2767 from CaPa-Creative-Ltd/dev-tests
Browse files Browse the repository at this point in the history
New Placeholder Unit Tests for future creation
  • Loading branch information
erwinvanhunen authored Jul 7, 2020
2 parents 047503a + 6ef16ce commit c06d717
Show file tree
Hide file tree
Showing 452 changed files with 37,714 additions and 36 deletions.
5 changes: 3 additions & 2 deletions SharePointPnP.PowerShell.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27130.2026
# Visual Studio Version 16
VisualStudioVersion = 16.0.30128.74
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharePointPnP.PowerShell.Commands", "Commands\SharePointPnP.PowerShell.Commands.csproj", "{1DDE6F0A-CA49-419A-9CE8-A6CA02F43CE0}"
ProjectSection(ProjectDependencies) = postProject
Expand All @@ -21,6 +21,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Documentation", "Documentat
CHANGELOG.md = CHANGELOG.md
CONTRIBUTING.md = CONTRIBUTING.md
readme.md = readme.md
Tests\UnitTests-Readme.md = Tests\UnitTests-Readme.md
version.txt = version.txt
EndProjectSection
EndProject
Expand Down
82 changes: 82 additions & 0 deletions Tests/Admin/AddPnPHubSiteAssociationTests.cs
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
}
}

104 changes: 104 additions & 0 deletions Tests/Admin/AddPnPOffice365GroupToSiteTests.cs
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
}
}

84 changes: 84 additions & 0 deletions Tests/Admin/AddPnPOrgAssetsLibraryTests.cs
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
}
}

78 changes: 78 additions & 0 deletions Tests/Admin/AddPnPOrgNewsSiteTests.cs
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
}
}

Loading

0 comments on commit c06d717

Please sign in to comment.