-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
100 additions
and
41 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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
function Connect-M365Suite { | ||
[OutputType([void])] | ||
[CmdletBinding()] | ||
param ( | ||
[Parameter(Mandatory=$false)] | ||
|
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
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,19 @@ | ||
function Format-RequiredModuleList { | ||
[CmdletBinding()] | ||
[OutputType([string])] | ||
param ( | ||
[Parameter(Mandatory = $true)] | ||
[System.Object[]]$RequiredModules | ||
) | ||
|
||
$requiredModulesFormatted = "" | ||
foreach ($module in $RequiredModules) { | ||
if ($module.SubModules -and $module.SubModules.Count -gt 0) { | ||
$subModulesFormatted = $module.SubModules -join ', ' | ||
$requiredModulesFormatted += "$($module.ModuleName) (SubModules: $subModulesFormatted), " | ||
} else { | ||
$requiredModulesFormatted += "$($module.ModuleName), " | ||
} | ||
} | ||
return $requiredModulesFormatted.TrimEnd(", ") | ||
} |
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
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
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
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
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 |
---|---|---|
@@ -1,28 +1,29 @@ | ||
function Update-WorksheetCell { | ||
param ( | ||
$Worksheet, | ||
$Data, | ||
$StartingRowIndex | ||
) | ||
function Update-WorksheetCell { | ||
[OutputType([void])] | ||
param ( | ||
$Worksheet, | ||
$Data, | ||
$StartingRowIndex | ||
) | ||
|
||
# Check and set headers | ||
$firstItem = $Data[0] | ||
$colIndex = 1 | ||
foreach ($property in $firstItem.PSObject.Properties) { | ||
if ($StartingRowIndex -eq 2 -and $Worksheet.Cells[1, $colIndex].Value -eq $null) { | ||
$Worksheet.Cells[1, $colIndex].Value = $property.Name | ||
} | ||
$colIndex++ | ||
} | ||
# Check and set headers | ||
$firstItem = $Data[0] | ||
$colIndex = 1 | ||
foreach ($property in $firstItem.PSObject.Properties) { | ||
if ($StartingRowIndex -eq 2 -and $Worksheet.Cells[1, $colIndex].Value -eq $null) { | ||
$Worksheet.Cells[1, $colIndex].Value = $property.Name | ||
} | ||
$colIndex++ | ||
} | ||
|
||
# Iterate over each row in the data and update cells | ||
$rowIndex = $StartingRowIndex | ||
foreach ($item in $Data) { | ||
$colIndex = 1 | ||
foreach ($property in $item.PSObject.Properties) { | ||
$Worksheet.Cells[$rowIndex, $colIndex].Value = $property.Value | ||
$colIndex++ | ||
} | ||
$rowIndex++ | ||
} | ||
# Iterate over each row in the data and update cells | ||
$rowIndex = $StartingRowIndex | ||
foreach ($item in $Data) { | ||
$colIndex = 1 | ||
foreach ($property in $item.PSObject.Properties) { | ||
$Worksheet.Cells[$rowIndex, $colIndex].Value = $property.Value | ||
$colIndex++ | ||
} | ||
$rowIndex++ | ||
} | ||
} |
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
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,27 @@ | ||
$ProjectPath = "$PSScriptRoot\..\..\.." | Convert-Path | ||
$ProjectName = ((Get-ChildItem -Path $ProjectPath\*\*.psd1).Where{ | ||
($_.Directory.Name -match 'source|src' -or $_.Directory.Name -eq $_.BaseName) -and | ||
$(try { Test-ModuleManifest $_.FullName -ErrorAction Stop } catch { $false } ) | ||
}).BaseName | ||
|
||
|
||
Import-Module $ProjectName | ||
|
||
InModuleScope $ProjectName { | ||
Describe Get-PrivateFunction { | ||
Context 'Default' { | ||
BeforeEach { | ||
$return = Get-PrivateFunction -PrivateData 'string' | ||
} | ||
|
||
It 'Returns a single object' { | ||
($return | Measure-Object).Count | Should -Be 1 | ||
} | ||
|
||
It 'Returns a string based on the parameter PrivateData' { | ||
$return | Should -Be 'string' | ||
} | ||
} | ||
} | ||
} | ||
|