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

Commit

Permalink
Bunch of missing tests - namespace some cmdlets not consistent
Browse files Browse the repository at this point in the history
  • Loading branch information
pkbullock committed Jul 2, 2020
1 parent 20566e1 commit 6ef16ce
Show file tree
Hide file tree
Showing 33 changed files with 2,715 additions and 3 deletions.
74 changes: 74 additions & 0 deletions Tests/Admin/ClearPnPTenantAppCatalogUrlTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Management.Automation.Runspaces;

namespace SharePointPnP.PowerShell.Tests.Admin
{
[TestClass]
public class ClearTenantAppCatalogUrlTests
{
#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 ClearPnPTenantAppCatalogUrlTest()
{
using (var scope = new PSTestScope(true))
{
// Complete writing cmd parameters


var results = scope.ExecuteCommand("Clear-PnPTenantAppCatalogUrl");

Assert.IsNotNull(results);
}
}
#endregion
}
}

80 changes: 80 additions & 0 deletions Tests/Admin/GetPnPStorageEntityTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Management.Automation.Runspaces;

namespace SharePointPnP.PowerShell.Tests.Admin
{
[TestClass]
public class GetPnPStorageEntityTests
{
#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 GetPnPStorageEntityTest()
{
using (var scope = new PSTestScope(true))
{
// Complete writing cmd parameters

// From Cmdlet Help: The key of the value to retrieve.
var key = "";
// From Cmdlet Help: Defines the scope of the storage entity. Defaults to Tenant.
var scopeVar = "";

var results = scope.ExecuteCommand("Get-PnPStorageEntity",
new CommandParameter("Key", key),
new CommandParameter("Scope", scopeVar));

Assert.IsNotNull(results);
}
}
#endregion
}
}

74 changes: 74 additions & 0 deletions Tests/Admin/GetPnPTenantAppCatalogUrlTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Management.Automation.Runspaces;

namespace SharePointPnP.PowerShell.Tests.Admin
{
[TestClass]
public class GetTenantAppCatalogUrlTests
{
#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 GetPnPTenantAppCatalogUrlTest()
{
using (var scope = new PSTestScope(true))
{
// Complete writing cmd parameters


var results = scope.ExecuteCommand("Get-PnPTenantAppCatalogUrl");

Assert.IsNotNull(results);
}
}
#endregion
}
}

95 changes: 95 additions & 0 deletions Tests/Admin/GetPnPTenantSiteTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Management.Automation.Runspaces;

namespace SharePointPnP.PowerShell.Tests.Admin
{
[TestClass]
public class GetTenantSiteTests
{
#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 GetPnPTenantSiteTest()
{
using (var scope = new PSTestScope(true))
{
// Complete writing cmd parameters

// From Cmdlet Help: The URL of the site
var url = "";
// From Cmdlet Help: By default, all sites will be returned. Specify a template value alike "STS#0" here to filter on the template
var template = "";
// From Cmdlet Help: By default, not all returned attributes are populated. This switch populates all attributes. It can take several seconds to run. Without this, some attributes will show default values that may not be correct.
var detailed = "";
// From Cmdlet Help: By default, the OneDrives are not returned. This switch includes all OneDrives.
var includeOneDriveSites = "";
// From Cmdlet Help: When the switch IncludeOneDriveSites is used, this switch ignores the question shown that the command can take a long time to execute
var force = "";
// From Cmdlet Help: Limit results to a specific web template name
var webTemplate = "";
// From Cmdlet Help: Specifies the script block of the server-side filter to apply. See https://technet.microsoft.com/en-us/library/fp161380.aspx
var filter = "";

var results = scope.ExecuteCommand("Get-PnPTenantSite",
new CommandParameter("Url", url),
new CommandParameter("Template", template),
new CommandParameter("Detailed", detailed),
new CommandParameter("IncludeOneDriveSites", includeOneDriveSites),
new CommandParameter("Force", force),
new CommandParameter("WebTemplate", webTemplate),
new CommandParameter("Filter", filter));

Assert.IsNotNull(results);
}
}
#endregion
}
}

Loading

0 comments on commit 6ef16ce

Please sign in to comment.