diff --git a/.MetaTestOptIn.json b/.MetaTestOptIn.json deleted file mode 100644 index ebcc985a..00000000 --- a/.MetaTestOptIn.json +++ /dev/null @@ -1,12 +0,0 @@ -[ - "Common Tests - Validate Markdown Files", - "Common Tests - Validate Module Files", - "Common Tests - Validate Script Files", - "Common Tests - Validate Example Files", - "Common Tests - Required Script Analyzer Rules", - "Common Tests - New Error-Level Script Analyzer Rules", - "Common Tests - Custom Script Analyzer Rules", - "Common Tests - Flagged Script Analyzer Rules", - "Common Tests - Relative Path Length", - "Common Tests - Validate Markdown Links" -] diff --git a/.codecov.yml b/.codecov.yml deleted file mode 100644 index 29a05dd1..00000000 --- a/.codecov.yml +++ /dev/null @@ -1,24 +0,0 @@ -codecov: - notify: - require_ci_to_pass: no - -comment: - layout: "reach, diff" - behavior: default - -coverage: - range: 50..80 - round: down - precision: 0 - - status: - project: - default: - # Set the overall project code coverage requirement to 70% - target: 70 - patch: - default: - # Set the pull request requirement to not regress overall coverage by more than 5% - # and let codecov.io set the goal for the code changed in the patch. - target: auto - threshold: 5 diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md new file mode 100644 index 00000000..f6895ab3 --- /dev/null +++ b/.github/CONTRIBUTING.md @@ -0,0 +1,3 @@ +# Contributing + +Please check out common DSC Community [contributing guidelines](https://dsccommunity.org/guidelines/contributing). diff --git a/.github/ISSUE_TEMPLATE/Problem_with_resource.md b/.github/ISSUE_TEMPLATE/Problem_with_resource.md index a839d484..11a6230b 100644 --- a/.github/ISSUE_TEMPLATE/Problem_with_resource.md +++ b/.github/ISSUE_TEMPLATE/Problem_with_resource.md @@ -56,7 +56,7 @@ about: If you have a problem, bug, or enhancement with a resource in this resour $PSVersionTable --> -#### Version of the DSC module that was used ('dev' if using current dev branch) +#### Version of the DSC module that was used #### This Pull Request (PR) fixes the following issues @@ -34,14 +37,16 @@ Change to [x] for each task in the task list that applies to your PR. For those task that don't apply to you PR, leave those as is. --> -- [ ] Added an entry under the Unreleased section of the change log in the CHANGELOG.md. - Entry should say what was changed, and how that affects users (if applicable). +- [ ] Added an entry to the change log under the Unreleased section of the + file CHANGELOG.md. Entry should say what was changed and how that + affects users (if applicable), and reference the issue being resolved + (if applicable). - [ ] Resource documentation added/updated in README.md. - [ ] Resource parameter descriptions added/updated in README.md, schema.mof and comment-based help. - [ ] Comment-based help added/updated. - [ ] Localization strings added/updated in all localization files as appropriate. - [ ] Examples appropriately added/updated. -- [ ] Unit tests added/updated. See [DSC Resource Testing Guidelines](https://github.com/PowerShell/DscResources/blob/master/TestsGuidelines.md). -- [ ] Integration tests added/updated (where possible). See [DSC Resource Testing Guidelines](https://github.com/PowerShell/DscResources/blob/master/TestsGuidelines.md). -- [ ] New/changed code adheres to [DSC Resource Style Guidelines](https://github.com/PowerShell/DscResources/blob/master/StyleGuidelines.md) and [Best Practices](https://github.com/PowerShell/DscResources/blob/master/BestPractices.md). +- [ ] Unit tests added/updated. See [DSC Community Testing Guidelines](https://dsccommunity.org/guidelines/testing-guidelines). +- [ ] Integration tests added/updated (where possible). See [DSC Community Testing Guidelines](https://dsccommunity.org/guidelines/testing-guidelines). +- [ ] New/changed code adheres to [DSC Community Style Guidelines](https://dsccommunity.org/styleguidelines). diff --git a/.gitignore b/.gitignore index b03606ad..ea1472ec 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -DSCResource.Tests +output/ diff --git a/CHANGELOG.md b/CHANGELOG.md index 389c59f0..0db51ba2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,593 +1,32 @@ # Change log for xExchange -## Unreleased +The format is based on and uses the types of changes according to [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +For older change log history see the [historic changelog](HISTORIC_CHANGELOG.md). + +## [Unreleased] + +### Added - Added xExchAddressList ressource - Added xExchSendConnector resource + +### Changed + - Added additional parameters to the MSFT_xExchImapSettings resource - Added additional parameters to the xExchMailboxTransportService resource - Fixed unit test it statement for MSFT_xExchAutodiscoverVirtualDirectory\Test-TargetResource +- Migrated to Azure DevOps Release model -## 1.30.0.0 +## [1.30.0.0] - 2019-10-30 + +### Added -- Resolved custom Script Analyzer rules that was added to the test framework. - Added xExchAcceptedDomain resource -- Resolved hashtable styling issues - Added xExchRemoteDomain resource -## 1.29.0.0 - -- Enable Script Analyzer default rules -- Add the AutoDagBitlockerEnabled parameter to DSC resource MSFT_xExchDatabaseAvailabilityGroup -- Fixed keywords in upper case - -## 1.28.0.0 - -- Added MSFT_xExchFrontendTransportService resource, based on - MSFT_xExchTransportService resource. - [Issue #283](https://github.com/PowerShell/xExchange/issues/283) -- Added unit and integration tests to the MSFT_xExchFrontendTransportService resource. -- Added comment based help to the MSFT_xExchFrontendTransportService resource. -- Minor style fix in MSFT_xExchEcpVirtualDirectory to ensure new PowerShell - Script Analyzer custom rules pass. - -## 1.27.0.0 - -- Added additional parameters to the MSFT_xExchTransportService resource -- Added additional parameters to the MSFT_xExchEcpVirtualDirectory resource -- Added additional unit tests to the MSFT_xExchAutodiscoverVirutalDirectory resource -- Added additional parameters to the MSFT_xExchExchangeCertificate resource -- MSFT_xExchMailboxDatabase: Fixes issue with DataMoveReplicationConstraint - parameter (#401) -- Added additional parameters and comment based help to the - MSFT_xExchMailboxDatabase resource -- Move code that sets $global:DSCMachineStatus into a dedicated helper - function. - [Issue #407](https://github.com/PowerShell/xExchange/issues/407) -- Add missing parameters for xExchMailboxDatabaseCopy, adds comment based help, - and adds remaining Unit tests. - -## 1.26.0.0 - -- Add support for Exchange Server 2019 -- Added additional parameters to the MSFT_xExchUMService resource -- Rename improperly named functions, and add comment based help in - MSFT_xExchClientAccessServer, MSFT_xExchDatabaseAvailabilityGroupNetwork, - MSFT_xExchEcpVirtualDirectory, MSFT_xExchExchangeCertificate, - MSFT_xExchImapSettings. -- Added additional parameters to the MSFT_xExchUMCallRouterSettings resource -- Rename improper function names in MSFT_xExchDatabaseAvailabilityGroup, - MSFT_xExchJetstress, MSFT_xExchJetstressCleanup, MSFT_xExchMailboxDatabase, - MSFT_xExchMailboxDatabaseCopy, MSFT_xExchMailboxServer, - MSFT_xExchMaintenanceMode, MSFT_xExchMapiVirtualDirectory, - MSFT_xExchOabVirtualDirectory, MSFT_xExchOutlookAnywhere, - MSFT_xExchOwaVirtualDirectory, MSFT_xExchPopSettings, - MSFT_xExchPowershellVirtualDirectory, MSFT_xExchReceiveConnector, - MSFT_xExchWaitForMailboxDatabase, and MSFT_xExchWebServicesVirtualDirectory. -- Add remaining unit and integration tests for MSFT_xExchExchangeServer. - -## 1.25.0.0 - -- Opt-in for the common test flagged Script Analyzer rules - ([issue #234](https://github.com/PowerShell/xExchange/issues/234)). -- Opt-in for the common test testing for relative path length. -- Removed the property `PSDscAllowPlainTextPassword` from all examples - so the examples are secure by default. The property - `PSDscAllowPlainTextPassword` was previously needed to (test) compile - the examples in the CI pipeline, but now the CI pipeline is using a - certificate to compile the examples. -- Opt-in for the common test that validates the markdown links. -- Fix typo of the word 'Certificate' in several example files. -- Add spaces between array members. -- Add initial set of Unit Tests (mostly Get-TargetResource tests) for all - remaining resource files. -- Add WaitForComputerObject parameter to xExchWaitForDAG -- Add spaces between comment hashtags and comments. -- Add space between variable types and variables. -- Fixes issue where xExchMailboxDatabase fails to test for a Journal Recipient - because the module did not load the Get-Recipient cmdlet (#335). -- Fixes broken Integration tests in - MSFT_xExchMaintenanceMode.Integration.Tests.ps1 (#336). -- Fix issue where Get-ReceiveConnector against an Absent connector causes an - error to be logged in the MSExchange Management log. -- Rename poorly named functions in xExchangeDiskPart.psm1 and - MSFT_xExchAutoMountPoint.psm1, and add comment based help. - -## 1.24.0.0 - -- xExchangeHelper.psm1: Renamed common functions to use proper Verb-Noun - format. Also addresses many common style issues in functions in the file, as - well as in calls to these functions from other files. -- MSFT_xExchTransportService: Removed functions that were duplicates of helper - functions in xExchangeHelper.psm1. -- Fixes an issue where only objects of type Mailbox can be specified as a - Journal Recipient. Now MailUser and MailContact types can be used as well. -- Update appveyor.yml to use the default template. -- Added default template files .codecov.yml, .gitattributes, and .gitignore, and - .vscode folder. -- Add Unit Tests for xExchAntiMalwareScanning -- Add remaining Unit Tests for xExchInstall, and for most common setup - functions -- Added ActionForUnknownFileAndMIMETypes,WSSAccessOnPublicComputersEnabled, - WSSAccessOnPrivateComputersEnabled,UNCAccessOnPublicComputersEnabled - UNCAccessOnPrivateComputersEnabled and GzipLevel to xExchOwaVirtualDirectory. -- Added GzipLevel and AdminEnabled to xExchEcpVirtualDirectory. -- Added OAuthAuthentication to xExchOabVirtualDirectory. -- Updated readme with the new parameters and removed a bad parameter from - xExchOwaVirtualDirectory that did not actually exist. -- Updated .gitattributes to allow test .pfx files to be saved as binary -- Added Cumulative Update / Exchange update support to xExchInstall resource. -- Add remaining Unit Tests for all xExchangeHelper functions that don't - require the loading of Exchange DLL's. -- Renamed and moved file Examples/HelperScripts/ExchangeConfigHelper.psm1 to - Modules/xExchangeCalculatorHelper.psm1. Renamed functions within the module - to conform to proper function naming standards. Added remaining Unit tests - for module. - -## 1.23.0.0 - -- Fixes issue with xExchMaintenanceMode on Exchange 2016 where the cluster - does not get paused when going into maintenance mode. Also fixes issue - where services fail to stop, start, pause, or resume. -- Explicitly cast member types in Get-DscConfiguration return hashtables to - align with the types defined in the resource schemas. Fixes an issue where - Get-DscConfiguration fails to return a value. -- xExchClientAccessServer: Fixes issue where AlternateServiceAccountConfiguration - or RemoveAlternateServiceAccountCredentials parameters can't be used at the - same time as other optional parameters. -- xExchInstall: Fixes issue where Test-TargetResource returns true if setup is - running. Fixes issue where setup is not detected as having been successfully - completed even if setup was successful. Adds initial set of unit tests for - xExchInstall and related functions. -- Remove VerbosePreference from function parameters and update all calls to - changed functions. -- Fixes multiple PSScriptAnalyzer issues. Specifically, fixes all instances of - PSAvoidTrailingWhitespace, PSAvoidGlobalVars, - PSAvoidUsingConvertToSecureStringWithPlainText, PSUseSingularNouns, and - fixes many instances of PSUseDeclaredVarsMoreThanAssignments. -- Add support for Exchange Server 2019 - Preview - -## 1.22.0.0 - -- Fixed issue in xExchInstall where winrm config command fails to execute -- Fixed issue in xExchInstall where a failed Exchange setup run is not - reported, and subsequent DSC resources are allowed to run -- Fixed issue in xExchAutoMountPoint where Test-TargetResource fails - after mount points have been successfully configured. -- Fixed issue in xExchAutoMountPoint where Set-TargetResource fails - if EnsureExchangeVolumeMountPointIsLast parameter is specified. -- Updated xExchAutoMountPoint, xExchJetstressCleanup, and related DiskPart - functions to not use global variables. -- Fixes broken tests in: - MSFT_xExchDatabaseAvailabilityGroup.Integration.Tests.ps1, - MSFT_xExchExchangeCertificate.Integration.Tests.ps1, - MSFT_xExchOutlookAnywhere.Integration.Tests.ps1, - MSFT_xExchPopSettings.Integration.Tests.ps1, - xExchangeConfigHelper.Unit.Tests.ps1 -- Update most Test-TargetResource functions to output all invalid settings, - instead of just the first detected invalid setting - -## 1.21.0.0 - -- Added CHANGELOG.md file -- Added .markdownlint.json file -- Updated README.md and CHANGELOG.md files to respect MD009, MD0013 and MD032 rules -- Added .MetaTestOptIn.json file -- Updated appveyor.yml file -- Added .codecov.yml file -- Renamed Test folder to Tests -- Updated README.md: Add codecov badges -- Fixed PSSA required rules in: - - xExchClientAccessServer.psm1 - - xExchInstall.psm1 - - xExchMaintenanceMode.psm1 - - TransportMaintenance.psm1 - - xExchTransportService.psm1 -- Fixed Validate Example files in: - - ConfigureAutoMountPoints-FromCalculator.ps1 - - ConfigureAutoMountPoints-Manual.ps1 - - ConfigureDatabases-FromCalculator.ps1 - - InternetFacingSite.ps1 - - RegionalNamespaces.ps1 - - SingleNamespace.ps1 - - ConfigureVirtualDirectories.ps1 - - CreateAndConfigureDAG.ps1 - - EndToEndExample 1 to 10 files - - JetstressAutomation - - MaintenanceMode - - PostInstallationConfiguration.ps1 - - InstallExchange.ps1 - - QuickStartTemplate.ps1 - - WaitForADPrep.ps1 -- Remove default value for Switch Parameter in - TransportMaintenance.psm1 for functions: - - Clear-DiscardEvent - - LogIfRemain - - Wait-EmptyEntriesCompletion - - Update-EntriesTracker - - Remove-CompletedEntriesFromHashtable -- Fixed PSSA custom rules in: - - xExchActiveSyncVirtualDirectory.psm1 - - xExchAntiMalwareScanning.psm1 - - xExchAutodiscoverVirtualDirectory.psm1 - - xExchAutoMountPoint.psm1 - - xExchClientAccessServer.psm1 - - xExchDatabaseAvailabilityGroup.psm1 - - xExchDatabaseAvailabilityGroupMember.psm1 - - xExchDatabaseAvailabilityGroupNetwork.psm1 - - xExchEcpVirtualDirectory.psm1 - - xExchEventLogLevel.psm1 - - xExchExchangeCertificate.psm1 - - xExchExchangeServer.psm1 - - xExchImapSettings.psm1 - - xExchInstall.psm1 - - xExchJetstress.psm1 - - xExchJetstressCleanup.psm1 - - xExchMailboxDatabase.psm1 - - xExchMailboxDatabaseCopy.psm1 - - xExchMailboxServer.psm1 - - xExchMailboxTransportService.psm1 - - xExchMaintenanceMode.psm1 - - xExchMapiVirtualDirectory.psm1 - - xExchOabVirtualDirectory.psm1 - - xExchOutlookAnywhere.psm1 - - xExchOwaVirtualDirectory.psm1 - - xExchPopSettings.psm1 - - xExchPowerShellVirtualDirectory.psm1 - - xExchReceiveConnector.psm1 - - xExchUMCallRouterSettings.psm1 - - xExchUMService.psm1 - - xExchWaitForADPrep.psm1 - - xExchWaitForDAG.psm1 - - xExchWaitForMailboxDatabase.psm1 - - xExchWebServicesVirtualDirectory.psm1 -- Updated xExchange.psd1 -- Added issue template file (ISSUE\_TEMPLATE.md) for 'New Issue' and pull request - template file (PULL\_REQUEST\_TEMPLATE.md) for 'New Pull Request'. -- Fix issue Diagnostics.CodeAnalysis.SuppressMessageAttribute best practices -- Renamed xExchangeCommon.psm1 to xExchangeHelper.psm1 -- Renamed the folder MISC (that contains the helper) to Modules -- Added xExchangeHelper.psm1 in xExchange.psd1 (section NestedModules) -- Removed all lines with Import-Module xExchangeCommon.psm1 -- Updated .MetaTestOptIn.json file with Custom Script Analyzer Rules -- Added Integration, TestHelpers and Unit folder -- Moved Data folder in Tests -- Moved Integration tests to Integration folder -- Moved Unit test to Unit folder -- Renamed xEchange.Tests.Common.psm1 to xExchangeTestHelper.psm1 -- Renamed xEchangeCommon.Unit.Tests.ps1 to xExchangeCommon.Tests.ps1 -- Renamed function PrepTestDAG to Initialize-TestForDAG -- Moved function Initialize-TestForDAG to xExchangeTestHelper.psm1 -- Fix error-level PS Script Analyzer rules for TransportMaintenance.psm1 - -## 1.20.0.0 - -- Fix issue where test of type Microsoft.Exchange.Data.Unlimited fails - -## 1.19.0.0 - -- Added missing parameters to xExchActiveSyncVirtualDirectory -- Added missing parameters to xExchAutoDiscoverVirtualDirectory -- Added missing parameters to xExchWebServicesVirtualDirectory - -## 1.18.0.0 - -- Fix issue #203 and add additional test for invalid ASA account format - -## 1.17.0.0 - -- Fix issue where test for Unlimited quota fails if quota is not already set at Unlimited - -## 1.16.0.0 - -- Add missing parameters to xExchClientAccessServer - -## 1.15.0.0 - -- xExchDatabaseAvailabilityGroupMember: Added check to ensure Failover-Clustering - role is installed before adding server to DAG. -- xExchInstall: Remove parameter '-AllowImmediateReboot $AllowImmediateReboot' - when calling CheckWSManConfig. -- xExchOutlookAnywhere: Add test for ExternalClientAuthenticationMethod. -- Test: Update OAB and UMService tests to create test OAB and UMDialPlans, respectively. -- Test: Update MailboxDatabase tests to use test OAB. Update DAG to skip DAG tests - and write error if cluster feature not installed. - -## 1.14.0.0 - -- xExchDatabaseAvailabilityGroup: - Added parameter AutoDagAutoRedistributeEnabled, PreferenceMoveFrequency - -## 1.13.0.0 +### Changed -- Fix function RemoveVersionSpecificParameters -- xExchMailboxServer: Added missing parameters except these, which are marked as - 'This parameter is reserved for internal Microsoft use.' - -## 1.12.0.0 - -- xExchangeCommon : In Start-ExchangeScheduledTask corrected throw error check - to throw - last error when errorRegister has more than 0 errors instead of throwing error - if errorRegister was not null, which would otherwise always be true. -- Fix PSAvoidUsingWMICmdlet issues from PSScriptAnalyzer -- Fix PSUseSingularNouns issues from PSScriptAnalyzer -- Fix PSAvoidUsingCmdletAliases issues from PSScriptAnalyzer -- Fix PSUseApprovedVerbs issues from PSScriptAnalyzer -- Fix PSAvoidUsingEmptyCatchBlock issues from PSScriptAnalyzer -- Fix PSUsePSCredentialType issues from PSScriptAnalyzer -- Fix erroneous PSDSCDscTestsPresent issues from PSScriptAnalyzer for modules - that do actually have tests in the root Tests folder -- Fix array comparison issues by removing check for if array is null -- Suppress PSDSCDscExamplesPresent PSScriptAnalyzer issues for resources - that do have examples -- Fix PSUseDeclaredVarsMoreThanAssignments issues from PSScriptAnalyzer -- Remove requirements for second DAG member, or second Witness server, - from MSFT_xExchDatabaseAvailabilityGroup.Integration.Tests - -## 1.11.0.0 - -- xExchActiveSyncVirtualDirectory: Fix issue where ClientCertAuth parameter set - to "Allowed" instead of "Accepted" - -## 1.10.0.0 - -- xExchAutoMountPoint: Fix malformed dash/hyphen characters -- Fix PSPossibleIncorrectComparisonWithNull issues from PowerShell Script Analyzer -- Suppress PSDSCUseVerboseMessageInDSCResource Warnings from PowerShell Script Analyzer - -## 1.9.0.0 - -- Converted appveyor.yml to install Pester from PSGallery instead of from Chocolatey. -- Added xExchMailboxTransportService resource -- xExchMailboxServer: Added WacDiscoveryEndpoint parameter - -## 1.8.0.0 - -- Fixed PSSA issues in: - - MSFT_xExchClientAccessServer - - MSFT_xExchAntiMalwareScanning - - MSFT_xExchWaitForMailboxDatabase - - MSFT_xExchWebServicesVirtualDirectory - - MSFT_xExchExchangeCertificate - - MSFT_xExchWaitForDAG - - MSFT_xExchUMService - - MSFT_xExchUMCallRouterSettings - - MSFT_xExchReceiveConnector - - MSFT_xExchPowershellVirtualDirectory - - MSFT_xExchPopSettings - - MSFT_xExchOwaVirtualDirectory - - MSFT_xExchOutlookAnywhere - - MSFT_xExchOabVirtualDirectory - - MSFT_xExchMapiVirtualDirectory - - MSFT_xExchMailboxServer - - MSFT_xExchImapSettings - - MSFT_xExchExchangeServer - - MSFT_xExchEventLogLevel - - MSFT_xExchEcpVirtualDirectory - - MSFT_xExchDatabaseAvailabilityGroupNetwork - - MSFT_xExchDatabaseAvailabilityGroupMember - - MSFT_xExchDatabaseAvailabilityGroup - -## 1.7.0.0 - -- xExchOwaVirtualDirectory - - Added `LogonFormat` parameter. - - Added `DefaultDomain` parameter. -- Added FileSystem parameter to xExchDatabaseAvailabilityGroup -- Fixed PSSA issues in MSFT_xExchAutodiscoverVirtualDirectory and MSFT_xExchActiveSyncVirtualDirectory -- Updated xExchAutoMountPoint to disable Integrity Checking when formatting volumes - as ReFS. This aligns with the latest version of DiskPart.ps1 from the Exchange - Server Role Requirements Calculator. - -## 1.6.0.0 - -- Added DialPlans parameter to xExchUMService - -## 1.5.0.0 - -- Added support for Exchange 2016! -- Added Pester tests for the following resources: - - xExchActiveSyncVirtualDirectory, - - xExchAutodiscoverVirtualDirectory, - - xExchClientAccessServer, - - xExchDatabaseAvailabilityGroup, - - xExchDatabaseAvailabilityGroupMember, - - xExchEcpVirtualDirectory, - - xExchExchangeServer, - - xExchImapSettings, - - xExchMailboxDatabase, - - xExchMailboxDatabaseCopy, - - xExchMapiVirtualDirectory, - - xExchOabVirtualDirectory, - - xExchOutlookAnywhere, - - xExchOwaVirtualDirectory, - - xExchPopSettings, - - xExchPowershellVirtualDirectory, - - xExchUMCallRouterSettings, - - xExchUMService, - - xExchWebServicesVirtualDirectory -- Fixed minor Get-TargetResource issues in xExchAutodiscoverVirtualDirectory, - xExchImapSettings, xExchPopSettings, xExchUMCallRouterSettings, and xExchWebServicesVirtualDirectory -- Added support for extended rights to resource xExchReceiveConnector (ExtendedRightAllowEntries/ExtendedRightDenyEntries) -- Fixed issue where Set-Targetresource is triggered each time consistency check - runs in xExchReceiveConnector due to extended permissions on Receive Connector -- Added parameter MaximumActiveDatabases and MaximumPreferredActiveDatabases to - resource xExchMailBoxServer - -## 1.4.0.0 - -- Added following resources: - - xExchMaintenanceMode - - xExchMailboxServer - - xExchTransportService - - xExchEventLogLevel -- For all -ExchangeCertificate functions in xExchExchangeCertificate, added - '-Server $env:COMPUTERNAME' switch. This will prevent the resource from - configuring a certificate on an incorrect server. -- Fixed issue with reading MailboxDatabases.csv in xExchangeConfigHelper.psm1 - caused by a column name changed introduced in v7.7 of the Exchange Server Role - Requirements Calculator. -- Changed function Get-RemoteExchangeSession so that it will throw an exception - if Exchange setup is in progress. This will prevent resources from trying to - execute while setup is running. -- Fixed issue where VirtualDirectory resources would incorrectly try to restart - a Back End Application Pool on a CAS role only server. -- Added support for the /AddUMLanguagePack parameter in xExchInstall - -## 1.3.0.0 - -- MSFT_xExchWaitForADPrep: Removed obsolete VerbosePreference parameter from Test-TargetResource -- Fixed encoding - -## 1.2.0.0 - -- xExchWaitForADPrep - - Removed `VerbosePreference` parameter of Test-TargetResource function to - resolve schema mismatch error. -- Added xExchAntiMalwareScanning resource -- xExchJetstress: - - Added fix for an issue where JetstressCmd.exe would not relaunch successfully - after ESE initialization. If Jetstress doesn't restart, the resource will - now require a reboot before proceeding. -- xExchOwaVirtualDirectory: - - Added `ChangePasswordEnabled` parameter - - Added `LogonPagePublicPrivateSelectionEnabled` parameter - - Added `LogonPageLightSelectionEnabled` parameter -- xExchImapSettings: - - Added `ExternalConnectionSettings` parameter - - Added `X509CertificateName` parameter -- xExchPopSettings: - - Added `ExternalConnectionSettings` parameter - - Added `X509CertificateName` parameter -- Added EndToEndExample -- Fixed bug where Start-ExchangeScheduledTask would throw an error message and - fail to - set ExecutionTimeLimit and Priority when using domain credentials - -## 1.1.0.0 - -- xExchAutoMountPoint: - Added parameter `EnsureExchangeVolumeMountPointIsLast` -- xExchExchangeCertificate: - Added error logging for the `Enable-ExchangeCertificate` cmdlet -- xExchExchangeServer: - Added pre-check for deprecated Set-ExchangeServer parameter, WorkloadManagementPolicy -- xExchJetstressCleanup: - When OutputSaveLocation is specified, Stress- files will also now be saved - -- xExchMailboxDatabase: - - Added `AdServerSettingsPreferredServer` parameter - - Added `SkipInitialDatabaseMount` parameter, which can help in an enviroments - where databases need time to be able to mount successfully after creation - - Added better error logging for `Mount-Database` - - Databases will only be mounted at initial database creation - if `MountAtStartup` is `$true` or not specified - -- xExchMailboxDatabaseCopy: - - Added `SeedingPostponed` parameter - - Added `AdServerSettingsPreferredServer` parameter - - Changed so that `ActivationPreference` will only be set if the number of - existing copies for the database is greater than or equal to the specified ActivationPreference - - Changed so that a seed of a new copy is only performed if `SeedingPostponed` - is not specified or set to `$false` - - Added better error logging for `Add-MailboxDatabaseCopy` - - Added missing tests for `EdbFilePath` and `LogFolderPath` - -- xExchOwaVirtualDirectory: Added missing test for `InstantMessagingServerName` - -- xExchWaitForMailboxDatabase: Added `AdServerSettingsPreferredServer` parameter - -- ExchangeConfigHelper.psm1: Updated `DBListFromMailboxDatabaseCopiesCsv` so - that the DB copies that are returned are sorted by Activation Preference - in ascending order. - -## 1.0.3.11 - -- xExchJetstress Changes: - - Changed default for MaxWaitMinutes from 4320 to 0 - - Added property MinAchievedIOPS - - Changed priority of the JetstressCmd.exe Scheduled Task from - the default of 7 to 4 -- xExchJetstressCleanup Changes: - - Fixed issue which caused the cleanup to not work properly when only - a single database is used in JetstressConfig.xml -- xExchAutoMountPoint Changes: - - Updated resource to choose the next available EXVOL mount point to use for - databases numerically by volume number instead of alphabetically by volume - number (ie. EXVOL2 would be selected after EXVOL1 instead of EXVOL11, - which is alphabetically closer). - -## 1.0.3.6 - -- Added the following resources: - - xExchInstall - - xExchJetstress - - xExchJetstressCleanup - - xExchUMCallRouterSettings - - xExchWaitForADPrep -- xExchActiveSyncVirtualDirectory Changes: - - Fixed an issue where if AutoCertBasedAuth was being configured, - it would result in an IISReset and an app pool recycle. - Now only an IISReset will occur in this scenario. -- xExchAutoMountPoint Changes: - - Added CreateSubfolders parameter - - Moved many DiskPart functions into helper file Misc\xExchangeDiskPart.ps1 - - Updated so that ExchangeVolume mount points will be listed AFTER - ExchangeDatabase mount points on the same disk -- xExchExchangeCertificate Changes: - - Changed behavior so that if UM or UMCallRouter services are being enabled, - the UM or UMCallRouter services will be stopped before the enablement, - then restarted after the enablement. -- xExchMailboxDatabase Changes: - - Fixed an issue where the OfflineAddressBook property would not be - tested properly depending on if a slash was specified or not at - the beginning of the OAB name. Now the slash doesn't matter. -- xExchOutlookAnywhere Changes: - - Changed the test for ExternalClientsRequireSsl to only fire - if ExternalHostname is also specified. -- xExchUMService Changes: - - Fixed issue that was preventing tests from evaluating properly. -- Example Updates: - - Added example folder InstallExchange - - Added example folder JetstressAutomation - - Added example folder WaitForADPrep - - Renamed EndToEndExample to PostInstallationConfiguration - - Updated Start-DscConfiguration commands in ConfigureDatabasesFromCalculator, - ConfigureDatabasesManual, ConfigureVirtualDirectories, CreateAndConfigureDAG, - and EndToEndExample, as they were missing a required space between parameters - -## 1.0.1.0 - -- Updated all Examples with minor comment changes, and re-wrote the examples - ConfigureAutoMountPoint-FromCalculator and ConfigureAutoMountPoints-Manual. -- Updated Exchange Server Role Requirement Calculator examples - from version 6.3 to 6.6 - -## 1.0.0.0 - -- Initial release with the following resources: - - xExchActiveSyncVirtualDirectory - - xExchAutodiscoverVirtualDirectory - - xExchAutoMountPoint - - xExchClientAccessServer - - xExchDatabaseAvailabilityGroup - - xExchDatabaseAvailabilityGroupMember - - xExchDatabaseAvailabilityGroupNetwork - - xExchEcpVirtualDirectory - - xExchExchangeCertificate - - xExchExchangeServer - - xExchImapSettings - - xExchMailboxDatabase - - xExchMailboxDatabaseCopy - - xExchMapiVirtualDirectory - - xExchOabVirtualDirectory - - xExchOutlookAnywhere - - xExchOwaVirtualDirectory - - xExchPopSettings - - xExchPowerShellVirtualDirectory - - xExchReceiveConnector - - xExchUMService - - xExchWaitForDAG - - xExchWaitForMailboxDatabase - - xExchWebServicesVirtualDirectory +- Resolved custom Script Analyzer rules that was added to the test framework. +- Resolved hashtable styling issues diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 00000000..d7589ddb --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,3 @@ +# Code of Conduct + +This project has adopted the [DSC Community Code of Conduct](https://dsccommunity.org/code_of_conduct). diff --git a/GitVersion.yml b/GitVersion.yml new file mode 100644 index 00000000..1858eee4 --- /dev/null +++ b/GitVersion.yml @@ -0,0 +1,37 @@ +mode: ContinuousDelivery +next-version: 1.31.0.0 +major-version-bump-message: '\s?(breaking|major|breaking\schange)' +minor-version-bump-message: '\s?(add|feature|minor)' +patch-version-bump-message: '\s?(fix|patch)' +no-bump-message: '\+semver:\s?(none|skip)' +assembly-informational-format: "{NuGetVersionV2}+Sha.{Sha}.Date.{CommitDate}" +branches: + master: + tag: preview + pull-request: + tag: PR + feature: + tag: useBranchName + increment: Minor + regex: f(eature(s)?)?[/-] + source-branches: ["master"] + hotfix: + tag: fix + increment: Patch + regex: (hot)?fix(es)?[/-] + source-branches: ["master"] + +ignore: + sha: [] + commits-before: 2019-10-23T00:00:00 +merge-message-formats: {} +# feature: +# tag: useBranchName +# increment: Minor +# regex: f(eature(s)?)?[/-] +# source-branches: ['master'] +# hotfix: +# tag: fix +# increment: Patch +# regex: (hot)?fix(es)?[/-] +# source-branches: ['master'] diff --git a/HISTORIC_CHANGELOG.md b/HISTORIC_CHANGELOG.md new file mode 100644 index 00000000..cf1ba1a9 --- /dev/null +++ b/HISTORIC_CHANGELOG.md @@ -0,0 +1,583 @@ +# Historic change log for xExchange + +The release notes in the PowerShell Module manifest cannot exceed 10000 +characters. Due to a bug in the CI deploy pipeline this is not handled. +This file is to temporary move the older change log history to keep the +change log short. + +## 1.29.0.0 + +- Enable Script Analyzer default rules +- Add the AutoDagBitlockerEnabled parameter to DSC resource MSFT_xExchDatabaseAvailabilityGroup +- Fixed keywords in upper case + +## 1.28.0.0 + +- Added MSFT_xExchFrontendTransportService resource, based on + MSFT_xExchTransportService resource. + [Issue #283](https://github.com/PowerShell/xExchange/issues/283) +- Added unit and integration tests to the MSFT_xExchFrontendTransportService resource. +- Added comment based help to the MSFT_xExchFrontendTransportService resource. +- Minor style fix in MSFT_xExchEcpVirtualDirectory to ensure new PowerShell + Script Analyzer custom rules pass. + +## 1.27.0.0 + +- Added additional parameters to the MSFT_xExchTransportService resource +- Added additional parameters to the MSFT_xExchEcpVirtualDirectory resource +- Added additional unit tests to the MSFT_xExchAutodiscoverVirutalDirectory resource +- Added additional parameters to the MSFT_xExchExchangeCertificate resource +- MSFT_xExchMailboxDatabase: Fixes issue with DataMoveReplicationConstraint + parameter (#401) +- Added additional parameters and comment based help to the + MSFT_xExchMailboxDatabase resource +- Move code that sets $global:DSCMachineStatus into a dedicated helper + function. + [Issue #407](https://github.com/PowerShell/xExchange/issues/407) +- Add missing parameters for xExchMailboxDatabaseCopy, adds comment based help, + and adds remaining Unit tests. + +## 1.26.0.0 + +- Add support for Exchange Server 2019 +- Added additional parameters to the MSFT_xExchUMService resource +- Rename improperly named functions, and add comment based help in + MSFT_xExchClientAccessServer, MSFT_xExchDatabaseAvailabilityGroupNetwork, + MSFT_xExchEcpVirtualDirectory, MSFT_xExchExchangeCertificate, + MSFT_xExchImapSettings. +- Added additional parameters to the MSFT_xExchUMCallRouterSettings resource +- Rename improper function names in MSFT_xExchDatabaseAvailabilityGroup, + MSFT_xExchJetstress, MSFT_xExchJetstressCleanup, MSFT_xExchMailboxDatabase, + MSFT_xExchMailboxDatabaseCopy, MSFT_xExchMailboxServer, + MSFT_xExchMaintenanceMode, MSFT_xExchMapiVirtualDirectory, + MSFT_xExchOabVirtualDirectory, MSFT_xExchOutlookAnywhere, + MSFT_xExchOwaVirtualDirectory, MSFT_xExchPopSettings, + MSFT_xExchPowershellVirtualDirectory, MSFT_xExchReceiveConnector, + MSFT_xExchWaitForMailboxDatabase, and MSFT_xExchWebServicesVirtualDirectory. +- Add remaining unit and integration tests for MSFT_xExchExchangeServer. + +## 1.25.0.0 + +- Opt-in for the common test flagged Script Analyzer rules + ([issue #234](https://github.com/PowerShell/xExchange/issues/234)). +- Opt-in for the common test testing for relative path length. +- Removed the property `PSDscAllowPlainTextPassword` from all examples + so the examples are secure by default. The property + `PSDscAllowPlainTextPassword` was previously needed to (test) compile + the examples in the CI pipeline, but now the CI pipeline is using a + certificate to compile the examples. +- Opt-in for the common test that validates the markdown links. +- Fix typo of the word 'Certificate' in several example files. +- Add spaces between array members. +- Add initial set of Unit Tests (mostly Get-TargetResource tests) for all + remaining resource files. +- Add WaitForComputerObject parameter to xExchWaitForDAG +- Add spaces between comment hashtags and comments. +- Add space between variable types and variables. +- Fixes issue where xExchMailboxDatabase fails to test for a Journal Recipient + because the module did not load the Get-Recipient cmdlet (#335). +- Fixes broken Integration tests in + MSFT_xExchMaintenanceMode.Integration.Tests.ps1 (#336). +- Fix issue where Get-ReceiveConnector against an Absent connector causes an + error to be logged in the MSExchange Management log. +- Rename poorly named functions in xExchangeDiskPart.psm1 and + MSFT_xExchAutoMountPoint.psm1, and add comment based help. + +## 1.24.0.0 + +- xExchangeHelper.psm1: Renamed common functions to use proper Verb-Noun + format. Also addresses many common style issues in functions in the file, as + well as in calls to these functions from other files. +- MSFT_xExchTransportService: Removed functions that were duplicates of helper + functions in xExchangeHelper.psm1. +- Fixes an issue where only objects of type Mailbox can be specified as a + Journal Recipient. Now MailUser and MailContact types can be used as well. +- Update appveyor.yml to use the default template. +- Added default template files .codecov.yml, .gitattributes, and .gitignore, and + .vscode folder. +- Add Unit Tests for xExchAntiMalwareScanning +- Add remaining Unit Tests for xExchInstall, and for most common setup + functions +- Added ActionForUnknownFileAndMIMETypes,WSSAccessOnPublicComputersEnabled, + WSSAccessOnPrivateComputersEnabled,UNCAccessOnPublicComputersEnabled + UNCAccessOnPrivateComputersEnabled and GzipLevel to xExchOwaVirtualDirectory. +- Added GzipLevel and AdminEnabled to xExchEcpVirtualDirectory. +- Added OAuthAuthentication to xExchOabVirtualDirectory. +- Updated readme with the new parameters and removed a bad parameter from + xExchOwaVirtualDirectory that did not actually exist. +- Updated .gitattributes to allow test .pfx files to be saved as binary +- Added Cumulative Update / Exchange update support to xExchInstall resource. +- Add remaining Unit Tests for all xExchangeHelper functions that don't + require the loading of Exchange DLL's. +- Renamed and moved file Examples/HelperScripts/ExchangeConfigHelper.psm1 to + Modules/xExchangeCalculatorHelper.psm1. Renamed functions within the module + to conform to proper function naming standards. Added remaining Unit tests + for module. + +## 1.23.0.0 + +- Fixes issue with xExchMaintenanceMode on Exchange 2016 where the cluster + does not get paused when going into maintenance mode. Also fixes issue + where services fail to stop, start, pause, or resume. +- Explicitly cast member types in Get-DscConfiguration return hashtables to + align with the types defined in the resource schemas. Fixes an issue where + Get-DscConfiguration fails to return a value. +- xExchClientAccessServer: Fixes issue where AlternateServiceAccountConfiguration + or RemoveAlternateServiceAccountCredentials parameters can't be used at the + same time as other optional parameters. +- xExchInstall: Fixes issue where Test-TargetResource returns true if setup is + running. Fixes issue where setup is not detected as having been successfully + completed even if setup was successful. Adds initial set of unit tests for + xExchInstall and related functions. +- Remove VerbosePreference from function parameters and update all calls to + changed functions. +- Fixes multiple PSScriptAnalyzer issues. Specifically, fixes all instances of + PSAvoidTrailingWhitespace, PSAvoidGlobalVars, + PSAvoidUsingConvertToSecureStringWithPlainText, PSUseSingularNouns, and + fixes many instances of PSUseDeclaredVarsMoreThanAssignments. +- Add support for Exchange Server 2019 - Preview + +## 1.22.0.0 + +- Fixed issue in xExchInstall where winrm config command fails to execute +- Fixed issue in xExchInstall where a failed Exchange setup run is not + reported, and subsequent DSC resources are allowed to run +- Fixed issue in xExchAutoMountPoint where Test-TargetResource fails + after mount points have been successfully configured. +- Fixed issue in xExchAutoMountPoint where Set-TargetResource fails + if EnsureExchangeVolumeMountPointIsLast parameter is specified. +- Updated xExchAutoMountPoint, xExchJetstressCleanup, and related DiskPart + functions to not use global variables. +- Fixes broken tests in: + MSFT_xExchDatabaseAvailabilityGroup.Integration.Tests.ps1, + MSFT_xExchExchangeCertificate.Integration.Tests.ps1, + MSFT_xExchOutlookAnywhere.Integration.Tests.ps1, + MSFT_xExchPopSettings.Integration.Tests.ps1, + xExchangeConfigHelper.Unit.Tests.ps1 +- Update most Test-TargetResource functions to output all invalid settings, + instead of just the first detected invalid setting + +## 1.21.0.0 + +- Added CHANGELOG.md file +- Added .markdownlint.json file +- Updated README.md and CHANGELOG.md files to respect MD009, MD0013 and MD032 rules +- Added .MetaTestOptIn.json file +- Updated appveyor.yml file +- Added .codecov.yml file +- Renamed Test folder to Tests +- Updated README.md: Add codecov badges +- Fixed PSSA required rules in: + - xExchClientAccessServer.psm1 + - xExchInstall.psm1 + - xExchMaintenanceMode.psm1 + - TransportMaintenance.psm1 + - xExchTransportService.psm1 +- Fixed Validate Example files in: + - ConfigureAutoMountPoints-FromCalculator.ps1 + - ConfigureAutoMountPoints-Manual.ps1 + - ConfigureDatabases-FromCalculator.ps1 + - InternetFacingSite.ps1 + - RegionalNamespaces.ps1 + - SingleNamespace.ps1 + - ConfigureVirtualDirectories.ps1 + - CreateAndConfigureDAG.ps1 + - EndToEndExample 1 to 10 files + - JetstressAutomation + - MaintenanceMode + - PostInstallationConfiguration.ps1 + - InstallExchange.ps1 + - QuickStartTemplate.ps1 + - WaitForADPrep.ps1 +- Remove default value for Switch Parameter in + TransportMaintenance.psm1 for functions: + - Clear-DiscardEvent + - LogIfRemain + - Wait-EmptyEntriesCompletion + - Update-EntriesTracker + - Remove-CompletedEntriesFromHashtable +- Fixed PSSA custom rules in: + - xExchActiveSyncVirtualDirectory.psm1 + - xExchAntiMalwareScanning.psm1 + - xExchAutodiscoverVirtualDirectory.psm1 + - xExchAutoMountPoint.psm1 + - xExchClientAccessServer.psm1 + - xExchDatabaseAvailabilityGroup.psm1 + - xExchDatabaseAvailabilityGroupMember.psm1 + - xExchDatabaseAvailabilityGroupNetwork.psm1 + - xExchEcpVirtualDirectory.psm1 + - xExchEventLogLevel.psm1 + - xExchExchangeCertificate.psm1 + - xExchExchangeServer.psm1 + - xExchImapSettings.psm1 + - xExchInstall.psm1 + - xExchJetstress.psm1 + - xExchJetstressCleanup.psm1 + - xExchMailboxDatabase.psm1 + - xExchMailboxDatabaseCopy.psm1 + - xExchMailboxServer.psm1 + - xExchMailboxTransportService.psm1 + - xExchMaintenanceMode.psm1 + - xExchMapiVirtualDirectory.psm1 + - xExchOabVirtualDirectory.psm1 + - xExchOutlookAnywhere.psm1 + - xExchOwaVirtualDirectory.psm1 + - xExchPopSettings.psm1 + - xExchPowerShellVirtualDirectory.psm1 + - xExchReceiveConnector.psm1 + - xExchUMCallRouterSettings.psm1 + - xExchUMService.psm1 + - xExchWaitForADPrep.psm1 + - xExchWaitForDAG.psm1 + - xExchWaitForMailboxDatabase.psm1 + - xExchWebServicesVirtualDirectory.psm1 +- Updated xExchange.psd1 +- Added issue template file (ISSUE\_TEMPLATE.md) for 'New Issue' and pull request + template file (PULL\_REQUEST\_TEMPLATE.md) for 'New Pull Request'. +- Fix issue Diagnostics.CodeAnalysis.SuppressMessageAttribute best practices +- Renamed xExchangeCommon.psm1 to xExchangeHelper.psm1 +- Renamed the folder MISC (that contains the helper) to Modules +- Added xExchangeHelper.psm1 in xExchange.psd1 (section NestedModules) +- Removed all lines with Import-Module xExchangeCommon.psm1 +- Updated .MetaTestOptIn.json file with Custom Script Analyzer Rules +- Added Integration, TestHelpers and Unit folder +- Moved Data folder in Tests +- Moved Integration tests to Integration folder +- Moved Unit test to Unit folder +- Renamed xEchange.Tests.Common.psm1 to xExchangeTestHelper.psm1 +- Renamed xEchangeCommon.Unit.Tests.ps1 to xExchangeCommon.Tests.ps1 +- Renamed function PrepTestDAG to Initialize-TestForDAG +- Moved function Initialize-TestForDAG to xExchangeTestHelper.psm1 +- Fix error-level PS Script Analyzer rules for TransportMaintenance.psm1 + +## 1.20.0.0 + +- Fix issue where test of type Microsoft.Exchange.Data.Unlimited fails + +## 1.19.0.0 + +- Added missing parameters to xExchActiveSyncVirtualDirectory +- Added missing parameters to xExchAutoDiscoverVirtualDirectory +- Added missing parameters to xExchWebServicesVirtualDirectory + +## 1.18.0.0 + +- Fix issue #203 and add additional test for invalid ASA account format + +## 1.17.0.0 + +- Fix issue where test for Unlimited quota fails if quota is not already set at Unlimited + +## 1.16.0.0 + +- Add missing parameters to xExchClientAccessServer + +## 1.15.0.0 + +- xExchDatabaseAvailabilityGroupMember: Added check to ensure Failover-Clustering + role is installed before adding server to DAG. +- xExchInstall: Remove parameter '-AllowImmediateReboot $AllowImmediateReboot' + when calling CheckWSManConfig. +- xExchOutlookAnywhere: Add test for ExternalClientAuthenticationMethod. +- Test: Update OAB and UMService tests to create test OAB and UMDialPlans, respectively. +- Test: Update MailboxDatabase tests to use test OAB. Update DAG to skip DAG tests + and write error if cluster feature not installed. + +## 1.14.0.0 + +- xExchDatabaseAvailabilityGroup: + Added parameter AutoDagAutoRedistributeEnabled, PreferenceMoveFrequency + +## 1.13.0.0 + +- Fix function RemoveVersionSpecificParameters +- xExchMailboxServer: Added missing parameters except these, which are marked as + 'This parameter is reserved for internal Microsoft use.' + +## 1.12.0.0 + +- xExchangeCommon : In Start-ExchangeScheduledTask corrected throw error check + to throw + last error when errorRegister has more than 0 errors instead of throwing error + if errorRegister was not null, which would otherwise always be true. +- Fix PSAvoidUsingWMICmdlet issues from PSScriptAnalyzer +- Fix PSUseSingularNouns issues from PSScriptAnalyzer +- Fix PSAvoidUsingCmdletAliases issues from PSScriptAnalyzer +- Fix PSUseApprovedVerbs issues from PSScriptAnalyzer +- Fix PSAvoidUsingEmptyCatchBlock issues from PSScriptAnalyzer +- Fix PSUsePSCredentialType issues from PSScriptAnalyzer +- Fix erroneous PSDSCDscTestsPresent issues from PSScriptAnalyzer for modules + that do actually have tests in the root Tests folder +- Fix array comparison issues by removing check for if array is null +- Suppress PSDSCDscExamplesPresent PSScriptAnalyzer issues for resources + that do have examples +- Fix PSUseDeclaredVarsMoreThanAssignments issues from PSScriptAnalyzer +- Remove requirements for second DAG member, or second Witness server, + from MSFT_xExchDatabaseAvailabilityGroup.Integration.Tests + +## 1.11.0.0 + +- xExchActiveSyncVirtualDirectory: Fix issue where ClientCertAuth parameter set + to "Allowed" instead of "Accepted" + +## 1.10.0.0 + +- xExchAutoMountPoint: Fix malformed dash/hyphen characters +- Fix PSPossibleIncorrectComparisonWithNull issues from PowerShell Script Analyzer +- Suppress PSDSCUseVerboseMessageInDSCResource Warnings from PowerShell Script Analyzer + +## 1.9.0.0 + +- Converted appveyor.yml to install Pester from PSGallery instead of from Chocolatey. +- Added xExchMailboxTransportService resource +- xExchMailboxServer: Added WacDiscoveryEndpoint parameter + +## 1.8.0.0 + +- Fixed PSSA issues in: + - MSFT_xExchClientAccessServer + - MSFT_xExchAntiMalwareScanning + - MSFT_xExchWaitForMailboxDatabase + - MSFT_xExchWebServicesVirtualDirectory + - MSFT_xExchExchangeCertificate + - MSFT_xExchWaitForDAG + - MSFT_xExchUMService + - MSFT_xExchUMCallRouterSettings + - MSFT_xExchReceiveConnector + - MSFT_xExchPowershellVirtualDirectory + - MSFT_xExchPopSettings + - MSFT_xExchOwaVirtualDirectory + - MSFT_xExchOutlookAnywhere + - MSFT_xExchOabVirtualDirectory + - MSFT_xExchMapiVirtualDirectory + - MSFT_xExchMailboxServer + - MSFT_xExchImapSettings + - MSFT_xExchExchangeServer + - MSFT_xExchEventLogLevel + - MSFT_xExchEcpVirtualDirectory + - MSFT_xExchDatabaseAvailabilityGroupNetwork + - MSFT_xExchDatabaseAvailabilityGroupMember + - MSFT_xExchDatabaseAvailabilityGroup + +## 1.7.0.0 + +- xExchOwaVirtualDirectory + - Added `LogonFormat` parameter. + - Added `DefaultDomain` parameter. +- Added FileSystem parameter to xExchDatabaseAvailabilityGroup +- Fixed PSSA issues in MSFT_xExchAutodiscoverVirtualDirectory and MSFT_xExchActiveSyncVirtualDirectory +- Updated xExchAutoMountPoint to disable Integrity Checking when formatting volumes + as ReFS. This aligns with the latest version of DiskPart.ps1 from the Exchange + Server Role Requirements Calculator. + +## 1.6.0.0 + +- Added DialPlans parameter to xExchUMService + +## 1.5.0.0 + +- Added support for Exchange 2016! +- Added Pester tests for the following resources: + - xExchActiveSyncVirtualDirectory, + - xExchAutodiscoverVirtualDirectory, + - xExchClientAccessServer, + - xExchDatabaseAvailabilityGroup, + - xExchDatabaseAvailabilityGroupMember, + - xExchEcpVirtualDirectory, + - xExchExchangeServer, + - xExchImapSettings, + - xExchMailboxDatabase, + - xExchMailboxDatabaseCopy, + - xExchMapiVirtualDirectory, + - xExchOabVirtualDirectory, + - xExchOutlookAnywhere, + - xExchOwaVirtualDirectory, + - xExchPopSettings, + - xExchPowershellVirtualDirectory, + - xExchUMCallRouterSettings, + - xExchUMService, + - xExchWebServicesVirtualDirectory +- Fixed minor Get-TargetResource issues in xExchAutodiscoverVirtualDirectory, + xExchImapSettings, xExchPopSettings, xExchUMCallRouterSettings, and xExchWebServicesVirtualDirectory +- Added support for extended rights to resource xExchReceiveConnector (ExtendedRightAllowEntries/ExtendedRightDenyEntries) +- Fixed issue where Set-Targetresource is triggered each time consistency check + runs in xExchReceiveConnector due to extended permissions on Receive Connector +- Added parameter MaximumActiveDatabases and MaximumPreferredActiveDatabases to + resource xExchMailBoxServer + +## 1.4.0.0 + +- Added following resources: + - xExchMaintenanceMode + - xExchMailboxServer + - xExchTransportService + - xExchEventLogLevel +- For all -ExchangeCertificate functions in xExchExchangeCertificate, added + '-Server $env:COMPUTERNAME' switch. This will prevent the resource from + configuring a certificate on an incorrect server. +- Fixed issue with reading MailboxDatabases.csv in xExchangeConfigHelper.psm1 + caused by a column name changed introduced in v7.7 of the Exchange Server Role + Requirements Calculator. +- Changed function Get-RemoteExchangeSession so that it will throw an exception + if Exchange setup is in progress. This will prevent resources from trying to + execute while setup is running. +- Fixed issue where VirtualDirectory resources would incorrectly try to restart + a Back End Application Pool on a CAS role only server. +- Added support for the /AddUMLanguagePack parameter in xExchInstall + +## 1.3.0.0 + +- MSFT_xExchWaitForADPrep: Removed obsolete VerbosePreference parameter from Test-TargetResource +- Fixed encoding + +## 1.2.0.0 + +- xExchWaitForADPrep + - Removed `VerbosePreference` parameter of Test-TargetResource function to + resolve schema mismatch error. +- Added xExchAntiMalwareScanning resource +- xExchJetstress: + - Added fix for an issue where JetstressCmd.exe would not relaunch successfully + after ESE initialization. If Jetstress doesn't restart, the resource will + now require a reboot before proceeding. +- xExchOwaVirtualDirectory: + - Added `ChangePasswordEnabled` parameter + - Added `LogonPagePublicPrivateSelectionEnabled` parameter + - Added `LogonPageLightSelectionEnabled` parameter +- xExchImapSettings: + - Added `ExternalConnectionSettings` parameter + - Added `X509CertificateName` parameter +- xExchPopSettings: + - Added `ExternalConnectionSettings` parameter + - Added `X509CertificateName` parameter +- Added EndToEndExample +- Fixed bug where Start-ExchangeScheduledTask would throw an error message and + fail to + set ExecutionTimeLimit and Priority when using domain credentials + +## 1.1.0.0 + +- xExchAutoMountPoint: + Added parameter `EnsureExchangeVolumeMountPointIsLast` +- xExchExchangeCertificate: + Added error logging for the `Enable-ExchangeCertificate` cmdlet +- xExchExchangeServer: + Added pre-check for deprecated Set-ExchangeServer parameter, WorkloadManagementPolicy +- xExchJetstressCleanup: + When OutputSaveLocation is specified, Stress- files will also now be saved + +- xExchMailboxDatabase: + - Added `AdServerSettingsPreferredServer` parameter + - Added `SkipInitialDatabaseMount` parameter, which can help in an enviroments + where databases need time to be able to mount successfully after creation + - Added better error logging for `Mount-Database` + - Databases will only be mounted at initial database creation + if `MountAtStartup` is `$true` or not specified + +- xExchMailboxDatabaseCopy: + - Added `SeedingPostponed` parameter + - Added `AdServerSettingsPreferredServer` parameter + - Changed so that `ActivationPreference` will only be set if the number of + existing copies for the database is greater than or equal to the specified ActivationPreference + - Changed so that a seed of a new copy is only performed if `SeedingPostponed` + is not specified or set to `$false` + - Added better error logging for `Add-MailboxDatabaseCopy` + - Added missing tests for `EdbFilePath` and `LogFolderPath` + +- xExchOwaVirtualDirectory: Added missing test for `InstantMessagingServerName` + +- xExchWaitForMailboxDatabase: Added `AdServerSettingsPreferredServer` parameter + +- ExchangeConfigHelper.psm1: Updated `DBListFromMailboxDatabaseCopiesCsv` so + that the DB copies that are returned are sorted by Activation Preference + in ascending order. + +## 1.0.3.11 + +- xExchJetstress Changes: + - Changed default for MaxWaitMinutes from 4320 to 0 + - Added property MinAchievedIOPS + - Changed priority of the JetstressCmd.exe Scheduled Task from + the default of 7 to 4 +- xExchJetstressCleanup Changes: + - Fixed issue which caused the cleanup to not work properly when only + a single database is used in JetstressConfig.xml +- xExchAutoMountPoint Changes: + - Updated resource to choose the next available EXVOL mount point to use for + databases numerically by volume number instead of alphabetically by volume + number (ie. EXVOL2 would be selected after EXVOL1 instead of EXVOL11, + which is alphabetically closer). + +## 1.0.3.6 + +- Added the following resources: + - xExchInstall + - xExchJetstress + - xExchJetstressCleanup + - xExchUMCallRouterSettings + - xExchWaitForADPrep +- xExchActiveSyncVirtualDirectory Changes: + - Fixed an issue where if AutoCertBasedAuth was being configured, + it would result in an IISReset and an app pool recycle. + Now only an IISReset will occur in this scenario. +- xExchAutoMountPoint Changes: + - Added CreateSubfolders parameter + - Moved many DiskPart functions into helper file Misc\xExchangeDiskPart.ps1 + - Updated so that ExchangeVolume mount points will be listed AFTER + ExchangeDatabase mount points on the same disk +- xExchExchangeCertificate Changes: + - Changed behavior so that if UM or UMCallRouter services are being enabled, + the UM or UMCallRouter services will be stopped before the enablement, + then restarted after the enablement. +- xExchMailboxDatabase Changes: + - Fixed an issue where the OfflineAddressBook property would not be + tested properly depending on if a slash was specified or not at + the beginning of the OAB name. Now the slash doesn't matter. +- xExchOutlookAnywhere Changes: + - Changed the test for ExternalClientsRequireSsl to only fire + if ExternalHostname is also specified. +- xExchUMService Changes: + - Fixed issue that was preventing tests from evaluating properly. +- Example Updates: + - Added example folder InstallExchange + - Added example folder JetstressAutomation + - Added example folder WaitForADPrep + - Renamed EndToEndExample to PostInstallationConfiguration + - Updated Start-DscConfiguration commands in ConfigureDatabasesFromCalculator, + ConfigureDatabasesManual, ConfigureVirtualDirectories, CreateAndConfigureDAG, + and EndToEndExample, as they were missing a required space between parameters + +## 1.0.1.0 + +- Updated all Examples with minor comment changes, and re-wrote the examples + ConfigureAutoMountPoint-FromCalculator and ConfigureAutoMountPoints-Manual. +- Updated Exchange Server Role Requirement Calculator examples + from version 6.3 to 6.6 + +## 1.0.0.0 + +- Initial release with the following resources: + - xExchActiveSyncVirtualDirectory + - xExchAutodiscoverVirtualDirectory + - xExchAutoMountPoint + - xExchClientAccessServer + - xExchDatabaseAvailabilityGroup + - xExchDatabaseAvailabilityGroupMember + - xExchDatabaseAvailabilityGroupNetwork + - xExchEcpVirtualDirectory + - xExchExchangeCertificate + - xExchExchangeServer + - xExchImapSettings + - xExchMailboxDatabase + - xExchMailboxDatabaseCopy + - xExchMapiVirtualDirectory + - xExchOabVirtualDirectory + - xExchOutlookAnywhere + - xExchOwaVirtualDirectory + - xExchPopSettings + - xExchPowerShellVirtualDirectory + - xExchReceiveConnector + - xExchUMService + - xExchWaitForDAG + - xExchWaitForMailboxDatabase + - xExchWebServicesVirtualDirectory diff --git a/LICENSE b/LICENSE index 9018974c..f4c3ee92 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2018 Microsoft Corporation. +Copyright (c) DSC Community contributors. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. \ No newline at end of file +THE SOFTWARE. diff --git a/README.md b/README.md index 55008ff9..b283707f 100644 --- a/README.md +++ b/README.md @@ -1,37 +1,30 @@ # xExchange +[![Build Status](https://dev.azure.com/dsccommunity/xExchange/_apis/build/status/dsccommunity.xExchange?branchName=master)](https://dev.azure.com/dsccommunity/xExchange/_build/latest?15={15}&branchName=master) +![Azure DevOps coverage (branch)](https://img.shields.io/azure-devops/coverage/dsccommunity/xExchange/{15}/master) +[![Azure DevOps tests](https://img.shields.io/azure-devops/tests/dsccommunity/xExchange/{15}/master)](https://dsccommunity.visualstudio.com/xExchange/_test/analytics?15={15}&contextType=build) +[![PowerShell Gallery (with prereleases)](https://img.shields.io/powershellgallery/vpre/xExchange?label=xExchange%20Preview)](https://www.powershellgallery.com/packages/xExchange/) +[![PowerShell Gallery](https://img.shields.io/powershellgallery/v/xExchange?label=xExchange)](https://www.powershellgallery.com/packages/xExchange/) + The **xExchange** module contains many DSC resources for configuring and managing Exchange 2013, 2016, and 2019 servers including individual server properties, databases, mount points, and Database Availability Groups. -This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). +This project has adopted this [Code of Conduct](CODE_OF_CONDUCT.md). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. -## Branches - -### master - -[![Build status](https://ci.appveyor.com/api/projects/status/k9oq77p9xn6bo2j6/branch/master?svg=true)](https://ci.appveyor.com/project/PowerShell/xexchange/branch/master) -[![codecov](https://codecov.io/gh/PowerShell/xexchange/branch/master/graph/badge.svg)](https://codecov.io/gh/PowerShell/xexchange/branch/master) - -This is the branch containing the latest release - -no contributions should be made directly to this branch. - -### dev - -[![Build status](https://ci.appveyor.com/api/projects/status/k9oq77p9xn6bo2j6/branch/dev?svg=true)](https://ci.appveyor.com/project/PowerShell/xexchange/branch/dev) -[![codecov](https://codecov.io/gh/PowerShell/xexchange/branch/dev/graph/badge.svg)](https://codecov.io/gh/PowerShell/xexchange/branch/dev) +## Releases -This is the development branch -to which contributions should be proposed by contributors as pull requests. -This development branch will periodically be merged to the master branch, -and be released to [PowerShell Gallery](https://www.powershellgallery.com/). +For each merge to the branch `master` a preview release will be +deployed to [PowerShell Gallery](https://www.powershellgallery.com/). +Periodically a release version tag will be pushed which will deploy a +full release to [PowerShell Gallery](https://www.powershellgallery.com/). ## Contributing -Please check out common DSC Resources [contributing guidelines](https://github.com/PowerShell/DscResource.Kit/blob/master/CONTRIBUTING.md). +Please check out common DSC Community [contributing guidelines](https://dsccommunity.org/guidelines/contributing). ## Installation @@ -70,7 +63,7 @@ for more information. ## Examples -You can review the [Examples](/Examples) directory in the xExchange module +You can review the [Examples](/source/Examples) directory in the xExchange module for some general use scenarios for all of the resources that are in the module. ## Change log diff --git a/RequiredModules.psd1 b/RequiredModules.psd1 new file mode 100644 index 00000000..32eb97e5 --- /dev/null +++ b/RequiredModules.psd1 @@ -0,0 +1,24 @@ +@{ + # Set up a mini virtual environment... + PSDependOptions = @{ + AddToPath = $True + Target = 'output\RequiredModules' + Parameters = @{ + } + } + + Sampler = 'latest' + invokeBuild = 'latest' + PSScriptAnalyzer = 'latest' + pester = 'latest' + Plaster = 'latest' + ModuleBuilder = '1.0.0' + MarkdownLinkCheck = 'latest' + ChangelogManagement = 'latest' + 'DscResource.Test' = 'latest' + 'DscResource.AnalyzerRules' = 'latest' + xDscResourceDesigner = 'latest' + 'DscResource.Common' = 'latest' + 'xPendingReboot' = '0.4.0' + 'xWebAdministration' = '3.1.1' +} diff --git a/Resolve-Dependency.ps1 b/Resolve-Dependency.ps1 new file mode 100644 index 00000000..4928e624 --- /dev/null +++ b/Resolve-Dependency.ps1 @@ -0,0 +1,289 @@ +[CmdletBinding()] +param +( + + [Parameter()] + [String] + $DependencyFile = 'RequiredModules.psd1', + + [Parameter()] + [String] + # Path for PSDepend to be bootstrapped and save other dependencies. + # Can also be CurrentUser or AllUsers if you wish to install the modules in such scope + # Default to $PWD.Path/output/modules + $PSDependTarget = (Join-Path $PSScriptRoot './output/RequiredModules'), + + [Parameter()] + [uri] + # URI to use for Proxy when attempting to Bootstrap PackageProvider & PowerShellGet + $Proxy, + + [Parameter()] + # Credential to contact the Proxy when provided + [PSCredential]$ProxyCredential, + + [Parameter()] + [ValidateSet('CurrentUser', 'AllUsers')] + [String] + # Scope to bootstrap the PackageProvider and PSGet if not available + $Scope = 'CurrentUser', + + [Parameter()] + [String] + # Gallery to use when bootstrapping PackageProvider, PSGet and when calling PSDepend (can be overridden in Dependency files) + $Gallery = 'PSGallery', + + [Parameter()] + [PSCredential] + # Credentials to use with the Gallery specified above + $GalleryCredential, + + + [Parameter()] + [switch] + # Allow you to use a locally installed version of PowerShellGet older than 1.6.0 (not recommended, default to $False) + $AllowOldPowerShellGetModule, + + [Parameter()] + [String] + # Allow you to specify a minimum version fo PSDepend, if you're after specific features. + $MinimumPSDependVersion, + + [Parameter()] + [Switch] + $AllowPrerelease, + + [Parameter()] + [Switch] + $WithYAML +) + +# Load Defaults for parameters values from Resolve-Dependency.psd1 if not provided as parameter +try +{ + Write-Verbose -Message "Importing Bootstrap default parameters from '$PSScriptRoot/Resolve-Dependency.psd1'." + $ResolveDependencyDefaults = Import-PowerShellDataFile -Path (Join-Path $PSScriptRoot '.\Resolve-Dependency.psd1' -Resolve -ErrorAction Stop) + $ParameterToDefault = $MyInvocation.MyCommand.ParameterSets.Where{ $_.Name -eq $PSCmdlet.ParameterSetName }.Parameters.Keys + if ($ParameterToDefault.Count -eq 0) + { + $ParameterToDefault = $MyInvocation.MyCommand.Parameters.Keys + } + # Set the parameters available in the Parameter Set, or it's not possible to choose yet, so all parameters are an option + foreach ($ParamName in $ParameterToDefault) + { + if (-Not $PSBoundParameters.Keys.Contains($ParamName) -and $ResolveDependencyDefaults.ContainsKey($ParamName)) + { + Write-Verbose -Message "Setting $ParamName with $($ResolveDependencyDefaults[$ParamName])" + try + { + $variableValue = $ResolveDependencyDefaults[$ParamName] + if ($variableValue -is [string]) + { + $variableValue = $ExecutionContext.InvokeCommand.ExpandString($variableValue) + } + $PSBoundParameters.Add($ParamName, $variableValue) + Set-Variable -Name $ParamName -value $variableValue -Force -ErrorAction SilentlyContinue + } + catch + { + Write-Verbose -Message "Error adding default for $ParamName : $($_.Exception.Message)" + } + } + } +} +catch +{ + Write-Warning -Message "Error attempting to import Bootstrap's default parameters from $(Join-Path $PSScriptRoot '.\Resolve-Dependency.psd1'): $($_.Exception.Message)." +} + +Write-Progress -Activity "Bootstrap:" -PercentComplete 0 -CurrentOperation "NuGet Bootstrap" + +if (!(Get-PackageProvider -Name NuGet -ForceBootstrap -ErrorAction SilentlyContinue)) +{ + $providerBootstrapParams = @{ + Name = 'nuget' + force = $true + ForceBootstrap = $true + ErrorAction = 'Stop' + } + + switch ($PSBoundParameters.Keys) + { + 'Proxy' + { + $providerBootstrapParams.Add('Proxy', $Proxy) + } + 'ProxyCredential' + { + $providerBootstrapParams.Add('ProxyCredential', $ProxyCredential) + } + 'Scope' + { + $providerBootstrapParams.Add('Scope', $Scope) + } + } + + if ($AllowPrerelease) + { + $providerBootstrapParams.Add('AllowPrerelease', $true) + } + + Write-Information "Bootstrap: Installing NuGet Package Provider from the web (Make sure Microsoft addresses/ranges are allowed)" + $null = Install-PackageProvider @providerBootstrapParams + $latestNuGetVersion = (Get-PackageProvider -Name NuGet -ListAvailable | Select-Object -First 1).Version.ToString() + Write-Information "Bootstrap: Importing NuGet Package Provider version $latestNuGetVersion to current session." + $Null = Import-PackageProvider -Name NuGet -RequiredVersion $latestNuGetVersion -Force +} + +Write-Progress -Activity "Bootstrap:" -PercentComplete 10 -CurrentOperation "Ensuring Gallery $Gallery is trusted" + +# Fail if the given PSGallery is not Registered +$Policy = (Get-PSRepository $Gallery -ErrorAction Stop).InstallationPolicy +Set-PSRepository -Name $Gallery -InstallationPolicy Trusted -ErrorAction Ignore +try +{ + Write-Progress -Activity "Bootstrap:" -PercentComplete 25 -CurrentOperation "Checking PowerShellGet" + # Ensure the module is loaded and retrieve the version you have + $PowerShellGetVersion = (Import-Module PowerShellGet -PassThru -ErrorAction SilentlyContinue).Version + + Write-Verbose "Bootstrap: The PowerShellGet version is $PowerShellGetVersion" + # Versions below 1.6.0 are considered old, unreliable & not recommended + if (!$PowerShellGetVersion -or ($PowerShellGetVersion -lt [System.version]'1.6.0' -and !$AllowOldPowerShellGetModule)) + { + Write-Progress -Activity "Bootstrap:" -PercentComplete 40 -CurrentOperation "Installing newer version of PowerShellGet" + $InstallPSGetParam = @{ + Name = 'PowerShellGet' + Force = $True + SkipPublisherCheck = $true + AllowClobber = $true + Scope = $Scope + Repository = $Gallery + } + + switch ($PSBoundParameters.Keys) + { + 'Proxy' + { + $InstallPSGetParam.Add('Proxy', $Proxy) + } + 'ProxyCredential' + { + $InstallPSGetParam.Add('ProxyCredential', $ProxyCredential) + } + 'GalleryCredential' + { + $InstallPSGetParam.Add('Credential', $GalleryCredential) + } + } + + Install-Module @InstallPSGetParam + Remove-Module PowerShellGet -force -ErrorAction SilentlyContinue + Import-Module PowerShellGet -Force + $NewLoadedVersion = (Get-Module PowerShellGet).Version.ToString() + Write-Information "Bootstrap: PowerShellGet version loaded is $NewLoadedVersion" + Write-Progress -Activity "Bootstrap:" -PercentComplete 60 -CurrentOperation "Installing newer version of PowerShellGet" + } + + # Try to import the PSDepend module from the available modules + try + { + $ImportPSDependParam = @{ + Name = 'PSDepend' + ErrorAction = 'Stop' + Force = $true + } + + if ($MinimumPSDependVersion) + { + $ImportPSDependParam.add('MinimumVersion', $MinimumPSDependVersion) + } + $null = Import-Module @ImportPSDependParam + } + catch + { + # PSDepend module not found, installing or saving it + if ($PSDependTarget -in 'CurrentUser', 'AllUsers') + { + Write-Debug "PSDepend module not found. Attempting to install from Gallery $Gallery" + Write-Warning "Installing PSDepend in $PSDependTarget Scope" + $InstallPSDependParam = @{ + Name = 'PSDepend' + Repository = $Gallery + Force = $true + Scope = $PSDependTarget + SkipPublisherCheck = $true + AllowClobber = $true + } + + if ($MinimumPSDependVersion) + { + $InstallPSDependParam.add('MinimumVersion', $MinimumPSDependVersion) + } + + Write-Progress -Activity "Bootstrap:" -PercentComplete 75 -CurrentOperation "Installing PSDepend from $Gallery" + Install-Module @InstallPSDependParam + } + else + { + Write-Debug "PSDepend module not found. Attempting to Save from Gallery $Gallery to $PSDependTarget" + $SaveModuleParam = @{ + Name = 'PSDepend' + Repository = $Gallery + Path = $PSDependTarget + } + + if ($MinimumPSDependVersion) + { + $SaveModuleParam.add('MinimumVersion', $MinimumPSDependVersion) + } + + Write-Progress -Activity "Bootstrap:" -PercentComplete 75 -CurrentOperation "Saving & Importing PSDepend from $Gallery to $Scope" + Save-Module @SaveModuleParam + } + } + finally + { + Write-Progress -Activity "Bootstrap:" -PercentComplete 100 -CurrentOperation "Loading PSDepend" + # We should have successfully bootstrapped PSDepend. Fail if not available + Import-Module PSDepend -ErrorAction Stop + } + + if ($WithYAML) + { + if (-Not (Get-Module -ListAvailable -Name 'PowerShell-Yaml')) + { + Write-Verbose "PowerShell-Yaml module not found. Attempting to Save from Gallery $Gallery to $PSDependTarget" + $SaveModuleParam = @{ + Name = 'PowerShell-Yaml' + Repository = $Gallery + Path = $PSDependTarget + } + + Save-Module @SaveModuleParam + Import-Module "PowerShell-Yaml" -ErrorAction Stop + } + else + { + Write-Verbose "PowerShell-Yaml is already available" + } + } + + Write-Progress -Activity "PSDepend:" -PercentComplete 0 -CurrentOperation "Restoring Build Dependencies" + if (Test-Path $DependencyFile) + { + $PSDependParams = @{ + Force = $true + Path = $DependencyFile + } + + # TODO: Handle when the Dependency file is in YAML, and -WithYAML is specified + Invoke-PSDepend @PSDependParams + } + Write-Progress -Activity "PSDepend:" -PercentComplete 100 -CurrentOperation "Dependencies restored" -Completed +} +finally +{ + # Reverting the Installation Policy for the given gallery + Set-PSRepository -Name $Gallery -InstallationPolicy $Policy + Write-Verbose "Project Bootstrapped, returning to Invoke-Build" +} diff --git a/Resolve-Dependency.psd1 b/Resolve-Dependency.psd1 new file mode 100644 index 00000000..2ae8c0da --- /dev/null +++ b/Resolve-Dependency.psd1 @@ -0,0 +1,5 @@ +@{ + Gallery = 'PSGallery' + AllowPrerelease = $false + WithYAML = $true +} diff --git a/Tests/Integration/MSFT_xExchActiveSyncVirtualDirectory.Integration.Tests.ps1 b/Tests/Integration/MSFT_xExchActiveSyncVirtualDirectory.Integration.Tests.ps1 deleted file mode 100644 index 41e10082..00000000 --- a/Tests/Integration/MSFT_xExchActiveSyncVirtualDirectory.Integration.Tests.ps1 +++ /dev/null @@ -1,267 +0,0 @@ -<# - .SYNOPSIS - Automated integration test for MSFT_xExchActiveSyncVirtualDirectory DSC Resource. - This test module requires use of credentials. - The first run through of the tests will prompt for credentials from the logged on user. -#> - -#region HEADER -[System.String] $script:moduleRoot = Split-Path -Parent (Split-Path -Parent $PSScriptRoot) -[System.String] $script:DSCModuleName = 'xExchange' -[System.String] $script:DSCResourceFriendlyName = 'xExchActiveSyncVirtualDirectory' -[System.String] $script:DSCResourceName = "MSFT_$($script:DSCResourceFriendlyName)" - -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'Tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Force -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'Modules' -ChildPath 'xExchangeHelper.psm1')) -Force -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'DSCResources' -ChildPath (Join-Path -Path "$($script:DSCResourceName)" -ChildPath "$($script:DSCResourceName).psm1"))) - -# Check if Exchange is installed on this machine. If not, we can't run tests -[System.Boolean] $exchangeInstalled = Test-ExchangeSetupComplete - -#endregion HEADER - -if ($exchangeInstalled) -{ - # Get required credentials to use for the test - $shellCredentials = Get-TestCredential - - # Get the Server FQDN for using in URL's - if ($null -eq $serverFqdn) - { - $serverFqdn = [System.Net.Dns]::GetHostByName($env:COMPUTERNAME).HostName - } - - if ($null -eq $webCertAuthInstalled) - { - $webCertAuth = Get-WindowsFeature -Name Web-Cert-Auth - - if ($webCertAuth.InstallState -ne 'Installed') - { - $webCertAuthInstalled = $false - Write-Verbose -Message 'Web-Cert-Auth is not installed. Skipping certificate based authentication tests.' - } - else - { - $webCertAuthInstalled = $true - } - } - - if ($webCertAuthInstalled -eq $true) - { - # Get the thumbprint to use for ActiveSync Cert Based Auth - if ($null -eq $cbaCertThumbprint) - { - $cbaCertThumbprint = Read-Host -Prompt 'Enter the thumbprint of an Exchange certificate to use when enabling Certificate Based Authentication' - } - } - - Describe 'Test Setting Properties with xExchActiveSyncVirtualDirectory' { - $testParams = @{ - Identity = "$($env:COMPUTERNAME)\Microsoft-Server-ActiveSync (Default Web Site)" - Credential = $shellCredentials - AutoCertBasedAuth = $false - AutoCertBasedAuthThumbprint = '' - BadItemReportingEnabled = $false - BasicAuthEnabled = $true - ClientCertAuth = 'Ignore' - CompressionEnabled = $true - ExtendedProtectionFlags = @('AllowDotlessspn', 'NoServicenameCheck') - ExtendedProtectionSPNList = @('http/mail.fabrikam.com', 'http/mail.fabrikam.local', 'http/wxweqc') - ExtendedProtectionTokenChecking = 'Allow' - ExternalAuthenticationMethods = @('Basic', 'Kerberos') - ExternalUrl = "https://$($serverFqdn)/Microsoft-Server-ActiveSync" - InstallIsapiFilter = $true - InternalAuthenticationMethods = @('Basic', 'Kerberos') - InternalUrl = "https://$($serverFqdn)/Microsoft-Server-ActiveSync" - MobileClientCertificateAuthorityURL = 'http://whatever.com/CA' - MobileClientCertificateProvisioningEnabled = $true - MobileClientCertTemplateName = 'MyTemplateforEAS' - # Name = "$($Node.NodeName) EAS Site" - RemoteDocumentsActionForUnknownServers = 'Block' - RemoteDocumentsAllowedServers = @('AllowedA', 'AllowedB') - RemoteDocumentsBlockedServers = @('BlockedA', 'BlockedB') - RemoteDocumentsInternalDomainSuffixList = @('InternalA', 'InternalB') - SendWatsonReport = $false - WindowsAuthEnabled = $false - } - - $expectedGetResults = @{ - Identity = "$($env:COMPUTERNAME)\Microsoft-Server-ActiveSync (Default Web Site)" - BadItemReportingEnabled = $false - BasicAuthEnabled = $true - ClientCertAuth = 'Ignore' - CompressionEnabled = $true - ExtendedProtectionTokenChecking = 'Allow' - ExternalUrl = "https://$($serverFqdn)/Microsoft-Server-ActiveSync" - InternalAuthenticationMethods = @('Basic', 'Kerberos') - InternalUrl = "https://$($serverFqdn)/Microsoft-Server-ActiveSync" - MobileClientCertificateAuthorityURL = 'http://whatever.com/CA' - MobileClientCertificateProvisioningEnabled = $true - MobileClientCertTemplateName = 'MyTemplateforEAS' - # Name = "$($Node.NodeName) EAS Site" - RemoteDocumentsActionForUnknownServers = 'Block' - SendWatsonReport = $false - WindowsAuthEnabled = $false - } - - Test-TargetResourceFunctionality -Params $testParams ` - -ContextLabel 'Set standard parameters' ` - -ExpectedGetResults $expectedGetResults - - Test-ArrayContentsEqual -TestParams $testParams ` - -DesiredArrayContents $testParams.ExtendedProtectionFlags ` - -GetResultParameterName 'ExtendedProtectionFlags' ` - -ContextLabel 'Verify ExtendedProtectionFlags' ` - -ItLabel 'ExtendedProtectionSPNList should contain three values' - - Test-ArrayContentsEqual -TestParams $testParams ` - -DesiredArrayContents $testParams.ExtendedProtectionSPNList ` - -GetResultParameterName 'ExtendedProtectionSPNList' ` - -ContextLabel 'Verify ExtendedProtectionSPNList' ` - -ItLabel 'ExtendedProtectionSPNList should contain three values' - - Test-ArrayContentsEqual -TestParams $testParams ` - -DesiredArrayContents $testParams.ExternalAuthenticationMethods ` - -GetResultParameterName 'ExternalAuthenticationMethods' ` - -ContextLabel 'Verify ExternalAuthenticationMethods' ` - -ItLabel 'ExternalAuthenticationMethods should contain two values' - - Test-ArrayContentsEqual -TestParams $testParams ` - -DesiredArrayContents $testParams.InternalAuthenticationMethods ` - -GetResultParameterName 'InternalAuthenticationMethods' ` - -ContextLabel 'Verify InternalAuthenticationMethods' ` - -ItLabel 'InternalAuthenticationMethods should contain two values' - - Test-ArrayContentsEqual -TestParams $testParams ` - -DesiredArrayContents $testParams.RemoteDocumentsAllowedServers ` - -GetResultParameterName 'RemoteDocumentsAllowedServers' ` - -ContextLabel 'Verify RemoteDocumentsAllowedServers' ` - -ItLabel 'RemoteDocumentsAllowedServers should contain two values' - - Test-ArrayContentsEqual -TestParams $testParams ` - -DesiredArrayContents $testParams.RemoteDocumentsBlockedServers ` - -GetResultParameterName 'RemoteDocumentsBlockedServers' ` - -ContextLabel 'Verify RemoteDocumentsBlockedServers' ` - -ItLabel 'RemoteDocumentsBlockedServers should contain two values' - - Test-ArrayContentsEqual -TestParams $testParams ` - -DesiredArrayContents $testParams.RemoteDocumentsInternalDomainSuffixList ` - -GetResultParameterName 'RemoteDocumentsInternalDomainSuffixList' ` - -ContextLabel 'Verify RemoteDocumentsInternalDomainSuffixList' ` - -ItLabel 'RemoteDocumentsInternalDomainSuffixList should contain two values' - - $testParams.ExternalUrl = '' - $testParams.InternalUrl = '' - $expectedGetResults.ExternalUrl = '' - $expectedGetResults.InternalUrl = '' - - Test-TargetResourceFunctionality -Params $testParams ` - -ContextLabel 'Try with empty URLs' ` - -ExpectedGetResults $expectedGetResults - - if ($webCertAuthInstalled -eq $true) - { - $testParams.AutoCertBasedAuth = $true - $testParams.AutoCertBasedAuthThumbprint = $cbaCertThumbprint - $testParams.ClientCertAuth = 'Required' - $expectedGetResults.ClientCertAuth = 'Required' - - Test-TargetResourceFunctionality -Params $testParams ` - -ContextLabel 'Try enabling certificate based authentication' ` - -ExpectedGetResults $expectedGetResults - } - - Context 'Test missing ExtendedProtectionFlags for ExtendedProtectionSPNList' { - $testParams.ExtendedProtectionFlags = @('NoServicenameCheck') - - It 'Should hit exception for missing ExtendedProtectionFlags AllowDotlessSPN' { - { Set-TargetResource @testParams } | Should -Throw - } - - It 'Test results should be true after adding missing ExtendedProtectionFlags' { - $testParams.ExtendedProtectionFlags = @('AllowDotlessSPN') - Set-TargetResource @testParams - $testResults = Test-TargetResource @testParams - $testResults | Should -Be $true - } - } - - Context 'Test invalid combination in ExtendedProtectionFlags' { - $testParams.ExtendedProtectionFlags = @('NoServicenameCheck', 'None') - - It 'Should hit exception for invalid combination ExtendedProtectionFlags' { - { Set-TargetResource @testParams } | Should -Throw - } - - It 'Test results should be true after correction of ExtendedProtectionFlags' { - $testParams.ExtendedProtectionFlags = @('AllowDotlessSPN') - Set-TargetResource @testParams - $testResults = Test-TargetResource @testParams - $testResults | Should -Be $true - } - } - - $testParams.ActiveSyncServer = "https://eas.$($env:USERDNSDOMAIN)/Microsoft-Server-ActiveSync" - $testParams.Remove('ExternalUrl') - $expectedGetResults.ActiveSyncServer = "https://eas.$($env:USERDNSDOMAIN)/Microsoft-Server-ActiveSync" - $expectedGetResults.ExternalUrl = "https://eas.$($env:USERDNSDOMAIN)/Microsoft-Server-ActiveSync" - - Test-TargetResourceFunctionality -Params $testParams ` - -ContextLabel 'Try by setting External URL via ActiveSyncServer' ` - -ExpectedGetResults $expectedGetResults - - # Set values back to default - $testParams = @{ - Identity = "$($env:COMPUTERNAME)\Microsoft-Server-ActiveSync (Default Web Site)" - Credential = $shellCredentials - BadItemReportingEnabled = $true - BasicAuthEnabled = $false - ClientCertAuth = 'Ignore' - CompressionEnabled = $false - ExtendedProtectionFlags = 'None' - ExtendedProtectionSPNList = $null - ExtendedProtectionTokenChecking = 'None' - ExternalAuthenticationMethods = $null - InternalAuthenticationMethods = $null - MobileClientCertificateAuthorityURL = $null - MobileClientCertificateProvisioningEnabled = $false - MobileClientCertTemplateName = $null - RemoteDocumentsActionForUnknownServers = 'Allow' - RemoteDocumentsAllowedServers = $null - RemoteDocumentsBlockedServers = $null - RemoteDocumentsInternalDomainSuffixList = $null - SendWatsonReport = $true - WindowsAuthEnabled = $true - } - - $expectedGetResults = @{ - Identity = "$($env:COMPUTERNAME)\Microsoft-Server-ActiveSync (Default Web Site)" - BadItemReportingEnabled = $true - BasicAuthEnabled = $false - ClientCertAuth = 'Ignore' - CompressionEnabled = $false - ExtendedProtectionTokenChecking = 'None' - ExtendedProtectionFlags = [System.String[]] @() - ExtendedProtectionSPNList = [System.String[]] @() - ExternalAuthenticationMethods = [System.String[]] @() - InternalAuthenticationMethods = [System.String[]] @() - MobileClientCertificateAuthorityURL = '' - MobileClientCertificateProvisioningEnabled = $false - MobileClientCertTemplateName = '' - RemoteDocumentsActionForUnknownServers = 'Allow' - RemoteDocumentsAllowedServers = $null - RemoteDocumentsBlockedServers = $null - RemoteDocumentsInternalDomainSuffixList = $null - SendWatsonReport = $true - WindowsAuthEnabled = $true - } - - Test-TargetResourceFunctionality -Params $testParams ` - -ContextLabel 'Reset values to default' ` - -ExpectedGetResults $expectedGetResults - } -} -else -{ - Write-Verbose -Message 'Tests in this file require that Exchange is installed to be run.' -} diff --git a/Tests/Unit/MSFT_xExchJetstressCleanup.tests.ps1 b/Tests/Unit/MSFT_xExchJetstressCleanup.tests.ps1 deleted file mode 100644 index 9fc4633f..00000000 --- a/Tests/Unit/MSFT_xExchJetstressCleanup.tests.ps1 +++ /dev/null @@ -1,60 +0,0 @@ -#region HEADER -$script:DSCModuleName = 'xExchange' -$script:DSCResourceName = 'MSFT_xExchJetstressCleanup' - -# Unit Test Template Version: 1.2.4 -$script:moduleRoot = Split-Path -Parent (Split-Path -Parent $PSScriptRoot) -if ( (-not (Test-Path -Path (Join-Path -Path $script:moduleRoot -ChildPath 'DSCResource.Tests'))) -or ` - (-not (Test-Path -Path (Join-Path -Path $script:moduleRoot -ChildPath 'DSCResource.Tests\TestHelper.psm1'))) ) -{ - & git @('clone', 'https://github.com/PowerShell/DscResource.Tests.git', (Join-Path -Path $script:moduleRoot -ChildPath 'DscResource.Tests')) -} - -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'DSCResource.Tests' -ChildPath 'TestHelper.psm1')) -Force -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'Tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Global -Force - -$TestEnvironment = Initialize-TestEnvironment ` - -DSCModuleName $script:DSCModuleName ` - -DSCResourceName $script:DSCResourceName ` - -ResourceType 'Mof' ` - -TestType Unit - -#endregion HEADER - -function Invoke-TestSetup -{ - -} - -function Invoke-TestCleanup -{ - Restore-TestEnvironment -TestEnvironment $TestEnvironment -} - -# Begin Testing -try -{ - Invoke-TestSetup - - InModuleScope $script:DSCResourceName { - Describe 'MSFT_xExchJetstressCleanup\Get-TargetResource' -Tag 'Get' { - AfterEach { - Assert-VerifiableMock - } - - $getTargetResourceParams = @{ - JetstressPath = 'C:\Program Files\Exchange Jestress' - } - - Context 'When Get-TargetResource is called' { - Mock -CommandName Write-FunctionEntry -Verifiable - - Test-CommonGetTargetResourceFunctionality -GetTargetResourceParams $getTargetResourceParams - } - } - } -} -finally -{ - Invoke-TestCleanup -} diff --git a/Tests/Unit/MSFT_xExchTransportService.tests.ps1 b/Tests/Unit/MSFT_xExchTransportService.tests.ps1 deleted file mode 100644 index 820e0256..00000000 --- a/Tests/Unit/MSFT_xExchTransportService.tests.ps1 +++ /dev/null @@ -1,264 +0,0 @@ -#region HEADER -$script:DSCModuleName = 'xExchange' -$script:DSCResourceName = 'MSFT_xExchTransportService' - -# Unit Test Template Version: 1.2.4 -$script:moduleRoot = Split-Path -Parent (Split-Path -Parent $PSScriptRoot) -if ( (-not (Test-Path -Path (Join-Path -Path $script:moduleRoot -ChildPath 'DSCResource.Tests'))) -or ` - (-not (Test-Path -Path (Join-Path -Path $script:moduleRoot -ChildPath 'DSCResource.Tests\TestHelper.psm1'))) ) -{ - & git @('clone', 'https://github.com/PowerShell/DscResource.Tests.git', (Join-Path -Path $script:moduleRoot -ChildPath 'DscResource.Tests')) -} - -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'DSCResource.Tests' -ChildPath 'TestHelper.psm1')) -Force -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'Tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Global -Force - -$TestEnvironment = Initialize-TestEnvironment ` - -DSCModuleName $script:DSCModuleName ` - -DSCResourceName $script:DSCResourceName ` - -ResourceType 'Mof' ` - -TestType Unit - -#endregion HEADER - -function Invoke-TestSetup -{ - -} - -function Invoke-TestCleanup -{ - Restore-TestEnvironment -TestEnvironment $TestEnvironment -} - -# Begin Testing -try -{ - Invoke-TestSetup - - InModuleScope $script:DSCResourceName { - - $commonTargetResourceParams = @{ - Identity = 'TransportService' - Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList 'fakeuser', (New-Object -TypeName System.Security.SecureString) - } - - $commonTransportServiceStandardOutput = @{ - ActiveUserStatisticsLogMaxAge = [System.String] '' - ActiveUserStatisticsLogMaxDirectorySize = [System.String] '' - ActiveUserStatisticsLogMaxFileSize = [System.String] '' - ActiveUserStatisticsLogPath = [System.String] '' - AgentLogEnabled = [System.Boolean] $false - AgentLogMaxAge = [System.String] '' - AgentLogMaxDirectorySize = [System.String] '' - AgentLogMaxFileSize = [System.String] '' - AgentLogPath = [System.String] '' - AntispamAgentsEnabled = [System.Boolean] $false - ConnectivityLogEnabled = [System.Boolean] $false - ConnectivityLogMaxAge = [System.String] '' - ConnectivityLogMaxDirectorySize = [System.String] '' - ConnectivityLogMaxFileSize = [System.String] '' - ConnectivityLogPath = [System.String] '' - ContentConversionTracingEnabled = [System.Boolean] $false - DelayNotificationTimeout = [System.String] '' - DnsLogEnabled = [System.Boolean] $false - DnsLogMaxAge = [System.String] '' - DnsLogMaxDirectorySize = [System.String] '' - DnsLogMaxFileSize = [System.String] '' - DnsLogPath = [System.String] '' - ExternalDNSAdapterEnabled = [System.Boolean] $false - ExternalDNSAdapterGuid = [System.String] '' - ExternalDNSProtocolOption = [System.String] '' - ExternalDNSServers = [System.String[]] @('externaldns.contoso.com') - ExternalIPAddress = [System.String] '1.2.3.4' - InternalDNSAdapterEnabled = [System.Boolean] $false - InternalDNSAdapterGuid = [System.String] '' - InternalDNSProtocolOption = [System.String] '' - InternalDNSServers = [System.String[]] @('internaldns.contoso.com') - IntraOrgConnectorProtocolLoggingLevel = [System.String] '' - IntraOrgConnectorSmtpMaxMessagesPerConnection = [System.Int32] 1 - IrmLogEnabled = [System.Boolean] $false - IrmLogMaxAge = [System.String] '' - IrmLogMaxDirectorySize = [System.String] '' - IrmLogMaxFileSize = [System.String] '' - IrmLogPath = [System.String] '' - MaxConcurrentMailboxDeliveries = [System.Int32] 1 - MaxConcurrentMailboxSubmissions = [System.Int32] 1 - MaxConnectionRatePerMinute = [System.Int32] 1 - MaxOutboundConnections = [System.String] '' - MaxPerDomainOutboundConnections = [System.String] '' - MessageExpirationTimeout = [System.String] '' - MessageRetryInterval = [System.String] '' - MessageTrackingLogEnabled = [System.Boolean] $false - MessageTrackingLogMaxAge = [System.String] '' - MessageTrackingLogMaxDirectorySize = [System.String] '' - MessageTrackingLogMaxFileSize = [System.String] '' - MessageTrackingLogPath = [System.String] '' - MessageTrackingLogSubjectLoggingEnabled = [System.Boolean] $false - OutboundConnectionFailureRetryInterval = [System.String] '' - PickupDirectoryMaxHeaderSize = [System.String] '' - PickupDirectoryMaxMessagesPerMinute = [System.Int32] 1 - PickupDirectoryMaxRecipientsPerMessage = [System.Int32] 1 - PickupDirectoryPath = [System.String] '' - PipelineTracingEnabled = [System.Boolean] $false - PipelineTracingPath = [System.String] '' - PipelineTracingSenderAddress = [System.String] 'pipeline@contoso.com' - PoisonMessageDetectionEnabled = [System.Boolean] $false - PoisonThreshold = [System.Int32] 1 - QueueLogMaxAge = [System.String] '' - QueueLogMaxDirectorySize = [System.String] '' - QueueLogMaxFileSize = [System.String] '' - QueueLogPath = [System.String] '' - QueueMaxIdleTime = [System.String] '' - ReceiveProtocolLogMaxAge = [System.String] '' - ReceiveProtocolLogMaxDirectorySize = [System.String] '' - ReceiveProtocolLogMaxFileSize = [System.String] '' - ReceiveProtocolLogPath = [System.String] '' - RecipientValidationCacheEnabled = [System.Boolean] $false - ReplayDirectoryPath = [System.String] '' - RootDropDirectoryPath = [System.String] '' - RoutingTableLogMaxAge = [System.String] '' - RoutingTableLogMaxDirectorySize = [System.String] '' - RoutingTableLogPath = [System.String] '' - SendProtocolLogMaxAge = [System.String] '' - SendProtocolLogMaxDirectorySize = [System.String] '' - SendProtocolLogMaxFileSize = [System.String] '' - SendProtocolLogPath = [System.String] '' - ServerStatisticsLogMaxAge = [System.String] '' - ServerStatisticsLogMaxDirectorySize = [System.String] '' - ServerStatisticsLogMaxFileSize = [System.String] '' - ServerStatisticsLogPath = [System.String] '' - TransientFailureRetryCount = [System.Int32] 1 - TransientFailureRetryInterval = [System.String] '' - UseDowngradedExchangeServerAuth = [System.Boolean] $false - } - - Mock -CommandName Write-FunctionEntry -Verifiable - - Describe 'MSFT_xExchTransportService\Get-TargetResource' -Tag 'Get' { - # Override Exchange cmdlets - function Get-TransportService {} - - Mock -CommandName Get-RemoteExchangeSession -Verifiable - Mock -CommandName Get-TransportService -Verifiable -MockWith { return $commonTransportServiceStandardOutput } - - AfterEach { - Assert-VerifiableMock - } - - Context 'When Get-TargetResource is called' { - Test-CommonGetTargetResourceFunctionality -GetTargetResourceParams $commonTargetResourceParams - } - } - Describe 'MSFT_xExchTransportService\Set-TargetResource' -Tag 'Set' { - # Override Exchange cmdlets - Mock -CommandName Get-RemoteExchangeSession -Verifiable - function Set-TransportService {} - - AfterEach { - Assert-VerifiableMock - } - - $setTargetResourceParams = @{ - Identity = 'TransportService' - Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList 'fakeuser', (New-Object -TypeName System.Security.SecureString) - AllowServiceRestart = $true - } - - Context 'When Set-TargetResource is called' { - It 'Should call expected functions when AllowServiceRestart is true' { - Mock -CommandName Set-TransportService -Verifiable - Mock -CommandName Restart-Service -Verifiable - - Set-TargetResource @setTargetResourceParams - } - - It 'Should call expected functions when PipelineTracingSenderAddress is null' { - $PipelineTracingSenderAddress = $setTargetResourceParams.PipelineTracingSenderAddress - $setTargetResourceParams.PipelineTracingSenderAddress = $null - Mock -CommandName Set-TransportService -Verifiable - - Set-TargetResource @setTargetResourceParams - - $setTargetResourceParams.PipelineTracingSenderAddress = $PipelineTracingSenderAddress - } - - It 'Should call expected functions when ExternalIPAddress is null' { - $ExternalIPAddress = $setTargetResourceParams.ExternalIPAddress - $setTargetResourceParams.ExternalIPAddress = $null - Mock -CommandName Set-TransportService -Verifiable - - Set-TargetResource @setTargetResourceParams - - $setTargetResourceParams.ExternalIPAddress = $ExternalIPAddress - } - - It 'Should call expected functions when InternalDNSServers is null' { - $InternalDNSServers = $setTargetResourceParams.InternalDNSServers - $setTargetResourceParams.InternalDNSServers = $null - Mock -CommandName Set-TransportService -Verifiable - - Set-TargetResource @setTargetResourceParams - - $setTargetResourceParams.InternalDNSServers = $InternalDNSServers - } - - It 'Should call expected functions when ExternalDNSServers is null' { - $ExternalDNSServers = $setTargetResourceParams.ExternalDNSServers - $setTargetResourceParams.ExternalDNSServers = $null - Mock -CommandName Set-TransportService -Verifiable - - Set-TargetResource @setTargetResourceParams - - $setTargetResourceParams.ExternalDNSServers = $ExternalDNSServers - } - - It 'Should warn that a MSExchangeTransport service restart is required' { - $AllowServiceRestart = $setTargetResourceParams.AllowServiceRestart - $setTargetResourceParams.AllowServiceRestart = $false - Mock -CommandName Set-TransportService -Verifiable - Mock -CommandName Write-Warning -Verifiable -ParameterFilter {$Message -eq 'The configuration will not take effect until the MSExchangeTransport service is manually restarted.'} - - Set-TargetResource @setTargetResourceParams - $setTargetResourceParams.AllowServiceRestart = $AllowServiceRestart - } - } - } - - Describe 'MSFT_xExchTransportService\Test-TargetResource' -Tag 'Test' { - # Override Exchange cmdlets - Mock -CommandName Get-RemoteExchangeSession -Verifiable - - function Get-TransportService {} - - AfterEach { - Assert-VerifiableMock - } - - Context 'When Test-TargetResource is called' { - It 'Should return False when Get-TransportService returns False' { - Mock -CommandName Get-TransportService -Verifiable - - Test-TargetResource @commonTargetResourceParams -ErrorAction SilentlyContinue | Should -Be $false - } - It 'Should return False when Test-ExchangeSetting returns False' { - Mock -CommandName Get-TransportService -Verifiable -MockWith { return $commonTransportServiceStandardOutput } - Mock -CommandName Test-ExchangeSetting -Verifiable -MockWith { return $false } - - Test-TargetResource @commonTargetResourceParams | Should -Be $false - } - - It 'Should return True when Test-ExchangeSetting returns True' { - Mock -CommandName Get-TransportService -Verifiable -MockWith { return $commonTransportServiceStandardOutput } - Mock -CommandName Test-ExchangeSetting -Verifiable -MockWith { return $true } - - Test-TargetResource @commonTargetResourceParams | Should -Be $true - } - } - } - } -} -finally -{ - Invoke-TestCleanup -} diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index 0ce18655..00000000 --- a/appveyor.yml +++ /dev/null @@ -1,44 +0,0 @@ -#---------------------------------# -# environment configuration # -#---------------------------------# - -version: 1.13.{build}.0 -environment: - gallery_api: - secure: 9ekJzfsPCDBkyLrfmov83XbbhZ6E2N3z+B/Io8NbDetbHc6hWS19zsDmy7t0Vvxv - -install: - - git clone https://github.com/PowerShell/DscResource.Tests - - ps: Write-Verbose -Message "PowerShell version $($PSVersionTable.PSVersion)" -Verbose - - ps: Install-Module -Name xPendingReboot - - ps: Install-Module -Name xWebAdministration - - ps: Import-Module "$env:APPVEYOR_BUILD_FOLDER\DscResource.Tests\AppVeyor.psm1" - - ps: Invoke-AppveyorInstallTask - -#---------------------------------# -# build configuration # -#---------------------------------# - -build: false - -#---------------------------------# -# test configuration # -#---------------------------------# - -test_script: - - ps: | - Invoke-AppveyorTestScriptTask -CodeCoverage -CodeCovIo -RunTestInOrder - -# scripts to run before deployment -after_test: - - ps: | - Import-Module -Name "$env:APPVEYOR_BUILD_FOLDER\DscResource.Tests\AppVeyor.psm1" - Invoke-AppveyorAfterTestTask - -#---------------------------------# -# deployment configuration # -#---------------------------------# - -deploy_script: - - ps: | - Invoke-AppVeyorDeployTask diff --git a/azure-pipelines.yml b/azure-pipelines.yml new file mode 100644 index 00000000..25e05bc5 --- /dev/null +++ b/azure-pipelines.yml @@ -0,0 +1,139 @@ +trigger: + branches: + include: + - master + tags: + include: + - "v*" + exclude: + - "*-*" + +stages: + - stage: Build + jobs: + - job: BuildModuleJob + pool: + vmImage: 'ubuntu 16.04' + steps: + - task: GitVersion@5 + name: gitversion + inputs: + runtime: 'core' + configFilePath: 'GitVersion.yml' + + - task: PowerShell@2 + name: Build + inputs: + filePath: './build.ps1' + arguments: '-ResolveDependency -tasks pack' + pwsh: true + env: + ModuleVersion: $(GitVersion.Informationalversion) + + - task: PublishBuildArtifacts@1 + inputs: + PathtoPublish: 'output/' + ArtifactName: 'output' + publishLocation: 'Container' + + - stage: Test + dependsOn: Build + jobs: + - job: Test_HQRM + pool: + vmImage: 'win1803' + timeoutInMinutes: 0 + steps: + - task: DownloadBuildArtifacts@0 + inputs: + buildType: 'current' + downloadType: 'single' + artifactName: 'output' + downloadPath: '$(Build.SourcesDirectory)' + - task: PowerShell@2 + name: Test + inputs: + filePath: './build.ps1' + arguments: '-Tasks hqrmtest' + pwsh: false + - task: PublishTestResults@2 + condition: succeededOrFailed() + inputs: + testResultsFormat: 'NUnit' + testResultsFiles: 'output/testResults/NUnit*.xml' + testRunTitle: 'HQRM' + + - job: Test_Unit + pool: + vmImage: 'win1803' + timeoutInMinutes: 0 + steps: + - powershell: | + $repositoryOwner,$repositoryName = $env:BUILD_REPOSITORY_NAME -split '/' + echo "##vso[task.setvariable variable=RepositoryOwner;isOutput=true]$repositoryOwner" + echo "##vso[task.setvariable variable=RepositoryName;isOutput=true]$repositoryName" + name: DscBuildVariable + - task: DownloadBuildArtifacts@0 + inputs: + buildType: 'current' + downloadType: 'single' + artifactName: 'output' + downloadPath: '$(Build.SourcesDirectory)' + - task: PowerShell@2 + name: Test + inputs: + filePath: './build.ps1' + arguments: "-Tasks test -PesterScript 'tests/Unit'" + pwsh: false + - task: PublishTestResults@2 + condition: succeededOrFailed() + inputs: + testResultsFormat: 'NUnit' + testResultsFiles: 'output/testResults/NUnit*.xml' + testRunTitle: 'Unit (Windows Server Core)' + - task: PublishCodeCoverageResults@1 + condition: succeededOrFailed() + inputs: + codeCoverageTool: 'JaCoCo' + summaryFileLocation: 'output/testResults/CodeCov*.xml' + pathToSources: '$(Build.SourcesDirectory)/output/$(DscBuildVariable.RepositoryName)' + + - stage: Deploy + dependsOn: test + # Only execute deploy stage if we're on master and previous stage succeeded + condition: | + and( + succeeded(), + or( + eq(variables['Build.SourceBranch'], 'refs/heads/master'), + startsWith(variables['Build.SourceBranch'], 'refs/tags/') + ) + ) + jobs: + - job: Deploy_Artefact + pool: + vmImage: 'ubuntu 16.04' + steps: + - task: DownloadBuildArtifacts@0 + inputs: + buildType: 'current' + downloadType: 'single' + artifactName: 'output' + downloadPath: '$(Build.SourcesDirectory)' + - task: PowerShell@2 + name: publish_prerelease + inputs: + filePath: './build.ps1' + arguments: '-tasks publish' + pwsh: true + env: + GitHubToken: $(GitHubToken) + GalleryApiToken: $(GalleryApiToken) + - task: PowerShell@2 + name: send_changelog_PR + inputs: + filePath: './build.ps1' + arguments: '-tasks Create_ChangeLog_GitHub_PR' + pwsh: true + env: + GitHubToken: $(GitHubToken) diff --git a/build.ps1 b/build.ps1 new file mode 100644 index 00000000..8b20c403 --- /dev/null +++ b/build.ps1 @@ -0,0 +1,365 @@ +<# + +.DESCRIPTION + Bootstrap and build script for PowerShell module pipeline + +#> +[CmdletBinding()] +param +( + [Parameter(Position = 0)] + [string[]]$Tasks = '.', + + [Parameter()] + [String] + $CodeCoverageThreshold = '', + + [Parameter()] + [validateScript( + { Test-Path -Path $_ } + )] + $BuildConfig = './build.yaml', + + [Parameter()] + # A Specific folder to build the artefact into. + $OutputDirectory = 'output', + + [Parameter()] + # Subdirectory name to build the module (under $OutputDirectory) + $BuiltModuleSubdirectory = '', + + # Can be a path (relative to $PSScriptRoot or absolute) to tell Resolve-Dependency & PSDepend where to save the required modules, + # or use CurrentUser, AllUsers to target where to install missing dependencies + # You can override the value for PSDepend in the Build.psd1 build manifest + # This defaults to $OutputDirectory/modules (by default: ./output/modules) + [Parameter()] + $RequiredModulesDirectory = $(Join-Path 'output' 'RequiredModules'), + + [Parameter()] + [string[]] + $PesterScript, + + # Filter which tags to run when invoking Pester tests + # This is used in the Invoke-Pester.pester.build.ps1 tasks + [Parameter()] + [string[]] + $PesterTag, + + # Filter which tags to exclude when invoking Pester tests + # This is used in the Invoke-Pester.pester.build.ps1 tasks + [Parameter()] + [string[]] + $PesterExcludeTag, + + # Filter which tags to run when invoking DSC Resource tests + # This is used in the DscResource.Test.build.ps1 tasks + [Parameter()] + [string[]] + $DscTestTag, + + # Filter which tags to exclude when invoking DSC Resource tests + # This is used in the DscResource.Test.build.ps1 tasks + [Parameter()] + [string[]] + $DscTestExcludeTag, + + [Parameter()] + [Alias('bootstrap')] + [switch]$ResolveDependency, + + [Parameter(DontShow)] + [AllowNull()] + $BuildInfo, + + [Parameter()] + [switch] + $AutoRestore +) + +# The BEGIN block (at the end of this file) handles the Bootstrap of the Environment before Invoke-Build can run the tasks +# if the -ResolveDependency (aka Bootstrap) is specified, the modules are already available, and can be auto loaded + +process +{ + + if ($MyInvocation.ScriptName -notLike '*Invoke-Build.ps1') + { + # Only run the process block through InvokeBuild (Look at the Begin block at the bottom of this script) + return + } + + # Execute the Build Process from the .build.ps1 path. + Push-Location -Path $PSScriptRoot -StackName BeforeBuild + + try + { + Write-Host -ForeGroundColor magenta "[build] Parsing defined tasks" + + # Load Default BuildInfo if not provided as parameter + if (!$PSBoundParameters.ContainsKey('BuildInfo')) + { + try + { + if (Test-Path $BuildConfig) + { + $ConfigFile = (Get-Item -Path $BuildConfig) + Write-Host "[build] Loading Configuration from $ConfigFile" + $BuildInfo = switch -Regex ($ConfigFile.Extension) + { + # Native Support for PSD1 + '\.psd1' + { + Import-PowerShellDataFile -Path $BuildConfig + } + # Support for yaml when module PowerShell-Yaml is available + '\.[yaml|yml]' + { + Import-Module -ErrorAction Stop -Name 'powershell-yaml' + ConvertFrom-Yaml -Yaml (Get-Content -Raw $ConfigFile) + } + # Native Support for JSON and JSONC (by Removing comments) + '\.[json|jsonc]' + { + $JSONC = (Get-Content -Raw -Path $ConfigFile) + $JSON = $JSONC -replace '(?m)\s*//.*?$' -replace '(?ms)/\*.*?\*/' + # This should probably be converted to hashtable for splatting + $JSON | ConvertFrom-Json + } + default + { + Write-Error "Extension '$_' not supported. using @{}" + @{ } + } + } + } + else + { + Write-Host -Object "Configuration file $BuildConfig not found" -ForegroundColor Red + $BuildInfo = @{ } + } + } + catch + { + Write-Host -Object "Error loading Config $ConfigFile.`r`n Are you missing dependencies?" -ForegroundColor Yellow + Write-Host -Object "Make sure you run './build.ps1 -ResolveDependency -tasks noop' to restore the Required modules the first time" -ForegroundColor Yellow + $BuildInfo = @{ } + Write-Error $_.Exception.Message + } + } + + # If the Invoke-Build Task Header is specified in the Build Info, set it + if ($BuildInfo.TaskHeader) + { + Set-BuildHeader ([scriptblock]::Create($BuildInfo.TaskHeader)) + } + + # Import Tasks from modules via their exported aliases when defined in BUild Manifest + # https://github.com/nightroman/Invoke-Build/tree/master/Tasks/Import#example-2-import-from-a-module-with-tasks + if ($BuildInfo.containsKey('ModuleBuildTasks')) + { + foreach ($Module in $BuildInfo['ModuleBuildTasks'].Keys) + { + try + { + Write-Host -ForegroundColor DarkGray -Verbose "Importing tasks from module $Module" + $LoadedModule = Import-Module $Module -PassThru -ErrorAction Stop + foreach ($TaskToExport in $BuildInfo['ModuleBuildTasks'].($Module)) + { + $LoadedModule.ExportedAliases.GetEnumerator().Where{ + # using -like to support wildcard + Write-Host -ForegroundColor DarkGray "`t Loading $($_.Key)..." + $_.Key -like $TaskToExport + }.ForEach{ + # Dot sourcing the Tasks via their exported aliases + . (Get-Alias $_.Key) + } + } + } + catch + { + Write-Host -ForegroundColor Red -Object "Could not load tasks for module $Module." + Write-Error $_ + } + } + } + + # Loading Build Tasks defined in the .build/ folder (will override the ones imported above if same task name) + Get-ChildItem -Path ".build/" -Recurse -Include *.ps1 -ErrorAction Ignore | ForEach-Object { + "Importing file $($_.BaseName)" | Write-Verbose + . $_.FullName + } + + # Synopsis: Empty task, useful to test the bootstrap process + task noop { } + + # Define default task sequence ("."), can be overridden in the $BuildInfo + task . { + Write-Build Yellow "No sequence currently defined for the default task" + } + + # Load Invoke-Build task sequences/workflows from $BuildInfo + Write-Host -ForegroundColor DarkGray "Adding Workflow from configuration:" + foreach ($Workflow in $BuildInfo.BuildWorkflow.keys) + { + Write-Verbose "Creating Build Workflow '$Workflow' with tasks $($BuildInfo.BuildWorkflow.($Workflow) -join ', ')" + $WorkflowItem = $BuildInfo.BuildWorkflow.($Workflow) + if ($WorkflowItem.Trim() -match '^\{(?[\w\W]*)\}$') + { + $WorkflowItem = [ScriptBlock]::Create($Matches['sb']) + } + Write-Host -ForegroundColor DarkGray " +-> $Workflow" + task $Workflow $WorkflowItem + } + + Write-Host -ForeGroundColor magenta "[build] Executing requested workflow: $($Tasks -join ', ')" + + } + finally + { + Pop-Location -StackName BeforeBuild + } +} + +Begin +{ + # Bootstrapping the environment before using Invoke-Build as task runner + + if ($MyInvocation.ScriptName -notLike '*Invoke-Build.ps1') + { + Write-Host -foregroundColor Green "[pre-build] Starting Build Init" + Push-Location $PSScriptRoot -StackName BuildModule + } + + if ($RequiredModulesDirectory -in @('CurrentUser', 'AllUsers')) + { + # Installing modules instead of saving them + Write-Host -foregroundColor Green "[pre-build] Required Modules will be installed for $RequiredModulesDirectory, not saved." + # Tell Resolve-Dependency to use provided scope as the -PSDependTarget if not overridden in Build.psd1 + $PSDependTarget = $RequiredModulesDirectory + } + else + { + if (-Not (Split-Path -IsAbsolute -Path $OutputDirectory)) + { + $OutputDirectory = Join-Path -Path $PSScriptRoot -ChildPath $OutputDirectory + } + + # Resolving the absolute path to save the required modules to + if (-Not (Split-Path -IsAbsolute -Path $RequiredModulesDirectory)) + { + $RequiredModulesDirectory = Join-Path -Path $PSScriptRoot -ChildPath $RequiredModulesDirectory + } + + # Create the output/modules folder if not exists, or resolve the Absolute path otherwise + if (Resolve-Path $RequiredModulesDirectory -ErrorAction SilentlyContinue) + { + Write-Debug "[pre-build] Required Modules path already exist at $RequiredModulesDirectory" + $RequiredModulesPath = Convert-Path $RequiredModulesDirectory + } + else + { + Write-Host -foregroundColor Green "[pre-build] Creating required modules directory $RequiredModulesDirectory." + $RequiredModulesPath = (New-Item -ItemType Directory -Force -Path $RequiredModulesDirectory).FullName + } + + # Prepending $RequiredModulesPath folder to PSModulePath to resolve from this folder FIRST + if ($RequiredModulesDirectory -notIn @('CurrentUser', 'AllUsers') -and + (($Env:PSModulePath -split [io.path]::PathSeparator) -notContains $RequiredModulesDirectory)) + { + Write-Host -foregroundColor Green "[pre-build] Prepending '$RequiredModulesDirectory' folder to PSModulePath" + $Env:PSModulePath = $RequiredModulesDirectory + [io.path]::PathSeparator + $Env:PSModulePath + } + + # Checking if the user should -ResolveDependency + if ((!(Get-Module -ListAvailable powershell-yaml) -or !(Get-Module -ListAvailable InvokeBuild) -or !(Get-Module -ListAvailable PSDepend)) -and !$ResolveDependency) + { + if ($AutoRestore -or !$PSBoundParameters.ContainsKey('Tasks') -or $Tasks -contains 'build') + { + Write-Host -ForegroundColor Yellow "[pre-build] Dependency missing, running './build.ps1 -ResolveDependency -Tasks noop' for you `r`n" + $ResolveDependency = $true + } + else + { + Write-Warning "Some required Modules are missing, make sure you first run with the '-ResolveDependency' parameter." + Write-Warning "Running 'build.ps1 -ResolveDependency -Tasks noop' will pull required modules without running the build task." + } + } + + if ($BuiltModuleSubdirectory) + { + if (-Not (Split-Path -IsAbsolute $BuiltModuleSubdirectory)) + { + $BuildModuleOutput = Join-Path $OutputDirectory $BuiltModuleSubdirectory + } + else + { + $BuildModuleOutput = $BuiltModuleSubdirectory + } + } + else + { + $BuildModuleOutput = $OutputDirectory + } + + # Prepending $BuildModuleOutput folder to PSModulePath to resolve built module from this folder + if (($Env:PSModulePath -split [io.path]::PathSeparator) -notContains $BuildModuleOutput) + { + Write-Host -foregroundColor Green "[pre-build] Prepending '$BuildModuleOutput' folder to PSModulePath" + $Env:PSModulePath = $BuildModuleOutput + [io.path]::PathSeparator + $Env:PSModulePath + } + + # Tell Resolve-Dependency to use $RequiredModulesPath as -PSDependTarget if not overridden in Build.psd1 + $PSDependTarget = $RequiredModulesPath + } + + if ($ResolveDependency) + { + Write-Host -Object "[pre-build] Resolving dependencies." -foregroundColor Green + $ResolveDependencyParams = @{ } + + # If BuildConfig is a Yaml file, bootstrap powershell-yaml via ResolveDependency + if ($BuildConfig -match '\.[yaml|yml]$') + { + $ResolveDependencyParams.add('WithYaml', $True) + } + + $ResolveDependencyAvailableParams = (Get-Command -Name '.\Resolve-Dependency.ps1').parameters.keys + foreach ($CmdParameter in $ResolveDependencyAvailableParams) + { + + # The parameter has been explicitly used for calling the .build.ps1 + if ($MyInvocation.BoundParameters.ContainsKey($CmdParameter)) + { + $ParamValue = $MyInvocation.BoundParameters.ContainsKey($CmdParameter) + Write-Debug " adding $CmdParameter :: $ParamValue [from user-provided parameters to Build.ps1]" + $ResolveDependencyParams.Add($CmdParameter, $ParamValue) + } + # Use defaults parameter value from Build.ps1, if any + else + { + if ($ParamValue = Get-Variable -Name $CmdParameter -ValueOnly -ErrorAction Ignore) + { + Write-Debug " adding $CmdParameter :: $ParamValue [from default Build.ps1 variable]" + $ResolveDependencyParams.add($CmdParameter, $ParamValue) + } + } + } + + Write-Host -foregroundColor Green "[pre-build] Starting bootstrap process." + .\Resolve-Dependency.ps1 @ResolveDependencyParams + } + + if ($MyInvocation.ScriptName -notLike '*Invoke-Build.ps1') + { + Write-Verbose "Bootstrap completed. Handing back to InvokeBuild." + if ($PSBoundParameters.ContainsKey('ResolveDependency')) + { + Write-Verbose "Dependency already resolved. Removing task" + $null = $PSBoundParameters.Remove('ResolveDependency') + } + Write-Host -foregroundColor Green "[build] Starting build with InvokeBuild." + Invoke-Build @PSBoundParameters -Task $Tasks -File $MyInvocation.MyCommand.Path + Pop-Location -StackName BuildModule + return + } +} diff --git a/build.yaml b/build.yaml new file mode 100644 index 00000000..d22ba6dc --- /dev/null +++ b/build.yaml @@ -0,0 +1,80 @@ +--- +CopyDirectories: + - en-US + - DSCResources + - Modules +Encoding: UTF8 +VersionedOutputDirectory: true + +BuildWorkflow: + ".": + - build + - test + + build: + - Clean + - Build_Module_ModuleBuilder + - Build_NestedModules_ModuleBuilder + - Create_changelog_release_output + + pack: + - build + - package_module_nupkg + + hqrmtest: + - DscResource_Tests_Stop_On_Fail + + test: + - Pester_Tests_Stop_On_Fail + - Pester_if_Code_Coverage_Under_Threshold + + publish: + - Publish_release_to_GitHub + - publish_module_to_gallery + +Pester: + OutputFormat: NUnitXML + ExcludeFromCodeCoverage: + Script: + - tests/Unit + ExcludeTag: + Tag: + CodeCoverageThreshold: 47 + +DscTest: + ExcludeTag: + - "Common Tests - New Error-Level Script Analyzer Rules" + - "Common Tests - Validate Localization" + - "Common Tests - Validate Example Files" + Tag: + ExcludeSourceFile: + - output + - Examples + ExcludeModuleFile: + +Resolve-Dependency: + Gallery: "PSGallery" + AllowPrerelease: false + Verbose: false + +ModuleBuildTasks: + Sampler: + - "*.build.Sampler.ib.tasks" + +TaskHeader: | + param($Path) + "" + "=" * 79 + Write-Build Cyan "`t`t`t$($Task.Name.replace("_"," ").ToUpper())" + Write-Build DarkGray "$(Get-BuildSynopsis $Task)" + "-" * 79 + Write-Build DarkGray " $Path" + Write-Build DarkGray " $($Task.InvocationInfo.ScriptName):$($Task.InvocationInfo.ScriptLineNumber)" + "" + +GitHubConfig: + GitHubFilesToAdd: + - "CHANGELOG.md" + GitHubConfigUserName: dscbot + GitHubConfigUserEmail: dsccommunity@outlook.com + UpdateChangelogOnPrerelease: false diff --git a/DSCResources/MSFT_xExchAcceptedDomain/MSFT_xExchAcceptedDomain.psm1 b/source/DSCResources/MSFT_xExchAcceptedDomain/MSFT_xExchAcceptedDomain.psm1 similarity index 100% rename from DSCResources/MSFT_xExchAcceptedDomain/MSFT_xExchAcceptedDomain.psm1 rename to source/DSCResources/MSFT_xExchAcceptedDomain/MSFT_xExchAcceptedDomain.psm1 diff --git a/DSCResources/MSFT_xExchAcceptedDomain/MSFT_xExchAcceptedDomain.schema.mof b/source/DSCResources/MSFT_xExchAcceptedDomain/MSFT_xExchAcceptedDomain.schema.mof similarity index 100% rename from DSCResources/MSFT_xExchAcceptedDomain/MSFT_xExchAcceptedDomain.schema.mof rename to source/DSCResources/MSFT_xExchAcceptedDomain/MSFT_xExchAcceptedDomain.schema.mof diff --git a/DSCResources/MSFT_xExchActiveSyncVirtualDirectory/MSFT_xExchActiveSyncVirtualDirectory.psm1 b/source/DSCResources/MSFT_xExchActiveSyncVirtualDirectory/MSFT_xExchActiveSyncVirtualDirectory.psm1 similarity index 100% rename from DSCResources/MSFT_xExchActiveSyncVirtualDirectory/MSFT_xExchActiveSyncVirtualDirectory.psm1 rename to source/DSCResources/MSFT_xExchActiveSyncVirtualDirectory/MSFT_xExchActiveSyncVirtualDirectory.psm1 diff --git a/DSCResources/MSFT_xExchActiveSyncVirtualDirectory/MSFT_xExchActiveSyncVirtualDirectory.schema.mof b/source/DSCResources/MSFT_xExchActiveSyncVirtualDirectory/MSFT_xExchActiveSyncVirtualDirectory.schema.mof similarity index 100% rename from DSCResources/MSFT_xExchActiveSyncVirtualDirectory/MSFT_xExchActiveSyncVirtualDirectory.schema.mof rename to source/DSCResources/MSFT_xExchActiveSyncVirtualDirectory/MSFT_xExchActiveSyncVirtualDirectory.schema.mof diff --git a/DSCResources/MSFT_xExchAddressList/MSFT_xExchAddressList.psm1 b/source/DSCResources/MSFT_xExchAddressList/MSFT_xExchAddressList.psm1 similarity index 100% rename from DSCResources/MSFT_xExchAddressList/MSFT_xExchAddressList.psm1 rename to source/DSCResources/MSFT_xExchAddressList/MSFT_xExchAddressList.psm1 diff --git a/DSCResources/MSFT_xExchAddressList/MSFT_xExchAddressList.schema.mof b/source/DSCResources/MSFT_xExchAddressList/MSFT_xExchAddressList.schema.mof similarity index 100% rename from DSCResources/MSFT_xExchAddressList/MSFT_xExchAddressList.schema.mof rename to source/DSCResources/MSFT_xExchAddressList/MSFT_xExchAddressList.schema.mof diff --git a/DSCResources/MSFT_xExchAntiMalwareScanning/MSFT_xExchAntiMalwareScanning.psm1 b/source/DSCResources/MSFT_xExchAntiMalwareScanning/MSFT_xExchAntiMalwareScanning.psm1 similarity index 100% rename from DSCResources/MSFT_xExchAntiMalwareScanning/MSFT_xExchAntiMalwareScanning.psm1 rename to source/DSCResources/MSFT_xExchAntiMalwareScanning/MSFT_xExchAntiMalwareScanning.psm1 diff --git a/DSCResources/MSFT_xExchAntiMalwareScanning/MSFT_xExchAntiMalwareScanning.schema.mof b/source/DSCResources/MSFT_xExchAntiMalwareScanning/MSFT_xExchAntiMalwareScanning.schema.mof similarity index 100% rename from DSCResources/MSFT_xExchAntiMalwareScanning/MSFT_xExchAntiMalwareScanning.schema.mof rename to source/DSCResources/MSFT_xExchAntiMalwareScanning/MSFT_xExchAntiMalwareScanning.schema.mof diff --git a/DSCResources/MSFT_xExchAutoMountPoint/MSFT_xExchAutoMountPoint.psm1 b/source/DSCResources/MSFT_xExchAutoMountPoint/MSFT_xExchAutoMountPoint.psm1 similarity index 99% rename from DSCResources/MSFT_xExchAutoMountPoint/MSFT_xExchAutoMountPoint.psm1 rename to source/DSCResources/MSFT_xExchAutoMountPoint/MSFT_xExchAutoMountPoint.psm1 index c8e92d48..3f765018 100644 --- a/DSCResources/MSFT_xExchAutoMountPoint/MSFT_xExchAutoMountPoint.psm1 +++ b/source/DSCResources/MSFT_xExchAutoMountPoint/MSFT_xExchAutoMountPoint.psm1 @@ -1,4 +1,4 @@ -Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Modules\xExchangeDiskPart.psm1" -Force +Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Modules\xExchangeDiskPart\xExchangeDiskPart.psd1" -Force <# .SYNOPSIS diff --git a/DSCResources/MSFT_xExchAutoMountPoint/MSFT_xExchAutoMountPoint.schema.mof b/source/DSCResources/MSFT_xExchAutoMountPoint/MSFT_xExchAutoMountPoint.schema.mof similarity index 100% rename from DSCResources/MSFT_xExchAutoMountPoint/MSFT_xExchAutoMountPoint.schema.mof rename to source/DSCResources/MSFT_xExchAutoMountPoint/MSFT_xExchAutoMountPoint.schema.mof diff --git a/DSCResources/MSFT_xExchAutodiscoverVirtualDirectory/MSFT_xExchAutodiscoverVirtualDirectory.psm1 b/source/DSCResources/MSFT_xExchAutodiscoverVirtualDirectory/MSFT_xExchAutodiscoverVirtualDirectory.psm1 similarity index 100% rename from DSCResources/MSFT_xExchAutodiscoverVirtualDirectory/MSFT_xExchAutodiscoverVirtualDirectory.psm1 rename to source/DSCResources/MSFT_xExchAutodiscoverVirtualDirectory/MSFT_xExchAutodiscoverVirtualDirectory.psm1 diff --git a/DSCResources/MSFT_xExchAutodiscoverVirtualDirectory/MSFT_xExchAutodiscoverVirtualDirectory.schema.mof b/source/DSCResources/MSFT_xExchAutodiscoverVirtualDirectory/MSFT_xExchAutodiscoverVirtualDirectory.schema.mof similarity index 100% rename from DSCResources/MSFT_xExchAutodiscoverVirtualDirectory/MSFT_xExchAutodiscoverVirtualDirectory.schema.mof rename to source/DSCResources/MSFT_xExchAutodiscoverVirtualDirectory/MSFT_xExchAutodiscoverVirtualDirectory.schema.mof diff --git a/DSCResources/MSFT_xExchClientAccessServer/MSFT_xExchClientAccessServer.psm1 b/source/DSCResources/MSFT_xExchClientAccessServer/MSFT_xExchClientAccessServer.psm1 similarity index 100% rename from DSCResources/MSFT_xExchClientAccessServer/MSFT_xExchClientAccessServer.psm1 rename to source/DSCResources/MSFT_xExchClientAccessServer/MSFT_xExchClientAccessServer.psm1 diff --git a/DSCResources/MSFT_xExchClientAccessServer/MSFT_xExchClientAccessServer.schema.mof b/source/DSCResources/MSFT_xExchClientAccessServer/MSFT_xExchClientAccessServer.schema.mof similarity index 100% rename from DSCResources/MSFT_xExchClientAccessServer/MSFT_xExchClientAccessServer.schema.mof rename to source/DSCResources/MSFT_xExchClientAccessServer/MSFT_xExchClientAccessServer.schema.mof diff --git a/DSCResources/MSFT_xExchDatabaseAvailabilityGroup/MSFT_xExchDatabaseAvailabilityGroup.psm1 b/source/DSCResources/MSFT_xExchDatabaseAvailabilityGroup/MSFT_xExchDatabaseAvailabilityGroup.psm1 similarity index 100% rename from DSCResources/MSFT_xExchDatabaseAvailabilityGroup/MSFT_xExchDatabaseAvailabilityGroup.psm1 rename to source/DSCResources/MSFT_xExchDatabaseAvailabilityGroup/MSFT_xExchDatabaseAvailabilityGroup.psm1 diff --git a/DSCResources/MSFT_xExchDatabaseAvailabilityGroup/MSFT_xExchDatabaseAvailabilityGroup.schema.mof b/source/DSCResources/MSFT_xExchDatabaseAvailabilityGroup/MSFT_xExchDatabaseAvailabilityGroup.schema.mof similarity index 100% rename from DSCResources/MSFT_xExchDatabaseAvailabilityGroup/MSFT_xExchDatabaseAvailabilityGroup.schema.mof rename to source/DSCResources/MSFT_xExchDatabaseAvailabilityGroup/MSFT_xExchDatabaseAvailabilityGroup.schema.mof diff --git a/DSCResources/MSFT_xExchDatabaseAvailabilityGroupMember/MSFT_xExchDatabaseAvailabilityGroupMember.psm1 b/source/DSCResources/MSFT_xExchDatabaseAvailabilityGroupMember/MSFT_xExchDatabaseAvailabilityGroupMember.psm1 similarity index 100% rename from DSCResources/MSFT_xExchDatabaseAvailabilityGroupMember/MSFT_xExchDatabaseAvailabilityGroupMember.psm1 rename to source/DSCResources/MSFT_xExchDatabaseAvailabilityGroupMember/MSFT_xExchDatabaseAvailabilityGroupMember.psm1 diff --git a/DSCResources/MSFT_xExchDatabaseAvailabilityGroupMember/MSFT_xExchDatabaseAvailabilityGroupMember.schema.mof b/source/DSCResources/MSFT_xExchDatabaseAvailabilityGroupMember/MSFT_xExchDatabaseAvailabilityGroupMember.schema.mof similarity index 100% rename from DSCResources/MSFT_xExchDatabaseAvailabilityGroupMember/MSFT_xExchDatabaseAvailabilityGroupMember.schema.mof rename to source/DSCResources/MSFT_xExchDatabaseAvailabilityGroupMember/MSFT_xExchDatabaseAvailabilityGroupMember.schema.mof diff --git a/DSCResources/MSFT_xExchDatabaseAvailabilityGroupNetwork/MSFT_xExchDatabaseAvailabilityGroupNetwork.psm1 b/source/DSCResources/MSFT_xExchDatabaseAvailabilityGroupNetwork/MSFT_xExchDatabaseAvailabilityGroupNetwork.psm1 similarity index 100% rename from DSCResources/MSFT_xExchDatabaseAvailabilityGroupNetwork/MSFT_xExchDatabaseAvailabilityGroupNetwork.psm1 rename to source/DSCResources/MSFT_xExchDatabaseAvailabilityGroupNetwork/MSFT_xExchDatabaseAvailabilityGroupNetwork.psm1 diff --git a/DSCResources/MSFT_xExchDatabaseAvailabilityGroupNetwork/MSFT_xExchDatabaseAvailabilityGroupNetwork.schema.mof b/source/DSCResources/MSFT_xExchDatabaseAvailabilityGroupNetwork/MSFT_xExchDatabaseAvailabilityGroupNetwork.schema.mof similarity index 100% rename from DSCResources/MSFT_xExchDatabaseAvailabilityGroupNetwork/MSFT_xExchDatabaseAvailabilityGroupNetwork.schema.mof rename to source/DSCResources/MSFT_xExchDatabaseAvailabilityGroupNetwork/MSFT_xExchDatabaseAvailabilityGroupNetwork.schema.mof diff --git a/DSCResources/MSFT_xExchEcpVirtualDirectory/MSFT_xExchEcpVirtualDirectory.psm1 b/source/DSCResources/MSFT_xExchEcpVirtualDirectory/MSFT_xExchEcpVirtualDirectory.psm1 similarity index 100% rename from DSCResources/MSFT_xExchEcpVirtualDirectory/MSFT_xExchEcpVirtualDirectory.psm1 rename to source/DSCResources/MSFT_xExchEcpVirtualDirectory/MSFT_xExchEcpVirtualDirectory.psm1 diff --git a/DSCResources/MSFT_xExchEcpVirtualDirectory/MSFT_xExchEcpVirtualDirectory.schema.mof b/source/DSCResources/MSFT_xExchEcpVirtualDirectory/MSFT_xExchEcpVirtualDirectory.schema.mof similarity index 100% rename from DSCResources/MSFT_xExchEcpVirtualDirectory/MSFT_xExchEcpVirtualDirectory.schema.mof rename to source/DSCResources/MSFT_xExchEcpVirtualDirectory/MSFT_xExchEcpVirtualDirectory.schema.mof diff --git a/DSCResources/MSFT_xExchEventLogLevel/MSFT_xExchEventLogLevel.psm1 b/source/DSCResources/MSFT_xExchEventLogLevel/MSFT_xExchEventLogLevel.psm1 similarity index 100% rename from DSCResources/MSFT_xExchEventLogLevel/MSFT_xExchEventLogLevel.psm1 rename to source/DSCResources/MSFT_xExchEventLogLevel/MSFT_xExchEventLogLevel.psm1 diff --git a/DSCResources/MSFT_xExchEventLogLevel/MSFT_xExchEventLogLevel.schema.mof b/source/DSCResources/MSFT_xExchEventLogLevel/MSFT_xExchEventLogLevel.schema.mof similarity index 100% rename from DSCResources/MSFT_xExchEventLogLevel/MSFT_xExchEventLogLevel.schema.mof rename to source/DSCResources/MSFT_xExchEventLogLevel/MSFT_xExchEventLogLevel.schema.mof diff --git a/DSCResources/MSFT_xExchExchangeCertificate/MSFT_xExchExchangeCertificate.psm1 b/source/DSCResources/MSFT_xExchExchangeCertificate/MSFT_xExchExchangeCertificate.psm1 similarity index 100% rename from DSCResources/MSFT_xExchExchangeCertificate/MSFT_xExchExchangeCertificate.psm1 rename to source/DSCResources/MSFT_xExchExchangeCertificate/MSFT_xExchExchangeCertificate.psm1 diff --git a/DSCResources/MSFT_xExchExchangeCertificate/MSFT_xExchExchangeCertificate.schema.mof b/source/DSCResources/MSFT_xExchExchangeCertificate/MSFT_xExchExchangeCertificate.schema.mof similarity index 100% rename from DSCResources/MSFT_xExchExchangeCertificate/MSFT_xExchExchangeCertificate.schema.mof rename to source/DSCResources/MSFT_xExchExchangeCertificate/MSFT_xExchExchangeCertificate.schema.mof diff --git a/DSCResources/MSFT_xExchExchangeServer/MSFT_xExchExchangeServer.psm1 b/source/DSCResources/MSFT_xExchExchangeServer/MSFT_xExchExchangeServer.psm1 similarity index 100% rename from DSCResources/MSFT_xExchExchangeServer/MSFT_xExchExchangeServer.psm1 rename to source/DSCResources/MSFT_xExchExchangeServer/MSFT_xExchExchangeServer.psm1 diff --git a/DSCResources/MSFT_xExchExchangeServer/MSFT_xExchExchangeServer.schema.mof b/source/DSCResources/MSFT_xExchExchangeServer/MSFT_xExchExchangeServer.schema.mof similarity index 100% rename from DSCResources/MSFT_xExchExchangeServer/MSFT_xExchExchangeServer.schema.mof rename to source/DSCResources/MSFT_xExchExchangeServer/MSFT_xExchExchangeServer.schema.mof diff --git a/DSCResources/MSFT_xExchFrontendTransportService/MSFT_xExchFrontendTransportService.psm1 b/source/DSCResources/MSFT_xExchFrontendTransportService/MSFT_xExchFrontendTransportService.psm1 similarity index 100% rename from DSCResources/MSFT_xExchFrontendTransportService/MSFT_xExchFrontendTransportService.psm1 rename to source/DSCResources/MSFT_xExchFrontendTransportService/MSFT_xExchFrontendTransportService.psm1 diff --git a/DSCResources/MSFT_xExchFrontendTransportService/MSFT_xExchFrontendTransportService.schema.mof b/source/DSCResources/MSFT_xExchFrontendTransportService/MSFT_xExchFrontendTransportService.schema.mof similarity index 100% rename from DSCResources/MSFT_xExchFrontendTransportService/MSFT_xExchFrontendTransportService.schema.mof rename to source/DSCResources/MSFT_xExchFrontendTransportService/MSFT_xExchFrontendTransportService.schema.mof diff --git a/DSCResources/MSFT_xExchImapSettings/MSFT_xExchImapSettings.psm1 b/source/DSCResources/MSFT_xExchImapSettings/MSFT_xExchImapSettings.psm1 similarity index 100% rename from DSCResources/MSFT_xExchImapSettings/MSFT_xExchImapSettings.psm1 rename to source/DSCResources/MSFT_xExchImapSettings/MSFT_xExchImapSettings.psm1 diff --git a/DSCResources/MSFT_xExchImapSettings/MSFT_xExchImapSettings.schema.mof b/source/DSCResources/MSFT_xExchImapSettings/MSFT_xExchImapSettings.schema.mof similarity index 100% rename from DSCResources/MSFT_xExchImapSettings/MSFT_xExchImapSettings.schema.mof rename to source/DSCResources/MSFT_xExchImapSettings/MSFT_xExchImapSettings.schema.mof diff --git a/DSCResources/MSFT_xExchInstall/MSFT_xExchInstall.psm1 b/source/DSCResources/MSFT_xExchInstall/MSFT_xExchInstall.psm1 similarity index 100% rename from DSCResources/MSFT_xExchInstall/MSFT_xExchInstall.psm1 rename to source/DSCResources/MSFT_xExchInstall/MSFT_xExchInstall.psm1 diff --git a/DSCResources/MSFT_xExchInstall/MSFT_xExchInstall.schema.mof b/source/DSCResources/MSFT_xExchInstall/MSFT_xExchInstall.schema.mof similarity index 100% rename from DSCResources/MSFT_xExchInstall/MSFT_xExchInstall.schema.mof rename to source/DSCResources/MSFT_xExchInstall/MSFT_xExchInstall.schema.mof diff --git a/DSCResources/MSFT_xExchJetstress/MSFT_xExchJetstress.psm1 b/source/DSCResources/MSFT_xExchJetstress/MSFT_xExchJetstress.psm1 similarity index 100% rename from DSCResources/MSFT_xExchJetstress/MSFT_xExchJetstress.psm1 rename to source/DSCResources/MSFT_xExchJetstress/MSFT_xExchJetstress.psm1 diff --git a/DSCResources/MSFT_xExchJetstress/MSFT_xExchJetstress.schema.mof b/source/DSCResources/MSFT_xExchJetstress/MSFT_xExchJetstress.schema.mof similarity index 100% rename from DSCResources/MSFT_xExchJetstress/MSFT_xExchJetstress.schema.mof rename to source/DSCResources/MSFT_xExchJetstress/MSFT_xExchJetstress.schema.mof diff --git a/DSCResources/MSFT_xExchJetstressCleanup/MSFT_xExchJetstressCleanup.psm1 b/source/DSCResources/MSFT_xExchJetstressCleanup/MSFT_xExchJetstressCleanup.psm1 similarity index 99% rename from DSCResources/MSFT_xExchJetstressCleanup/MSFT_xExchJetstressCleanup.psm1 rename to source/DSCResources/MSFT_xExchJetstressCleanup/MSFT_xExchJetstressCleanup.psm1 index ad6a86da..c38392d1 100644 --- a/DSCResources/MSFT_xExchJetstressCleanup/MSFT_xExchJetstressCleanup.psm1 +++ b/source/DSCResources/MSFT_xExchJetstressCleanup/MSFT_xExchJetstressCleanup.psm1 @@ -1,4 +1,4 @@ -Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Modules\xExchangeDiskPart.psm1" -Force +Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Modules\xExchangeDiskPart\xExchangeDiskPart.psd1" -Force function Get-TargetResource { @@ -107,7 +107,7 @@ function Set-TargetResource # Now delete the specified directories # Variable Only used if $DeleteAssociatedMountPoints is $true - [Hashtable] $ParentFoldersToRemove = @{} + [Hashtable] $ParentFoldersToRemove = @{ } foreach ($path in $FoldersToRemove) { diff --git a/DSCResources/MSFT_xExchJetstressCleanup/MSFT_xExchJetstressCleanup.schema.mof b/source/DSCResources/MSFT_xExchJetstressCleanup/MSFT_xExchJetstressCleanup.schema.mof similarity index 100% rename from DSCResources/MSFT_xExchJetstressCleanup/MSFT_xExchJetstressCleanup.schema.mof rename to source/DSCResources/MSFT_xExchJetstressCleanup/MSFT_xExchJetstressCleanup.schema.mof diff --git a/DSCResources/MSFT_xExchMailboxDatabase/MSFT_xExchMailboxDatabase.psm1 b/source/DSCResources/MSFT_xExchMailboxDatabase/MSFT_xExchMailboxDatabase.psm1 similarity index 100% rename from DSCResources/MSFT_xExchMailboxDatabase/MSFT_xExchMailboxDatabase.psm1 rename to source/DSCResources/MSFT_xExchMailboxDatabase/MSFT_xExchMailboxDatabase.psm1 diff --git a/DSCResources/MSFT_xExchMailboxDatabase/MSFT_xExchMailboxDatabase.schema.mof b/source/DSCResources/MSFT_xExchMailboxDatabase/MSFT_xExchMailboxDatabase.schema.mof similarity index 100% rename from DSCResources/MSFT_xExchMailboxDatabase/MSFT_xExchMailboxDatabase.schema.mof rename to source/DSCResources/MSFT_xExchMailboxDatabase/MSFT_xExchMailboxDatabase.schema.mof diff --git a/DSCResources/MSFT_xExchMailboxDatabaseCopy/MSFT_xExchMailboxDatabaseCopy.psm1 b/source/DSCResources/MSFT_xExchMailboxDatabaseCopy/MSFT_xExchMailboxDatabaseCopy.psm1 similarity index 100% rename from DSCResources/MSFT_xExchMailboxDatabaseCopy/MSFT_xExchMailboxDatabaseCopy.psm1 rename to source/DSCResources/MSFT_xExchMailboxDatabaseCopy/MSFT_xExchMailboxDatabaseCopy.psm1 diff --git a/DSCResources/MSFT_xExchMailboxDatabaseCopy/MSFT_xExchMailboxDatabaseCopy.schema.mof b/source/DSCResources/MSFT_xExchMailboxDatabaseCopy/MSFT_xExchMailboxDatabaseCopy.schema.mof similarity index 100% rename from DSCResources/MSFT_xExchMailboxDatabaseCopy/MSFT_xExchMailboxDatabaseCopy.schema.mof rename to source/DSCResources/MSFT_xExchMailboxDatabaseCopy/MSFT_xExchMailboxDatabaseCopy.schema.mof diff --git a/DSCResources/MSFT_xExchMailboxServer/MSFT_xExchMailboxServer.psm1 b/source/DSCResources/MSFT_xExchMailboxServer/MSFT_xExchMailboxServer.psm1 similarity index 100% rename from DSCResources/MSFT_xExchMailboxServer/MSFT_xExchMailboxServer.psm1 rename to source/DSCResources/MSFT_xExchMailboxServer/MSFT_xExchMailboxServer.psm1 diff --git a/DSCResources/MSFT_xExchMailboxServer/MSFT_xExchMailboxServer.schema.mof b/source/DSCResources/MSFT_xExchMailboxServer/MSFT_xExchMailboxServer.schema.mof similarity index 100% rename from DSCResources/MSFT_xExchMailboxServer/MSFT_xExchMailboxServer.schema.mof rename to source/DSCResources/MSFT_xExchMailboxServer/MSFT_xExchMailboxServer.schema.mof diff --git a/DSCResources/MSFT_xExchMailboxTransportService/MSFT_xExchMailboxTransportService.psm1 b/source/DSCResources/MSFT_xExchMailboxTransportService/MSFT_xExchMailboxTransportService.psm1 similarity index 100% rename from DSCResources/MSFT_xExchMailboxTransportService/MSFT_xExchMailboxTransportService.psm1 rename to source/DSCResources/MSFT_xExchMailboxTransportService/MSFT_xExchMailboxTransportService.psm1 diff --git a/DSCResources/MSFT_xExchMailboxTransportService/MSFT_xExchMailboxTransportService.schema.mof b/source/DSCResources/MSFT_xExchMailboxTransportService/MSFT_xExchMailboxTransportService.schema.mof similarity index 100% rename from DSCResources/MSFT_xExchMailboxTransportService/MSFT_xExchMailboxTransportService.schema.mof rename to source/DSCResources/MSFT_xExchMailboxTransportService/MSFT_xExchMailboxTransportService.schema.mof diff --git a/DSCResources/MSFT_xExchMaintenanceMode/MSFT_xExchMaintenanceMode.psm1 b/source/DSCResources/MSFT_xExchMaintenanceMode/MSFT_xExchMaintenanceMode.psm1 similarity index 100% rename from DSCResources/MSFT_xExchMaintenanceMode/MSFT_xExchMaintenanceMode.psm1 rename to source/DSCResources/MSFT_xExchMaintenanceMode/MSFT_xExchMaintenanceMode.psm1 diff --git a/DSCResources/MSFT_xExchMaintenanceMode/MSFT_xExchMaintenanceMode.schema.mof b/source/DSCResources/MSFT_xExchMaintenanceMode/MSFT_xExchMaintenanceMode.schema.mof similarity index 100% rename from DSCResources/MSFT_xExchMaintenanceMode/MSFT_xExchMaintenanceMode.schema.mof rename to source/DSCResources/MSFT_xExchMaintenanceMode/MSFT_xExchMaintenanceMode.schema.mof diff --git a/DSCResources/MSFT_xExchMaintenanceMode/TransportMaintenance.psm1 b/source/DSCResources/MSFT_xExchMaintenanceMode/TransportMaintenance.psm1 similarity index 100% rename from DSCResources/MSFT_xExchMaintenanceMode/TransportMaintenance.psm1 rename to source/DSCResources/MSFT_xExchMaintenanceMode/TransportMaintenance.psm1 diff --git a/DSCResources/MSFT_xExchMapiVirtualDirectory/MSFT_xExchMapiVirtualDirectory.psm1 b/source/DSCResources/MSFT_xExchMapiVirtualDirectory/MSFT_xExchMapiVirtualDirectory.psm1 similarity index 100% rename from DSCResources/MSFT_xExchMapiVirtualDirectory/MSFT_xExchMapiVirtualDirectory.psm1 rename to source/DSCResources/MSFT_xExchMapiVirtualDirectory/MSFT_xExchMapiVirtualDirectory.psm1 diff --git a/DSCResources/MSFT_xExchMapiVirtualDirectory/MSFT_xExchMapiVirtualDirectory.schema.mof b/source/DSCResources/MSFT_xExchMapiVirtualDirectory/MSFT_xExchMapiVirtualDirectory.schema.mof similarity index 100% rename from DSCResources/MSFT_xExchMapiVirtualDirectory/MSFT_xExchMapiVirtualDirectory.schema.mof rename to source/DSCResources/MSFT_xExchMapiVirtualDirectory/MSFT_xExchMapiVirtualDirectory.schema.mof diff --git a/DSCResources/MSFT_xExchOabVirtualDirectory/MSFT_xExchOabVirtualDirectory.psm1 b/source/DSCResources/MSFT_xExchOabVirtualDirectory/MSFT_xExchOabVirtualDirectory.psm1 similarity index 100% rename from DSCResources/MSFT_xExchOabVirtualDirectory/MSFT_xExchOabVirtualDirectory.psm1 rename to source/DSCResources/MSFT_xExchOabVirtualDirectory/MSFT_xExchOabVirtualDirectory.psm1 diff --git a/DSCResources/MSFT_xExchOabVirtualDirectory/MSFT_xExchOabVirtualDirectory.schema.mof b/source/DSCResources/MSFT_xExchOabVirtualDirectory/MSFT_xExchOabVirtualDirectory.schema.mof similarity index 100% rename from DSCResources/MSFT_xExchOabVirtualDirectory/MSFT_xExchOabVirtualDirectory.schema.mof rename to source/DSCResources/MSFT_xExchOabVirtualDirectory/MSFT_xExchOabVirtualDirectory.schema.mof diff --git a/DSCResources/MSFT_xExchOutlookAnywhere/MSFT_xExchOutlookAnywhere.psm1 b/source/DSCResources/MSFT_xExchOutlookAnywhere/MSFT_xExchOutlookAnywhere.psm1 similarity index 100% rename from DSCResources/MSFT_xExchOutlookAnywhere/MSFT_xExchOutlookAnywhere.psm1 rename to source/DSCResources/MSFT_xExchOutlookAnywhere/MSFT_xExchOutlookAnywhere.psm1 diff --git a/DSCResources/MSFT_xExchOutlookAnywhere/MSFT_xExchOutlookAnywhere.schema.mof b/source/DSCResources/MSFT_xExchOutlookAnywhere/MSFT_xExchOutlookAnywhere.schema.mof similarity index 100% rename from DSCResources/MSFT_xExchOutlookAnywhere/MSFT_xExchOutlookAnywhere.schema.mof rename to source/DSCResources/MSFT_xExchOutlookAnywhere/MSFT_xExchOutlookAnywhere.schema.mof diff --git a/DSCResources/MSFT_xExchOwaVirtualDirectory/MSFT_xExchOwaVirtualDirectory.psm1 b/source/DSCResources/MSFT_xExchOwaVirtualDirectory/MSFT_xExchOwaVirtualDirectory.psm1 similarity index 100% rename from DSCResources/MSFT_xExchOwaVirtualDirectory/MSFT_xExchOwaVirtualDirectory.psm1 rename to source/DSCResources/MSFT_xExchOwaVirtualDirectory/MSFT_xExchOwaVirtualDirectory.psm1 diff --git a/DSCResources/MSFT_xExchOwaVirtualDirectory/MSFT_xExchOwaVirtualDirectory.schema.mof b/source/DSCResources/MSFT_xExchOwaVirtualDirectory/MSFT_xExchOwaVirtualDirectory.schema.mof similarity index 100% rename from DSCResources/MSFT_xExchOwaVirtualDirectory/MSFT_xExchOwaVirtualDirectory.schema.mof rename to source/DSCResources/MSFT_xExchOwaVirtualDirectory/MSFT_xExchOwaVirtualDirectory.schema.mof diff --git a/DSCResources/MSFT_xExchPopSettings/MSFT_xExchPopSettings.psm1 b/source/DSCResources/MSFT_xExchPopSettings/MSFT_xExchPopSettings.psm1 similarity index 100% rename from DSCResources/MSFT_xExchPopSettings/MSFT_xExchPopSettings.psm1 rename to source/DSCResources/MSFT_xExchPopSettings/MSFT_xExchPopSettings.psm1 diff --git a/DSCResources/MSFT_xExchPopSettings/MSFT_xExchPopSettings.schema.mof b/source/DSCResources/MSFT_xExchPopSettings/MSFT_xExchPopSettings.schema.mof similarity index 100% rename from DSCResources/MSFT_xExchPopSettings/MSFT_xExchPopSettings.schema.mof rename to source/DSCResources/MSFT_xExchPopSettings/MSFT_xExchPopSettings.schema.mof diff --git a/DSCResources/MSFT_xExchPowershellVirtualDirectory/MSFT_xExchPowerShellVirtualDirectory.psm1 b/source/DSCResources/MSFT_xExchPowershellVirtualDirectory/MSFT_xExchPowerShellVirtualDirectory.psm1 similarity index 100% rename from DSCResources/MSFT_xExchPowershellVirtualDirectory/MSFT_xExchPowerShellVirtualDirectory.psm1 rename to source/DSCResources/MSFT_xExchPowershellVirtualDirectory/MSFT_xExchPowerShellVirtualDirectory.psm1 diff --git a/DSCResources/MSFT_xExchPowershellVirtualDirectory/MSFT_xExchPowerShellVirtualDirectory.schema.mof b/source/DSCResources/MSFT_xExchPowershellVirtualDirectory/MSFT_xExchPowerShellVirtualDirectory.schema.mof similarity index 100% rename from DSCResources/MSFT_xExchPowershellVirtualDirectory/MSFT_xExchPowerShellVirtualDirectory.schema.mof rename to source/DSCResources/MSFT_xExchPowershellVirtualDirectory/MSFT_xExchPowerShellVirtualDirectory.schema.mof diff --git a/DSCResources/MSFT_xExchReceiveConnector/MSFT_xExchReceiveConnector.psm1 b/source/DSCResources/MSFT_xExchReceiveConnector/MSFT_xExchReceiveConnector.psm1 similarity index 100% rename from DSCResources/MSFT_xExchReceiveConnector/MSFT_xExchReceiveConnector.psm1 rename to source/DSCResources/MSFT_xExchReceiveConnector/MSFT_xExchReceiveConnector.psm1 diff --git a/DSCResources/MSFT_xExchReceiveConnector/MSFT_xExchReceiveConnector.schema.mof b/source/DSCResources/MSFT_xExchReceiveConnector/MSFT_xExchReceiveConnector.schema.mof similarity index 100% rename from DSCResources/MSFT_xExchReceiveConnector/MSFT_xExchReceiveConnector.schema.mof rename to source/DSCResources/MSFT_xExchReceiveConnector/MSFT_xExchReceiveConnector.schema.mof diff --git a/DSCResources/MSFT_xExchRemoteDomain/MSFT_xExchRemoteDomain.psm1 b/source/DSCResources/MSFT_xExchRemoteDomain/MSFT_xExchRemoteDomain.psm1 similarity index 100% rename from DSCResources/MSFT_xExchRemoteDomain/MSFT_xExchRemoteDomain.psm1 rename to source/DSCResources/MSFT_xExchRemoteDomain/MSFT_xExchRemoteDomain.psm1 diff --git a/DSCResources/MSFT_xExchRemoteDomain/MSFT_xExchRemoteDomain.schema.mof b/source/DSCResources/MSFT_xExchRemoteDomain/MSFT_xExchRemoteDomain.schema.mof similarity index 100% rename from DSCResources/MSFT_xExchRemoteDomain/MSFT_xExchRemoteDomain.schema.mof rename to source/DSCResources/MSFT_xExchRemoteDomain/MSFT_xExchRemoteDomain.schema.mof diff --git a/DSCResources/MSFT_xExchSendConnector/MSFT_xExchSendConnector.psm1 b/source/DSCResources/MSFT_xExchSendConnector/MSFT_xExchSendConnector.psm1 similarity index 100% rename from DSCResources/MSFT_xExchSendConnector/MSFT_xExchSendConnector.psm1 rename to source/DSCResources/MSFT_xExchSendConnector/MSFT_xExchSendConnector.psm1 diff --git a/DSCResources/MSFT_xExchSendConnector/MSFT_xExchSendConnector.schema.mof b/source/DSCResources/MSFT_xExchSendConnector/MSFT_xExchSendConnector.schema.mof similarity index 100% rename from DSCResources/MSFT_xExchSendConnector/MSFT_xExchSendConnector.schema.mof rename to source/DSCResources/MSFT_xExchSendConnector/MSFT_xExchSendConnector.schema.mof diff --git a/DSCResources/MSFT_xExchTransportService/MSFT_xExchTransportService.psm1 b/source/DSCResources/MSFT_xExchTransportService/MSFT_xExchTransportService.psm1 similarity index 100% rename from DSCResources/MSFT_xExchTransportService/MSFT_xExchTransportService.psm1 rename to source/DSCResources/MSFT_xExchTransportService/MSFT_xExchTransportService.psm1 diff --git a/DSCResources/MSFT_xExchTransportService/MSFT_xExchTransportService.schema.mof b/source/DSCResources/MSFT_xExchTransportService/MSFT_xExchTransportService.schema.mof similarity index 100% rename from DSCResources/MSFT_xExchTransportService/MSFT_xExchTransportService.schema.mof rename to source/DSCResources/MSFT_xExchTransportService/MSFT_xExchTransportService.schema.mof diff --git a/DSCResources/MSFT_xExchUMCallRouterSettings/MSFT_xExchUMCallRouterSettings.psm1 b/source/DSCResources/MSFT_xExchUMCallRouterSettings/MSFT_xExchUMCallRouterSettings.psm1 similarity index 100% rename from DSCResources/MSFT_xExchUMCallRouterSettings/MSFT_xExchUMCallRouterSettings.psm1 rename to source/DSCResources/MSFT_xExchUMCallRouterSettings/MSFT_xExchUMCallRouterSettings.psm1 diff --git a/DSCResources/MSFT_xExchUMCallRouterSettings/MSFT_xExchUMCallRouterSettings.schema.mof b/source/DSCResources/MSFT_xExchUMCallRouterSettings/MSFT_xExchUMCallRouterSettings.schema.mof similarity index 100% rename from DSCResources/MSFT_xExchUMCallRouterSettings/MSFT_xExchUMCallRouterSettings.schema.mof rename to source/DSCResources/MSFT_xExchUMCallRouterSettings/MSFT_xExchUMCallRouterSettings.schema.mof diff --git a/DSCResources/MSFT_xExchUMService/MSFT_xExchUMService.psm1 b/source/DSCResources/MSFT_xExchUMService/MSFT_xExchUMService.psm1 similarity index 100% rename from DSCResources/MSFT_xExchUMService/MSFT_xExchUMService.psm1 rename to source/DSCResources/MSFT_xExchUMService/MSFT_xExchUMService.psm1 diff --git a/DSCResources/MSFT_xExchUMService/MSFT_xExchUMService.schema.mof b/source/DSCResources/MSFT_xExchUMService/MSFT_xExchUMService.schema.mof similarity index 100% rename from DSCResources/MSFT_xExchUMService/MSFT_xExchUMService.schema.mof rename to source/DSCResources/MSFT_xExchUMService/MSFT_xExchUMService.schema.mof diff --git a/DSCResources/MSFT_xExchWaitForADPrep/MSFT_xExchWaitForADPrep.psm1 b/source/DSCResources/MSFT_xExchWaitForADPrep/MSFT_xExchWaitForADPrep.psm1 similarity index 100% rename from DSCResources/MSFT_xExchWaitForADPrep/MSFT_xExchWaitForADPrep.psm1 rename to source/DSCResources/MSFT_xExchWaitForADPrep/MSFT_xExchWaitForADPrep.psm1 diff --git a/DSCResources/MSFT_xExchWaitForADPrep/MSFT_xExchWaitForADPrep.schema.mof b/source/DSCResources/MSFT_xExchWaitForADPrep/MSFT_xExchWaitForADPrep.schema.mof similarity index 100% rename from DSCResources/MSFT_xExchWaitForADPrep/MSFT_xExchWaitForADPrep.schema.mof rename to source/DSCResources/MSFT_xExchWaitForADPrep/MSFT_xExchWaitForADPrep.schema.mof diff --git a/DSCResources/MSFT_xExchWaitForDAG/MSFT_xExchWaitForDAG.psm1 b/source/DSCResources/MSFT_xExchWaitForDAG/MSFT_xExchWaitForDAG.psm1 similarity index 100% rename from DSCResources/MSFT_xExchWaitForDAG/MSFT_xExchWaitForDAG.psm1 rename to source/DSCResources/MSFT_xExchWaitForDAG/MSFT_xExchWaitForDAG.psm1 diff --git a/DSCResources/MSFT_xExchWaitForDAG/MSFT_xExchWaitForDAG.schema.mof b/source/DSCResources/MSFT_xExchWaitForDAG/MSFT_xExchWaitForDAG.schema.mof similarity index 100% rename from DSCResources/MSFT_xExchWaitForDAG/MSFT_xExchWaitForDAG.schema.mof rename to source/DSCResources/MSFT_xExchWaitForDAG/MSFT_xExchWaitForDAG.schema.mof diff --git a/DSCResources/MSFT_xExchWaitForMailboxDatabase/MSFT_xExchWaitForMailboxDatabase.psm1 b/source/DSCResources/MSFT_xExchWaitForMailboxDatabase/MSFT_xExchWaitForMailboxDatabase.psm1 similarity index 100% rename from DSCResources/MSFT_xExchWaitForMailboxDatabase/MSFT_xExchWaitForMailboxDatabase.psm1 rename to source/DSCResources/MSFT_xExchWaitForMailboxDatabase/MSFT_xExchWaitForMailboxDatabase.psm1 diff --git a/DSCResources/MSFT_xExchWaitForMailboxDatabase/MSFT_xExchWaitForMailboxDatabase.schema.mof b/source/DSCResources/MSFT_xExchWaitForMailboxDatabase/MSFT_xExchWaitForMailboxDatabase.schema.mof similarity index 100% rename from DSCResources/MSFT_xExchWaitForMailboxDatabase/MSFT_xExchWaitForMailboxDatabase.schema.mof rename to source/DSCResources/MSFT_xExchWaitForMailboxDatabase/MSFT_xExchWaitForMailboxDatabase.schema.mof diff --git a/DSCResources/MSFT_xExchWebServicesVirtualDirectory/MSFT_xExchWebServicesVirtualDirectory.psm1 b/source/DSCResources/MSFT_xExchWebServicesVirtualDirectory/MSFT_xExchWebServicesVirtualDirectory.psm1 similarity index 100% rename from DSCResources/MSFT_xExchWebServicesVirtualDirectory/MSFT_xExchWebServicesVirtualDirectory.psm1 rename to source/DSCResources/MSFT_xExchWebServicesVirtualDirectory/MSFT_xExchWebServicesVirtualDirectory.psm1 diff --git a/DSCResources/MSFT_xExchWebServicesVirtualDirectory/MSFT_xExchWebServicesVirtualDirectory.schema.mof b/source/DSCResources/MSFT_xExchWebServicesVirtualDirectory/MSFT_xExchWebServicesVirtualDirectory.schema.mof similarity index 100% rename from DSCResources/MSFT_xExchWebServicesVirtualDirectory/MSFT_xExchWebServicesVirtualDirectory.schema.mof rename to source/DSCResources/MSFT_xExchWebServicesVirtualDirectory/MSFT_xExchWebServicesVirtualDirectory.schema.mof diff --git a/Examples/ConfigureAutoMountPoints-FromCalculator/CalculatorAndScripts/Servers.csv b/source/Examples/ConfigureAutoMountPoints-FromCalculator/CalculatorAndScripts/Servers.csv similarity index 100% rename from Examples/ConfigureAutoMountPoints-FromCalculator/CalculatorAndScripts/Servers.csv rename to source/Examples/ConfigureAutoMountPoints-FromCalculator/CalculatorAndScripts/Servers.csv diff --git a/Examples/ConfigureAutoMountPoints-FromCalculator/ConfigureAutoMountPoints-FromCalculator.ps1 b/source/Examples/ConfigureAutoMountPoints-FromCalculator/ConfigureAutoMountPoints-FromCalculator.ps1 similarity index 83% rename from Examples/ConfigureAutoMountPoints-FromCalculator/ConfigureAutoMountPoints-FromCalculator.ps1 rename to source/Examples/ConfigureAutoMountPoints-FromCalculator/ConfigureAutoMountPoints-FromCalculator.ps1 index 8f99ba3c..ba123730 100644 --- a/Examples/ConfigureAutoMountPoints-FromCalculator/ConfigureAutoMountPoints-FromCalculator.ps1 +++ b/source/Examples/ConfigureAutoMountPoints-FromCalculator/ConfigureAutoMountPoints-FromCalculator.ps1 @@ -27,8 +27,8 @@ $ConfigurationData = @{ } ); - DAG1 = @{ - DbNameReplacements = @{"-nn-" = "-01-"} + DAG1 = @{ + DbNameReplacements = @{"-nn-" = "-01-" } } } @@ -36,16 +36,16 @@ Configuration Example { Import-DscResource -Module xExchange - Import-Module -Name (Join-Path -Path (Split-Path -Parent (Split-Path -Parent $PSScriptRoot)) -ChildPath 'Modules\xExchangeCalculatorHelper.psm1') + Import-Module -Name (Join-Path -Path (Split-Path -Parent (Split-Path -Parent $PSScriptRoot)) -ChildPath 'Modules\xExchangeCalculatorHelper\xExchangeCalculatorHelper.psd1') Node $AllNodes.NodeName { $dagSettings = $ConfigurationData[$Node.DAGId] $dbMap = Get-DBMapFromServersCsv ` - -ServersCsvPath "$($PSScriptRoot)\CalculatorAndScripts\Servers.csv" ` - -ServerNameInCsv $Node.ServerNameInCsv ` - -DbNameReplacements $dagSettings.DbNameReplacements + -ServersCsvPath "$($PSScriptRoot)\CalculatorAndScripts\Servers.csv" ` + -ServerNameInCsv $Node.ServerNameInCsv ` + -DbNameReplacements $dagSettings.DbNameReplacements xExchAutoMountPoint AMP { diff --git a/Examples/ConfigureAutoMountPoints-Manual/ConfigureAutoMountPoints-Manual.ps1 b/source/Examples/ConfigureAutoMountPoints-Manual/ConfigureAutoMountPoints-Manual.ps1 similarity index 100% rename from Examples/ConfigureAutoMountPoints-Manual/ConfigureAutoMountPoints-Manual.ps1 rename to source/Examples/ConfigureAutoMountPoints-Manual/ConfigureAutoMountPoints-Manual.ps1 diff --git a/Examples/ConfigureDatabases-FromCalculator/CalculatorAndScripts/E2013Calcv7.6 - Example.xlsm b/source/Examples/ConfigureDatabases-FromCalculator/CalculatorAndScripts/E2013Calcv7.6 - Example.xlsm similarity index 100% rename from Examples/ConfigureDatabases-FromCalculator/CalculatorAndScripts/E2013Calcv7.6 - Example.xlsm rename to source/Examples/ConfigureDatabases-FromCalculator/CalculatorAndScripts/E2013Calcv7.6 - Example.xlsm diff --git a/Examples/ConfigureDatabases-FromCalculator/CalculatorAndScripts/MailboxDatabaseCopies.csv b/source/Examples/ConfigureDatabases-FromCalculator/CalculatorAndScripts/MailboxDatabaseCopies.csv similarity index 100% rename from Examples/ConfigureDatabases-FromCalculator/CalculatorAndScripts/MailboxDatabaseCopies.csv rename to source/Examples/ConfigureDatabases-FromCalculator/CalculatorAndScripts/MailboxDatabaseCopies.csv diff --git a/Examples/ConfigureDatabases-FromCalculator/CalculatorAndScripts/MailboxDatabases.csv b/source/Examples/ConfigureDatabases-FromCalculator/CalculatorAndScripts/MailboxDatabases.csv similarity index 100% rename from Examples/ConfigureDatabases-FromCalculator/CalculatorAndScripts/MailboxDatabases.csv rename to source/Examples/ConfigureDatabases-FromCalculator/CalculatorAndScripts/MailboxDatabases.csv diff --git a/Examples/ConfigureDatabases-FromCalculator/ConfigureDatabases-FromCalculator.ps1 b/source/Examples/ConfigureDatabases-FromCalculator/ConfigureDatabases-FromCalculator.ps1 similarity index 98% rename from Examples/ConfigureDatabases-FromCalculator/ConfigureDatabases-FromCalculator.ps1 rename to source/Examples/ConfigureDatabases-FromCalculator/ConfigureDatabases-FromCalculator.ps1 index cd627dd1..f634c58a 100644 --- a/Examples/ConfigureDatabases-FromCalculator/ConfigureDatabases-FromCalculator.ps1 +++ b/source/Examples/ConfigureDatabases-FromCalculator/ConfigureDatabases-FromCalculator.ps1 @@ -34,7 +34,7 @@ Configuration Example Import-DscResource -Module xExchange - Import-Module -Name (Join-Path -Path (Split-Path -Parent (Split-Path -Parent $PSScriptRoot)) -ChildPath 'Modules\xExchangeCalculatorHelper.psm1') + Import-Module -Name (Join-Path -Path (Split-Path -Parent (Split-Path -Parent $PSScriptRoot)) -ChildPath 'Modules\xExchangeCalculatorHelper\xExchangeCalculatorHelper.psd1') Node $AllNodes.NodeName { diff --git a/Examples/ConfigureDatabases-Manual/ConfigureDatabases-Manual.ps1 b/source/Examples/ConfigureDatabases-Manual/ConfigureDatabases-Manual.ps1 similarity index 100% rename from Examples/ConfigureDatabases-Manual/ConfigureDatabases-Manual.ps1 rename to source/Examples/ConfigureDatabases-Manual/ConfigureDatabases-Manual.ps1 diff --git a/Examples/ConfigureNamespaces/InternetFacingSite/InternetFacingSite.ps1 b/source/Examples/ConfigureNamespaces/InternetFacingSite/InternetFacingSite.ps1 similarity index 100% rename from Examples/ConfigureNamespaces/InternetFacingSite/InternetFacingSite.ps1 rename to source/Examples/ConfigureNamespaces/InternetFacingSite/InternetFacingSite.ps1 diff --git a/Examples/ConfigureNamespaces/RegionalNamespaces/RegionalNamespaces.ps1 b/source/Examples/ConfigureNamespaces/RegionalNamespaces/RegionalNamespaces.ps1 similarity index 100% rename from Examples/ConfigureNamespaces/RegionalNamespaces/RegionalNamespaces.ps1 rename to source/Examples/ConfigureNamespaces/RegionalNamespaces/RegionalNamespaces.ps1 diff --git a/Examples/ConfigureNamespaces/SingleNamespace/SingleNamespace.ps1 b/source/Examples/ConfigureNamespaces/SingleNamespace/SingleNamespace.ps1 similarity index 100% rename from Examples/ConfigureNamespaces/SingleNamespace/SingleNamespace.ps1 rename to source/Examples/ConfigureNamespaces/SingleNamespace/SingleNamespace.ps1 diff --git a/Examples/ConfigureVirtualDirectories/ConfigureVirtualDirectories.ps1 b/source/Examples/ConfigureVirtualDirectories/ConfigureVirtualDirectories.ps1 similarity index 100% rename from Examples/ConfigureVirtualDirectories/ConfigureVirtualDirectories.ps1 rename to source/Examples/ConfigureVirtualDirectories/ConfigureVirtualDirectories.ps1 diff --git a/Examples/CreateAndConfigureDAG/CreateAndConfigureDAG.ps1 b/source/Examples/CreateAndConfigureDAG/CreateAndConfigureDAG.ps1 similarity index 100% rename from Examples/CreateAndConfigureDAG/CreateAndConfigureDAG.ps1 rename to source/Examples/CreateAndConfigureDAG/CreateAndConfigureDAG.ps1 diff --git a/Examples/EndToEndExample/1-ConfigureLCMForDeployment.ps1 b/source/Examples/EndToEndExample/1-ConfigureLCMForDeployment.ps1 similarity index 100% rename from Examples/EndToEndExample/1-ConfigureLCMForDeployment.ps1 rename to source/Examples/EndToEndExample/1-ConfigureLCMForDeployment.ps1 diff --git a/Examples/EndToEndExample/10-OngoingConfiguration.ps1 b/source/Examples/EndToEndExample/10-OngoingConfiguration.ps1 similarity index 99% rename from Examples/EndToEndExample/10-OngoingConfiguration.ps1 rename to source/Examples/EndToEndExample/10-OngoingConfiguration.ps1 index 80a7e719..5a2e4bd5 100644 --- a/Examples/EndToEndExample/10-OngoingConfiguration.ps1 +++ b/source/Examples/EndToEndExample/10-OngoingConfiguration.ps1 @@ -137,7 +137,7 @@ Configuration Example Import-DscResource -Module xExchange Import-DscResource -Module xWebAdministration - Import-Module -Name (Join-Path -Path (Split-Path -Parent (Split-Path -Parent $PSScriptRoot)) -ChildPath 'Modules\xExchangeCalculatorHelper.psm1') + Import-Module -Name (Join-Path -Path (Split-Path -Parent (Split-Path -Parent $PSScriptRoot)) -ChildPath 'Modules\xExchangeCalculatorHelper\xExchangeCalculatorHelper.psd1') Node $AllNodes.NodeName { diff --git a/Examples/EndToEndExample/2-InstallAndRunJetstress.ps1 b/source/Examples/EndToEndExample/2-InstallAndRunJetstress.ps1 similarity index 100% rename from Examples/EndToEndExample/2-InstallAndRunJetstress.ps1 rename to source/Examples/EndToEndExample/2-InstallAndRunJetstress.ps1 diff --git a/Examples/EndToEndExample/3-CleanupJetstress.ps1 b/source/Examples/EndToEndExample/3-CleanupJetstress.ps1 similarity index 100% rename from Examples/EndToEndExample/3-CleanupJetstress.ps1 rename to source/Examples/EndToEndExample/3-CleanupJetstress.ps1 diff --git a/Examples/EndToEndExample/4-InstallExchange.ps1 b/source/Examples/EndToEndExample/4-InstallExchange.ps1 similarity index 100% rename from Examples/EndToEndExample/4-InstallExchange.ps1 rename to source/Examples/EndToEndExample/4-InstallExchange.ps1 diff --git a/Examples/EndToEndExample/5-ConfigureServerSettings.ps1 b/source/Examples/EndToEndExample/5-ConfigureServerSettings.ps1 similarity index 100% rename from Examples/EndToEndExample/5-ConfigureServerSettings.ps1 rename to source/Examples/EndToEndExample/5-ConfigureServerSettings.ps1 diff --git a/Examples/EndToEndExample/6-ConfigureDAG.ps1 b/source/Examples/EndToEndExample/6-ConfigureDAG.ps1 similarity index 100% rename from Examples/EndToEndExample/6-ConfigureDAG.ps1 rename to source/Examples/EndToEndExample/6-ConfigureDAG.ps1 diff --git a/Examples/EndToEndExample/7-ConfigurePrimaryDatabases.ps1 b/source/Examples/EndToEndExample/7-ConfigurePrimaryDatabases.ps1 similarity index 78% rename from Examples/EndToEndExample/7-ConfigurePrimaryDatabases.ps1 rename to source/Examples/EndToEndExample/7-ConfigurePrimaryDatabases.ps1 index 4a58b8c8..7e05d83c 100644 --- a/Examples/EndToEndExample/7-ConfigurePrimaryDatabases.ps1 +++ b/source/Examples/EndToEndExample/7-ConfigurePrimaryDatabases.ps1 @@ -7,7 +7,7 @@ $ConfigurationData = @{ AllNodes = @( @{ #region Common Settings for All Nodes - NodeName = '*' + NodeName = '*' <# The location of the exported public certificate which will be used to encrypt @@ -16,7 +16,7 @@ $ConfigurationData = @{ #> # Thumbprint of the certificate being used for decrypting credentials - Thumbprint = '39bef4b2e82599233154465323ebf96a12b60673' + Thumbprint = '39bef4b2e82599233154465323ebf96a12b60673' # The paths to the CSV files generated by the Server Role Requirements Calculator ServersCsvPath = "$($PSScriptRoot)\Calculators\Lab\Servers.csv" @@ -67,14 +67,14 @@ $ConfigurationData = @{ ); #region DAG Settings - DAG01 = @( + DAG01 = @( @{ DAGName = 'DAG01' AutoDagTotalNumberOfServers = 12 AutoDagDatabaseCopiesPerVolume = 4 DatabaseAvailabilityGroupIPAddresses = '192.168.1.31', '192.168.2.31' WitnessServer = 'e14-1.contoso.local' - DbNameReplacements = @{"nn" = "01"} + DbNameReplacements = @{"nn" = "01" } Thumbprint = "0079D0F68F44C7DA5252B4779F872F46DFAF0CBC" } ) @@ -82,7 +82,7 @@ $ConfigurationData = @{ #region CAS Settings # Settings that will apply to all CAS - AllCAS = @( + AllCAS = @( @{ ExternalNamespace = 'mail.contoso.local' } @@ -122,22 +122,22 @@ Configuration Example Import-DscResource -Module xExchange - Import-Module -Name (Join-Path -Path (Split-Path -Parent (Split-Path -Parent $PSScriptRoot)) -ChildPath 'Modules\xExchangeCalculatorHelper.psm1') + Import-Module -Name (Join-Path -Path (Split-Path -Parent (Split-Path -Parent $PSScriptRoot)) -ChildPath 'Modules\xExchangeCalculatorHelper\xExchangeCalculatorHelper.psd1') # This section will handle configuring all non-DAG specific settings, including CAS and MBX settings. Node $AllNodes.NodeName { - $dagSettings = $ConfigurationData[$Node.DAGId] # Get DAG settings for this node + $dagSettings = $ConfigurationData[$Node.DAGId] # Get DAG settings for this node $casSettingsPerSite = $ConfigurationData[$Node.CASId] # Get site specific CAS settings for this node ###Mailbox Server settings### $dbMap = Get-DBMapFromServersCsv -ServersCsvPath $Node.ServersCsvPath ` - -ServerNameInCsv $Node.ServerNameInCsv ` - -DbNameReplacements $dagSettings.DbNameReplacements + -ServerNameInCsv $Node.ServerNameInCsv ` + -DbNameReplacements $dagSettings.DbNameReplacements $primaryDbList = Get-DBListFromMailboxDatabasesCsv -MailboxDatabasesCsvPath $Node.MailboxDatabasesCsvPath ` - -ServerNameInCsv $Node.ServerNameInCsv ` - -DbNameReplacements $dagSettings.DbNameReplacements + -ServerNameInCsv $Node.ServerNameInCsv ` + -DbNameReplacements $dagSettings.DbNameReplacements # Create all mount points on the server xExchAutoMountPoint AMP @@ -158,16 +158,16 @@ Configuration Example xExchMailboxDatabase $resourceId { - Name = $DB.Name - Credential = $ExchangeAdminCredential - EdbFilePath = $DB.DBFilePath - LogFolderPath = $DB.LogFolderPath - Server = $Node.NodeName - CircularLoggingEnabled = $true - DatabaseCopyCount = $dagSettings.AutoDagDatabaseCopiesPerVolume - OfflineAddressBook = $casSettingsPerSite.DefaultOAB - SkipInitialDatabaseMount = $true - DependsOn = '[xExchAutoMountPoint]AMP' # Can't create databases until the mount points exist + Name = $DB.Name + Credential = $ExchangeAdminCredential + EdbFilePath = $DB.DBFilePath + LogFolderPath = $DB.LogFolderPath + Server = $Node.NodeName + CircularLoggingEnabled = $true + DatabaseCopyCount = $dagSettings.AutoDagDatabaseCopiesPerVolume + OfflineAddressBook = $casSettingsPerSite.DefaultOAB + SkipInitialDatabaseMount = $true + DependsOn = '[xExchAutoMountPoint]AMP' # Can't create databases until the mount points exist } } } diff --git a/Examples/EndToEndExample/8-ConfigureDatabaseCopies.ps1 b/source/Examples/EndToEndExample/8-ConfigureDatabaseCopies.ps1 similarity index 84% rename from Examples/EndToEndExample/8-ConfigureDatabaseCopies.ps1 rename to source/Examples/EndToEndExample/8-ConfigureDatabaseCopies.ps1 index 93a23744..cd35df82 100644 --- a/Examples/EndToEndExample/8-ConfigureDatabaseCopies.ps1 +++ b/source/Examples/EndToEndExample/8-ConfigureDatabaseCopies.ps1 @@ -7,7 +7,7 @@ $ConfigurationData = @{ AllNodes = @( @{ #region Common Settings for All Nodes - NodeName = '*' + NodeName = '*' <# The location of the exported public certificate which will be used to encrypt @@ -16,7 +16,7 @@ $ConfigurationData = @{ #> # Thumbprint of the certificate being used for decrypting credentials - Thumbprint = '39bef4b2e82599233154465323ebf96a12b60673' + Thumbprint = '39bef4b2e82599233154465323ebf96a12b60673' # The paths to the CSV files generated by the Server Role Requirements Calculator ServersCsvPath = "$($PSScriptRoot)\Calculators\Lab\Servers.csv" @@ -67,14 +67,14 @@ $ConfigurationData = @{ ); #region DAG Settings - DAG01 = @( + DAG01 = @( @{ DAGName = 'DAG01' AutoDagTotalNumberOfServers = 12 AutoDagDatabaseCopiesPerVolume = 4 DatabaseAvailabilityGroupIPAddresses = '192.168.1.31', '192.168.2.31' WitnessServer = 'e14-1.contoso.local' - DbNameReplacements = @{"nn" = "01"} + DbNameReplacements = @{"nn" = "01" } Thumbprint = "0079D0F68F44C7DA5252B4779F872F46DFAF0CBC" } ) @@ -82,7 +82,7 @@ $ConfigurationData = @{ #region CAS Settings # Settings that will apply to all CAS - AllCAS = @( + AllCAS = @( @{ ExternalNamespace = 'mail.contoso.local' } @@ -122,7 +122,7 @@ Configuration Example Import-DscResource -Module xExchange - Import-Module -Name (Join-Path -Path (Split-Path -Parent (Split-Path -Parent $PSScriptRoot)) -ChildPath 'Modules\xExchangeCalculatorHelper.psm1') + Import-Module -Name (Join-Path -Path (Split-Path -Parent (Split-Path -Parent $PSScriptRoot)) -ChildPath 'Modules\xExchangeCalculatorHelper\xExchangeCalculatorHelper.psd1') # This section will handle configuring all non-DAG specific settings, including CAS and MBX settings. Node $AllNodes.NodeName @@ -131,8 +131,8 @@ Configuration Example ###Mailbox Server settings### $copyDbList = Get-DBListFromMailboxDatabaseCopiesCsv -MailboxDatabaseCopiesCsvPath $Node.MailboxDatabaseCopiesCsvPath ` - -ServerNameInCsv $Node.ServerNameInCsv ` - -DbNameReplacements $dagSettings.DbNameReplacements + -ServerNameInCsv $Node.ServerNameInCsv ` + -DbNameReplacements $dagSettings.DbNameReplacements # Create the copies foreach ($DB in $copyDbList) @@ -152,14 +152,14 @@ Configuration Example xExchMailboxDatabaseCopy $copyResourceId { - Identity = $DB.Name - Credential = $ExchangeAdminCredential - MailboxServer = $Node.NodeName - ActivationPreference = $DB.ActivationPreference - ReplayLagTime = $DB.ReplayLagTime - AllowServiceRestart = $false - SeedingPostponed = $true - DependsOn = "[xExchWaitForMailboxDatabase]$($waitResourceId)" + Identity = $DB.Name + Credential = $ExchangeAdminCredential + MailboxServer = $Node.NodeName + ActivationPreference = $DB.ActivationPreference + ReplayLagTime = $DB.ReplayLagTime + AllowServiceRestart = $false + SeedingPostponed = $true + DependsOn = "[xExchWaitForMailboxDatabase]$($waitResourceId)" } } } diff --git a/Examples/EndToEndExample/9-ConfigureLCMForContinuousChecking.ps1 b/source/Examples/EndToEndExample/9-ConfigureLCMForContinuousChecking.ps1 similarity index 100% rename from Examples/EndToEndExample/9-ConfigureLCMForContinuousChecking.ps1 rename to source/Examples/EndToEndExample/9-ConfigureLCMForContinuousChecking.ps1 diff --git a/Examples/EndToEndExample/Calculators/Lab/E2013Calcv6.6 - Lab.xlsm b/source/Examples/EndToEndExample/Calculators/Lab/E2013Calcv6.6 - Lab.xlsm similarity index 100% rename from Examples/EndToEndExample/Calculators/Lab/E2013Calcv6.6 - Lab.xlsm rename to source/Examples/EndToEndExample/Calculators/Lab/E2013Calcv6.6 - Lab.xlsm diff --git a/Examples/EndToEndExample/Calculators/Lab/MailboxDatabaseCopies.csv b/source/Examples/EndToEndExample/Calculators/Lab/MailboxDatabaseCopies.csv similarity index 100% rename from Examples/EndToEndExample/Calculators/Lab/MailboxDatabaseCopies.csv rename to source/Examples/EndToEndExample/Calculators/Lab/MailboxDatabaseCopies.csv diff --git a/Examples/EndToEndExample/Calculators/Lab/MailboxDatabases.csv b/source/Examples/EndToEndExample/Calculators/Lab/MailboxDatabases.csv similarity index 100% rename from Examples/EndToEndExample/Calculators/Lab/MailboxDatabases.csv rename to source/Examples/EndToEndExample/Calculators/Lab/MailboxDatabases.csv diff --git a/Examples/EndToEndExample/Calculators/Lab/Servers.csv b/source/Examples/EndToEndExample/Calculators/Lab/Servers.csv similarity index 100% rename from Examples/EndToEndExample/Calculators/Lab/Servers.csv rename to source/Examples/EndToEndExample/Calculators/Lab/Servers.csv diff --git a/Examples/EndToEndExample/Calculators/Prod/E2013Calcv6.6 - Prod.xlsm b/source/Examples/EndToEndExample/Calculators/Prod/E2013Calcv6.6 - Prod.xlsm similarity index 100% rename from Examples/EndToEndExample/Calculators/Prod/E2013Calcv6.6 - Prod.xlsm rename to source/Examples/EndToEndExample/Calculators/Prod/E2013Calcv6.6 - Prod.xlsm diff --git a/Examples/EndToEndExample/Calculators/Prod/MailboxDatabaseCopies.csv b/source/Examples/EndToEndExample/Calculators/Prod/MailboxDatabaseCopies.csv similarity index 100% rename from Examples/EndToEndExample/Calculators/Prod/MailboxDatabaseCopies.csv rename to source/Examples/EndToEndExample/Calculators/Prod/MailboxDatabaseCopies.csv diff --git a/Examples/EndToEndExample/Calculators/Prod/MailboxDatabases.csv b/source/Examples/EndToEndExample/Calculators/Prod/MailboxDatabases.csv similarity index 100% rename from Examples/EndToEndExample/Calculators/Prod/MailboxDatabases.csv rename to source/Examples/EndToEndExample/Calculators/Prod/MailboxDatabases.csv diff --git a/Examples/EndToEndExample/Calculators/Prod/Servers.csv b/source/Examples/EndToEndExample/Calculators/Prod/Servers.csv similarity index 100% rename from Examples/EndToEndExample/Calculators/Prod/Servers.csv rename to source/Examples/EndToEndExample/Calculators/Prod/Servers.csv diff --git a/Examples/InstallExchange/InstallExchange.ps1 b/source/Examples/InstallExchange/InstallExchange.ps1 similarity index 100% rename from Examples/InstallExchange/InstallExchange.ps1 rename to source/Examples/InstallExchange/InstallExchange.ps1 diff --git a/Examples/JetstressAutomation/1-InstallAndRunJetstress.ps1 b/source/Examples/JetstressAutomation/1-InstallAndRunJetstress.ps1 similarity index 100% rename from Examples/JetstressAutomation/1-InstallAndRunJetstress.ps1 rename to source/Examples/JetstressAutomation/1-InstallAndRunJetstress.ps1 diff --git a/Examples/JetstressAutomation/2-CleanupJetstress.ps1 b/source/Examples/JetstressAutomation/2-CleanupJetstress.ps1 similarity index 100% rename from Examples/JetstressAutomation/2-CleanupJetstress.ps1 rename to source/Examples/JetstressAutomation/2-CleanupJetstress.ps1 diff --git a/Examples/MaintenanceMode/MaintenanceModePrep.ps1 b/source/Examples/MaintenanceMode/MaintenanceModePrep.ps1 similarity index 100% rename from Examples/MaintenanceMode/MaintenanceModePrep.ps1 rename to source/Examples/MaintenanceMode/MaintenanceModePrep.ps1 diff --git a/Examples/MaintenanceMode/MaintenanceModeStart.ps1 b/source/Examples/MaintenanceMode/MaintenanceModeStart.ps1 similarity index 100% rename from Examples/MaintenanceMode/MaintenanceModeStart.ps1 rename to source/Examples/MaintenanceMode/MaintenanceModeStart.ps1 diff --git a/Examples/MaintenanceMode/MaintenanceModeStop.ps1 b/source/Examples/MaintenanceMode/MaintenanceModeStop.ps1 similarity index 100% rename from Examples/MaintenanceMode/MaintenanceModeStop.ps1 rename to source/Examples/MaintenanceMode/MaintenanceModeStop.ps1 diff --git a/Examples/PostInstallationConfiguration/PostInstallationConfiguration.ps1 b/source/Examples/PostInstallationConfiguration/PostInstallationConfiguration.ps1 similarity index 100% rename from Examples/PostInstallationConfiguration/PostInstallationConfiguration.ps1 rename to source/Examples/PostInstallationConfiguration/PostInstallationConfiguration.ps1 diff --git a/Examples/QuickStartTemplate/QuickStartTemplate.ps1 b/source/Examples/QuickStartTemplate/QuickStartTemplate.ps1 similarity index 100% rename from Examples/QuickStartTemplate/QuickStartTemplate.ps1 rename to source/Examples/QuickStartTemplate/QuickStartTemplate.ps1 diff --git a/Examples/WaitForADPrep/WaitForADPrep.ps1 b/source/Examples/WaitForADPrep/WaitForADPrep.ps1 similarity index 100% rename from Examples/WaitForADPrep/WaitForADPrep.ps1 rename to source/Examples/WaitForADPrep/WaitForADPrep.ps1 diff --git a/source/Modules/xExchangeCalculatorHelper/xExchangeCalculatorHelper.psd1 b/source/Modules/xExchangeCalculatorHelper/xExchangeCalculatorHelper.psd1 new file mode 100644 index 00000000..4a6adc44 --- /dev/null +++ b/source/Modules/xExchangeCalculatorHelper/xExchangeCalculatorHelper.psd1 @@ -0,0 +1,128 @@ +# +# Module manifest for module 'xExchangeCalculatorHelper' +# +# Generated by: DSC Community +# +# Generated on: 05-01-20 +# + +@{ + + # Script module or binary module file associated with this manifest. + RootModule = 'xExchangeCalculatorHelper.psm1' + + # Version number of this module. + ModuleVersion = '1.0.0' + + # Supported PSEditions + # CompatiblePSEditions = @() + + # ID used to uniquely identify this module + GUID = '26a09e0a-9ad3-4724-8013-6760f8de85f3' + + # Author of this module + Author = 'DSC Community' + + # Company or vendor of this module + CompanyName = 'Dsc Community' + + # Copyright statement for this module + Copyright = 'Copyright the DSC Community contributors. All rights reserved.' + + # Description of the functionality provided by this module + Description = 'Functions used by the DSC resources in xExchange.' + + # Minimum version of the Windows PowerShell engine required by this module + # PowerShellVersion = '' + + # Name of the Windows PowerShell host required by this module + # PowerShellHostName = '' + + # Minimum version of the Windows PowerShell host required by this module + # PowerShellHostVersion = '' + + # Minimum version of Microsoft .NET Framework required by this module. This prerequisite is valid for the PowerShell Desktop edition only. + # DotNetFrameworkVersion = '' + + # Minimum version of the common language runtime (CLR) required by this module. This prerequisite is valid for the PowerShell Desktop edition only. + # CLRVersion = '' + + # Processor architecture (None, X86, Amd64) required by this module + # ProcessorArchitecture = '' + + # Modules that must be imported into the global environment prior to importing this module + # RequiredModules = @() + + # Assemblies that must be loaded prior to importing this module + # RequiredAssemblies = @() + + # Script files (.ps1) that are run in the caller's environment prior to importing this module. + # ScriptsToProcess = @() + + # Type files (.ps1xml) to be loaded when importing this module + # TypesToProcess = @() + + # Format files (.ps1xml) to be loaded when importing this module + # FormatsToProcess = @() + + # Modules to import as nested modules of the module specified in RootModule/ModuleToProcess + # NestedModules = @() + + # Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export. + FunctionsToExport = @( + 'Get-DBMapFromServersCsv', + 'Get-DBListFromMailboxDatabasesCsv', + 'Get-DBListFromMailboxDatabaseCopiesCsv', + 'Update-StringContent' + ) + + # Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export. + CmdletsToExport = @() + + # Variables to export from this module + VariablesToExport = @() + + # Aliases to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no aliases to export. + AliasesToExport = @() + + # DSC resources to export from this module + # DscResourcesToExport = @() + + # List of all modules packaged with this module + # ModuleList = @() + + # List of all files packaged with this module + # FileList = @() + + # Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell. + PrivateData = @{ + + PSData = @{ + + # Tags applied to this module. These help with module discovery in online galleries. + # Tags = @() + + # A URL to the license for this module. + # LicenseUri = '' + + # A URL to the main website for this project. + # ProjectUri = '' + + # A URL to an icon representing this module. + # IconUri = '' + + # ReleaseNotes of this module + # ReleaseNotes = '' + + } # End of PSData hashtable + + } # End of PrivateData hashtable + + # HelpInfo URI of this module + # HelpInfoURI = '' + + # Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix. + # DefaultCommandPrefix = '' + +} + diff --git a/Modules/xExchangeCalculatorHelper.psm1 b/source/Modules/xExchangeCalculatorHelper/xExchangeCalculatorHelper.psm1 similarity index 94% rename from Modules/xExchangeCalculatorHelper.psm1 rename to source/Modules/xExchangeCalculatorHelper/xExchangeCalculatorHelper.psm1 index 5cae3a6c..98d65e16 100644 --- a/Modules/xExchangeCalculatorHelper.psm1 +++ b/source/Modules/xExchangeCalculatorHelper/xExchangeCalculatorHelper.psm1 @@ -25,17 +25,17 @@ function Get-DBMapFromServersCsv [OutputType([System.String[]])] param ( - [Parameter(Mandatory=$true)] + [Parameter(Mandatory = $true)] [System.String] $ServersCsvPath, - [Parameter(Mandatory=$true)] + [Parameter(Mandatory = $true)] [System.String] $ServerNameInCsv, [Parameter()] [System.Collections.Hashtable] - $DbNameReplacements = @{} + $DbNameReplacements = @{ } ) if (!(Test-Path -Path $ServersCsvPath)) @@ -43,7 +43,7 @@ function Get-DBMapFromServersCsv throw 'Unable to access file specified in ServersCsvPath' } - [System.Object[]] $serverData = Import-Csv -Path $ServersCsvPath | Where-Object -FilterScript {$_.ServerName -like $ServerNameInCsv} + [System.Object[]] $serverData = Import-Csv -Path $ServersCsvPath | Where-Object -FilterScript { $_.ServerName -like $ServerNameInCsv } if ($serverData.Count -ne 1) { @@ -127,17 +127,17 @@ function Get-DBListFromMailboxDatabasesCsv [OutputType([System.Management.Automation.PSObject[]])] param ( - [Parameter(Mandatory=$true)] + [Parameter(Mandatory = $true)] [System.String] $MailboxDatabasesCsvPath, - [Parameter(Mandatory=$true)] + [Parameter(Mandatory = $true)] [System.String] $ServerNameInCsv, [Parameter()] [System.Collections.Hashtable] - $DbNameReplacements = @{} + $DbNameReplacements = @{ } ) if (!(Test-Path -Path $MailboxDatabasesCsvPath)) @@ -145,7 +145,7 @@ function Get-DBListFromMailboxDatabasesCsv throw 'Unable to access file specified in MailboxDatabasesCsvPath' } - [System.Object[]] $relevantDBs = Import-Csv -Path $MailboxDatabasesCsvPath | Where-Object -FilterScript {$_.Server -like $ServerNameInCsv} + [System.Object[]] $relevantDBs = Import-Csv -Path $MailboxDatabasesCsvPath | Where-Object -FilterScript { $_.Server -like $ServerNameInCsv } # Create the output variable [System.Management.Automation.PSObject[]] $dbList = New-Object -TypeName 'System.Management.Automation.PSObject[]' -ArgumentList $relevantDBs.Count @@ -230,17 +230,17 @@ function Get-DBListFromMailboxDatabaseCopiesCsv [OutputType([System.Management.Automation.PSObject[]])] param ( - [Parameter(Mandatory=$true)] + [Parameter(Mandatory = $true)] [System.String] $MailboxDatabaseCopiesCsvPath, - [Parameter(Mandatory=$true)] + [Parameter(Mandatory = $true)] [System.String] $ServerNameInCsv, [Parameter()] [System.Collections.Hashtable] - $DbNameReplacements = @{} + $DbNameReplacements = @{ } ) if (!(Test-Path -Path $MailboxDatabaseCopiesCsvPath)) @@ -248,7 +248,7 @@ function Get-DBListFromMailboxDatabaseCopiesCsv throw 'Unable to access file specified in MailboxDatabaseCopiesCsvPath' } - [System.Object[]] $relevantDBs = Import-Csv -Path $MailboxDatabaseCopiesCsvPath | Where-Object -FilterScript {$_.Server -like $ServerNameInCsv} + [System.Object[]] $relevantDBs = Import-Csv -Path $MailboxDatabaseCopiesCsvPath | Where-Object -FilterScript { $_.Server -like $ServerNameInCsv } # Create the output variable [System.Management.Automation.PSObject[]] $dbList = New-Object -TypeName 'System.Management.Automation.PSObject[]' -ArgumentList $relevantDBs.Count @@ -304,7 +304,7 @@ function Update-StringContent [Parameter()] [System.Collections.Hashtable] - $Replacements = @{} + $Replacements = @{ } ) if ($Replacements.Count -gt 0) @@ -317,5 +317,3 @@ function Update-StringContent return $StringIn } - -Export-ModuleMember -Function * diff --git a/source/Modules/xExchangeDiskPart/xExchangeDiskPart.psd1 b/source/Modules/xExchangeDiskPart/xExchangeDiskPart.psd1 new file mode 100644 index 00000000..5265401e --- /dev/null +++ b/source/Modules/xExchangeDiskPart/xExchangeDiskPart.psd1 @@ -0,0 +1,129 @@ +# +# Module manifest for module 'xExchangeDiskPart' +# +# Generated by: DSC Community +# +# Generated on: 05-01-20 +# + +@{ + + # Script module or binary module file associated with this manifest. + RootModule = 'xExchangeDiskPart.psm1' + + # Version number of this module. + ModuleVersion = '1.0.0' + + # Supported PSEditions + # CompatiblePSEditions = @() + + # ID used to uniquely identify this module + GUID = '7a17670d-c7d6-4443-b407-61b03443cccd' + + # Author of this module + Author = 'DSC Community' + + # Company or vendor of this module + CompanyName = 'Dsc Community' + + # Copyright statement for this module + Copyright = 'Copyright the DSC Community contributors. All rights reserved.' + + # Description of the functionality provided by this module + Description = 'Functions used by the DSC resources in xExchange.' + + # Minimum version of the Windows PowerShell engine required by this module + # PowerShellVersion = '' + + # Name of the Windows PowerShell host required by this module + # PowerShellHostName = '' + + # Minimum version of the Windows PowerShell host required by this module + # PowerShellHostVersion = '' + + # Minimum version of Microsoft .NET Framework required by this module. This prerequisite is valid for the PowerShell Desktop edition only. + # DotNetFrameworkVersion = '' + + # Minimum version of the common language runtime (CLR) required by this module. This prerequisite is valid for the PowerShell Desktop edition only. + # CLRVersion = '' + + # Processor architecture (None, X86, Amd64) required by this module + # ProcessorArchitecture = '' + + # Modules that must be imported into the global environment prior to importing this module + # RequiredModules = @() + + # Assemblies that must be loaded prior to importing this module + # RequiredAssemblies = @() + + # Script files (.ps1) that are run in the caller's environment prior to importing this module. + # ScriptsToProcess = @() + + # Type files (.ps1xml) to be loaded when importing this module + # TypesToProcess = @() + + # Format files (.ps1xml) to be loaded when importing this module + # FormatsToProcess = @() + + # Modules to import as nested modules of the module specified in RootModule/ModuleToProcess + # NestedModules = @() + + # Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export. + FunctionsToExport = @( + 'Start-DiskPart', + 'Get-DiskInfo', + 'Convert-StringArrayToCommaSeparatedString', + 'Add-ObjectToObjectArrayMap', + 'Get-MountPointVolumeNumber' + ) + + # Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export. + CmdletsToExport = @() + + # Variables to export from this module + VariablesToExport = '*' + + # Aliases to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no aliases to export. + AliasesToExport = @() + + # DSC resources to export from this module + # DscResourcesToExport = @() + + # List of all modules packaged with this module + # ModuleList = @() + + # List of all files packaged with this module + # FileList = @() + + # Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell. + PrivateData = @{ + + PSData = @{ + + # Tags applied to this module. These help with module discovery in online galleries. + # Tags = @() + + # A URL to the license for this module. + # LicenseUri = '' + + # A URL to the main website for this project. + # ProjectUri = '' + + # A URL to an icon representing this module. + # IconUri = '' + + # ReleaseNotes of this module + # ReleaseNotes = '' + + } # End of PSData hashtable + + } # End of PrivateData hashtable + + # HelpInfo URI of this module + # HelpInfoURI = '' + + # Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix. + # DefaultCommandPrefix = '' + +} + diff --git a/Modules/xExchangeDiskPart.psm1 b/source/Modules/xExchangeDiskPart/xExchangeDiskPart.psm1 similarity index 98% rename from Modules/xExchangeDiskPart.psm1 rename to source/Modules/xExchangeDiskPart/xExchangeDiskPart.psm1 index b397a8b1..c02d50b9 100644 --- a/Modules/xExchangeDiskPart.psm1 +++ b/source/Modules/xExchangeDiskPart/xExchangeDiskPart.psm1 @@ -54,12 +54,12 @@ function Get-DiskInfo { [CmdletBinding()] [OutputType([System.Collections.Hashtable])] - param() + param () [System.Collections.Hashtable] $diskInfo = @{ - DiskToVolumeMap = @{} - VolumeToMountPointMap = @{} - DiskSizeMap = @{} + DiskToVolumeMap = @{ } + VolumeToMountPointMap = @{ } + DiskSizeMap = @{ } } [int[]] $diskNums = @() @@ -307,5 +307,3 @@ function Get-MountPointVolumeNumber return -1 } - -Export-ModuleMember -Function * diff --git a/source/Modules/xExchangeHelper/xExchangeHelper.psd1 b/source/Modules/xExchangeHelper/xExchangeHelper.psd1 new file mode 100644 index 00000000..8f1b9fb9 --- /dev/null +++ b/source/Modules/xExchangeHelper/xExchangeHelper.psd1 @@ -0,0 +1,177 @@ +# +# Module manifest for module 'xExchangeHelper' +# +# Generated by: DSC Community +# +# Generated on: 05-01-20 +# + +@{ + + # Script module or binary module file associated with this manifest. + RootModule = 'xExchangeHelper.psm1' + + # Version number of this module. + ModuleVersion = '1.0.0' + + # Supported PSEditions + # CompatiblePSEditions = @() + + # ID used to uniquely identify this module + GUID = '515ea6d4-34d0-4bb8-aea9-46580aefec6d' + + # Author of this module + Author = 'DSC Community' + + # Company or vendor of this module + CompanyName = 'Dsc Community' + + # Copyright statement for this module + Copyright = 'Copyright the DSC Community contributors. All rights reserved.' + + # Description of the functionality provided by this module + Description = 'Functions used by the DSC resources in xExchange.' + + # Minimum version of the Windows PowerShell engine required by this module + # PowerShellVersion = '' + + # Name of the Windows PowerShell host required by this module + # PowerShellHostName = '' + + # Minimum version of the Windows PowerShell host required by this module + # PowerShellHostVersion = '' + + # Minimum version of Microsoft .NET Framework required by this module. This prerequisite is valid for the PowerShell Desktop edition only. + # DotNetFrameworkVersion = '' + + # Minimum version of the common language runtime (CLR) required by this module. This prerequisite is valid for the PowerShell Desktop edition only. + # CLRVersion = '' + + # Processor architecture (None, X86, Amd64) required by this module + # ProcessorArchitecture = '' + + # Modules that must be imported into the global environment prior to importing this module + # RequiredModules = @() + + # Assemblies that must be loaded prior to importing this module + # RequiredAssemblies = @() + + # Script files (.ps1) that are run in the caller's environment prior to importing this module. + # ScriptsToProcess = @() + + # Type files (.ps1xml) to be loaded when importing this module + # TypesToProcess = @() + + # Format files (.ps1xml) to be loaded when importing this module + # FormatsToProcess = @() + + # Modules to import as nested modules of the module specified in RootModule/ModuleToProcess + # NestedModules = @() + + # Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export. + FunctionsToExport = @( + 'Get-ExistingRemoteExchangeSession', + 'Get-RemoteExchangeSession', + 'New-RemoteExchangeSession', + 'Import-RemoteExchangeSession', + 'Remove-RemoteExchangeSession', + 'Test-ExchangePresent', + 'Get-ExchangeVersionYear', + 'Get-ExchangeUninstallKey' + 'Get-DetailedInstalledVersion', 'Test-ExchangeSetupComplete', + 'Test-ExchangeSetupPartiallyCompleted', + 'Get-SetupExeVersion', + 'Test-ShouldUpgradeExchange', + 'Get-ExchangeInstallStatus', + 'Set-WSManConfigStatus', + 'Test-ShouldInstallUMLanguagePack', + 'Test-ExchangeSetupRunning', + 'Compare-StringToString', + 'Compare-BoolToBool', + 'Compare-TimespanToString', + 'Compare-ByteQuantifiedSizeToString', + 'Compare-UnlimitedToString', + 'Compare-ADObjectIdToSmtpAddressString', + 'Convert-StringToArray', + 'Convert-StringArrayToLowerCase', + 'Compare-ArrayContent', + 'Test-ArrayElementsInSecondArray', + 'Add-ToPSBoundParametersFromHashtable', + 'Remove-FromPSBoundParametersUsingHashtable', + 'Remove-NotApplicableParamsForVersion', + 'Set-EmptyStringParamsToNull', + 'Test-ExchangeSetting', + 'Write-InvalidSettingVerbose', + 'Write-FunctionEntry', + 'Start-ExchangeScheduledTask', + 'Test-CmdletHasParameter', + 'Get-PreviousError', + 'Assert-NoNewError', + 'Restart-ExistingAppPool', + 'Test-UMLanguagePackInstalled', + 'Compare-IPAddressToString', + 'Compare-SmtpAddressToString', + 'Compare-IPAddressesToArray', + 'Compare-PSCredential', + 'Test-ExtendedProtectionSPNList', + 'Assert-IsSupportedWithExchangeVersion', + 'Invoke-DotSourcedScript', + 'Remove-HelperSnapin', + 'Wait-ForProcessStart', + 'Wait-ForProcessStop', + 'Assert-ExchangeSetupArgumentsComplete', + 'Get-StringFromHashtable', + 'Get-DomainDNFromFQDN', + 'Set-DSCMachineStatus' + ) + + # Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export. + CmdletsToExport = @() + + # Variables to export from this module + VariablesToExport = '*' + + # Aliases to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no aliases to export. + AliasesToExport = @() + + # DSC resources to export from this module + # DscResourcesToExport = @() + + # List of all modules packaged with this module + # ModuleList = @() + + # List of all files packaged with this module + # FileList = @() + + # Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell. + PrivateData = @{ + + PSData = @{ + + # Tags applied to this module. These help with module discovery in online galleries. + # Tags = @() + + # A URL to the license for this module. + # LicenseUri = '' + + # A URL to the main website for this project. + # ProjectUri = '' + + # A URL to an icon representing this module. + # IconUri = '' + + # ReleaseNotes of this module + # ReleaseNotes = '' + + } # End of PSData hashtable + + } # End of PrivateData hashtable + + # HelpInfo URI of this module + # HelpInfoURI = '' + + # Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix. + # DefaultCommandPrefix = '' + +} + diff --git a/Modules/xExchangeHelper.psm1 b/source/Modules/xExchangeHelper/xExchangeHelper.psm1 similarity index 96% rename from Modules/xExchangeHelper.psm1 rename to source/Modules/xExchangeHelper/xExchangeHelper.psm1 index d7aaae58..5e8efc28 100644 --- a/Modules/xExchangeHelper.psm1 +++ b/source/Modules/xExchangeHelper/xExchangeHelper.psm1 @@ -143,10 +143,10 @@ function New-RemoteExchangeSession } $returnValues = Invoke-DotSourcedScript ` - -ScriptPath $remoteExchange ` - -CommandsToExecuteInScope $commandToExecuteAfterDotSourcing ` - -ParamsForCommandsToExecuteInScope $commandParamsToExecuteAfterDotSourcing ` - -Verbose:$VerbosePreference + -ScriptPath $remoteExchange ` + -CommandsToExecuteInScope $commandToExecuteAfterDotSourcing ` + -ParamsForCommandsToExecuteInScope $commandParamsToExecuteAfterDotSourcing ` + -Verbose:$VerbosePreference if ($null -ne $returnValues -and $returnValues.ContainsKey('_NewExchangeRunspace')) { @@ -258,7 +258,7 @@ function Get-ExchangeVersionYear $installedVersionDetails = Get-DetailedInstalledVersion if ($null -ne $installedVersionDetails) - { # If Exchange is installed + { switch ($installedVersionDetails.VersionMajor) { 15 @@ -301,7 +301,7 @@ function Get-ExchangeUninstallKey { [CmdletBinding()] [OutputType([Microsoft.Win32.RegistryKey])] - param() + param () # First try to get the Exchange 2016 / 2019 uninstall key. $uninstallKey = Get-Item -Path 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{CD981244-E9B8-405A-9026-6AEB9DCEF1F1}' -ErrorAction SilentlyContinue @@ -326,7 +326,7 @@ function Get-DetailedInstalledVersion { [CmdletBinding()] [OutputType([System.Management.Automation.PSCustomObject])] - param() + param () $installedVersionDetails = $null @@ -460,7 +460,7 @@ function Get-SetupExeVersion [OutputType([System.Management.Automation.PSCustomObject])] param ( - [Parameter(Mandatory=$true)] + [Parameter(Mandatory = $true)] [System.String] $Path ) @@ -498,16 +498,15 @@ function Get-SetupExeVersion #> function Test-ShouldUpgradeExchange { - [CmdletBinding()] [OutputType([System.Boolean])] param ( - [Parameter(Mandatory=$true)] + [Parameter(Mandatory = $true)] [System.String] $Path, - [Parameter(Mandatory=$true)] + [Parameter(Mandatory = $true)] [System.String] $Arguments ) @@ -523,25 +522,25 @@ function Test-ShouldUpgradeExchange $setupExeVersion = Get-SetupExeVersion -Path $Path - if($null -ne $setupExeVersion` - -and $null -ne $setupExeVersion.VersionMajor` - -and $null -ne $setupExeVersion.VersionMinor` - -and $null -ne $setupExeVersion.VersionBuild) + if ($null -ne $setupExeVersion` + -and $null -ne $setupExeVersion.VersionMajor` + -and $null -ne $setupExeVersion.VersionMinor` + -and $null -ne $setupExeVersion.VersionBuild) { Write-Verbose -Message "Setup.exe version is: '$('Major: {0}, Minor: {1}, Build: {2}' -f $setupExeVersion.VersionMajor,$setupexeVersion.VersionMinor, $setupexeVersion.VersionBuild)'" $exchangeDisplayVersion = Get-DetailedInstalledVersion - if($null -ne $exchangeDisplayVersion` - -and $null -ne $exchangeDisplayVersion.VersionMajor` - -and $null -ne $exchangeDisplayVersion.VersionMinor` - -and $null -ne $exchangeDisplayVersion.VersionBuild) + if ($null -ne $exchangeDisplayVersion` + -and $null -ne $exchangeDisplayVersion.VersionMajor` + -and $null -ne $exchangeDisplayVersion.VersionMinor` + -and $null -ne $exchangeDisplayVersion.VersionBuild) { # If we have an exchange installed Write-Verbose -Message "Exchange version is: '$('Major: {0}, Minor: {1}, Build: {2}' -f $exchangeDisplayVersion.VersionMajor,$exchangeDisplayVersion.VersionMinor, $exchangeDisplayVersion.VersionBuild)'" - if(($exchangeDisplayVersion.VersionMajor -eq $setupExeVersion.VersionMajor)` - -and ($exchangeDisplayVersion.VersionMinor -eq $setupExeVersion.VersionMinor)` - -and ($exchangeDisplayVersion.VersionBuild -lt $setupExeVersion.VersionBuild) ) + if (($exchangeDisplayVersion.VersionMajor -eq $setupExeVersion.VersionMajor)` + -and ($exchangeDisplayVersion.VersionMinor -eq $setupExeVersion.VersionMinor)` + -and ($exchangeDisplayVersion.VersionBuild -lt $setupExeVersion.VersionBuild) ) { # If server has lower version of CU installed Write-Verbose -Message 'Version upgrade is requested.' # Executing with the upgrade. @@ -604,7 +603,7 @@ function Get-ExchangeInstallStatus if ($setupRunning -or $setupComplete) { - if (($shouldInstallLanguagePack -or $shouldUpgrade) -and $setupComplete) + if (($shouldInstallLanguagePack -or $shouldUpgrade) -and $setupComplete) { $shouldStartInstall = $true } @@ -622,11 +621,11 @@ function Get-ExchangeInstallStatus $returnValue = @{ ShouldInstallLanguagePack = $shouldInstallLanguagePack - SetupRunning = $setupRunning - SetupComplete = $setupComplete - ExchangePresent = $exchangePresent - ShouldUpgrade = $shouldUpgrade - ShouldStartInstall = $shouldStartInstall + SetupRunning = $setupRunning + SetupComplete = $setupComplete + ExchangePresent = $exchangePresent + ShouldUpgrade = $shouldUpgrade + ShouldStartInstall = $shouldStartInstall } $returnValue @@ -692,15 +691,15 @@ function Test-ShouldInstallUMLanguagePack $Arguments ) - if($Arguments -match '(?<=/AddUMLanguagePack:)(([a-z]{2}-[A-Z]{2},?)+)(?=\s)') + if ($Arguments -match '(?<=/AddUMLanguagePack:)(([a-z]{2}-[A-Z]{2},?)+)(?=\s)') { $Cultures = $Matches[0] Write-Verbose -Message "AddUMLanguagePack parameters detected: $Cultures" $Cultures = $Cultures -split ',' - foreach($Culture in $Cultures) + foreach ($Culture in $Cultures) { - if((Test-UMLanguagePackInstalled -Culture $Culture) -eq $false) + if ((Test-UMLanguagePackInstalled -Culture $Culture) -eq $false) { Write-Verbose -Message "UM Language Pack: $Culture is not installed" return $true @@ -998,7 +997,7 @@ function Compare-ADObjectIdToSmtpAddressString throw "Failed to Get-Recipient for ADObjectID with distinguishedName: $($ADObjectId.DistinguishedName)" } - return ($null -ne ($recipient.EmailAddresses | Where-Object {$_.AddressString -like $AddressString})) + return ($null -ne ($recipient.EmailAddresses | Where-Object { $_.AddressString -like $AddressString })) } else { @@ -1171,7 +1170,8 @@ function Test-ArrayElementsInSecondArray $hasContents = $true if ($Array1.Count -eq 0) # Do nothing, as Array2 at a minimum contains nothing - {} + { + } elseif ($Array2.Count -eq 0) # Array2 is empty and Array1 is not. Return false { $hasContents = $false @@ -1956,7 +1956,7 @@ function Compare-SmtpAddressToString } else { - return($SmtpAddress.Equals([Microsoft.Exchange.Data.SmtpAddress]::Parse($string))) + return ($SmtpAddress.Equals([Microsoft.Exchange.Data.SmtpAddress]::Parse($string))) } } else @@ -1992,7 +1992,7 @@ function Compare-IPAddressesToArray $IPAddressStrings ) - [System.String[]] $validIPStrings = $IPAddressStrings | Where-Object -FilterScript {![String]::IsNullOrEmpty($_)} + [System.String[]] $validIPStrings = $IPAddressStrings | Where-Object -FilterScript { ![String]::IsNullOrEmpty($_) } if ($IPAddressObjects.Count -ne $validIPStrings.Count) { @@ -2160,9 +2160,9 @@ function Test-ExtendedProtectionSPNList process { # Check if AllowDotless is set in Flags - if($IsDotless) + if ($IsDotless) { - if(!$flagsLower.Contains('allowdotlessspn')) + if (!$flagsLower.Contains('allowdotlessspn')) { Write-Verbose -Message 'Dotless SPN found, but ExtendedProtectionFlags does not contain AllowDotlessSPN!' $returnValue = $false @@ -2236,7 +2236,7 @@ function Invoke-DotSourcedScript [Parameter()] [System.Collections.Hashtable] - $ScriptParams = @{}, + $ScriptParams = @{ }, [Parameter()] [System.String[]] @@ -2251,7 +2251,7 @@ function Invoke-DotSourcedScript $ParamsForCommandsToExecuteInScope ) - [System.Collections.Hashtable] $returnValues = @{} + [System.Collections.Hashtable] $returnValues = @{ } . $ScriptPath @ScriptParams @@ -2259,7 +2259,7 @@ function Invoke-DotSourcedScript { [System.String] $commandToExecute = $CommandsToExecuteInScope[$i] - [System.Collections.Hashtable] $commandParams = @{} + [System.Collections.Hashtable] $commandParams = @{ } if ($ParamsForCommandsToExecuteInScope.ContainsKey($commandToExecute)) { @@ -2437,11 +2437,11 @@ function Assert-ExchangeSetupArgumentsComplete [CmdletBinding()] param ( - [Parameter(Mandatory=$true)] + [Parameter(Mandatory = $true)] [System.String] $Path, - [Parameter(Mandatory=$true)] + [Parameter(Mandatory = $true)] [System.String] $Arguments ) @@ -2480,7 +2480,7 @@ function Get-StringFromHashtable [OutputType([System.String])] param ( - [Parameter(Mandatory=$true)] + [Parameter(Mandatory = $true)] [System.Collections.Hashtable] $Hashtable, @@ -2520,7 +2520,7 @@ function Get-DomainDNFromFQDN [OutputType([System.String])] param ( - [Parameter(Mandatory=$true)] + [Parameter(Mandatory = $true)] [ValidateNotNullorEmpty()] [System.String] $Fqdn @@ -2548,12 +2548,10 @@ function Set-DSCMachineStatus [CmdletBinding()] param ( - [Parameter(Mandatory=$true)] + [Parameter(Mandatory = $true)] [System.Int32] $NewDSCMachineStatus ) $global:DSCMachineStatus = $NewDSCMachineStatus } - -Export-ModuleMember -Function * diff --git a/source/build.psd1 b/source/build.psd1 new file mode 100644 index 00000000..cbc44adb --- /dev/null +++ b/source/build.psd1 @@ -0,0 +1,6 @@ +@{ + Path = 'xExchange.psd1' #or build breaks on Linux +} +# Waiting for ModuleBuilder to do away with this file +# when all parameters are provided to the function + diff --git a/source/en-US/about_xExchange.help.txt b/source/en-US/about_xExchange.help.txt new file mode 100644 index 00000000..93d09f87 --- /dev/null +++ b/source/en-US/about_xExchange.help.txt @@ -0,0 +1,24 @@ +TOPIC + about_xExchange + +SHORT DESCRIPTION + Module with DSC Resources for deployment and configuration of Microsoft Exchange Server. + +LONG DESCRIPTION + This module contains DSC resources for deployment and configuration of Microsoft Exchange Server. + +EXAMPLES + PS C:\> Get-DscResource -Module xExchange + +NOTE: + Thank you to all those who contributed to this module, by writing code, sharing opinions, and provided feedback. + +TROUBLESHOOTING NOTE: + Look out on the Github repository for issues and new releases. + +SEE ALSO + - https://github.com/dsccommunity/xExchange + +KEYWORDS + DSC, DscResource, Exchange + diff --git a/source/xExchange.psd1 b/source/xExchange.psd1 new file mode 100644 index 00000000..0179e2d1 --- /dev/null +++ b/source/xExchange.psd1 @@ -0,0 +1,109 @@ +@{ + # Version number of this module. + moduleVersion = '0.0.1' + + # ID used to uniquely identify this module + GUID = '9a908ca3-8a67-485c-a014-66ba37fcc2a4' + + # Author of this module + Author = 'DSC Community' + + # Company or vendor of this module + CompanyName = 'DSC Community' + + # Copyright statement for this module + Copyright = 'Copyright the DSC Community contributors. All rights reserved.' + + # Description of the functionality provided by this module + Description = 'Module with DSC Resources for deployment and configuration of Microsoft Exchange Server.' + + # Minimum version of the Windows PowerShell engine required by this module + PowerShellVersion = '4.0' + + # Modules to import as nested modules of the module specified in RootModule/ModuleToProcess + NestedModules = @("Modules\xExchangeHelper\xExchangeHelper.psd1") + + # Functions to export from this module + FunctionsToExport = @( + 'Get-ExistingRemoteExchangeSession', + 'Get-RemoteExchangeSession', + 'New-RemoteExchangeSession', + 'Import-RemoteExchangeSession', + 'Remove-RemoteExchangeSession', + 'Test-ExchangePresent', + 'Get-ExchangeVersionYear', + 'Get-ExchangeUninstallKey' + 'Get-DetailedInstalledVersion', 'Test-ExchangeSetupComplete', + 'Test-ExchangeSetupPartiallyCompleted', + 'Get-SetupExeVersion', + 'Test-ShouldUpgradeExchange', + 'Get-ExchangeInstallStatus', + 'Set-WSManConfigStatus', + 'Test-ShouldInstallUMLanguagePack', + 'Test-ExchangeSetupRunning', + 'Compare-StringToString', + 'Compare-BoolToBool', + 'Compare-TimespanToString', + 'Compare-ByteQuantifiedSizeToString', + 'Compare-UnlimitedToString', + 'Compare-ADObjectIdToSmtpAddressString', + 'Convert-StringToArray', + 'Convert-StringArrayToLowerCase', + 'Compare-ArrayContent', + 'Test-ArrayElementsInSecondArray', + 'Add-ToPSBoundParametersFromHashtable', + 'Remove-FromPSBoundParametersUsingHashtable', + 'Remove-NotApplicableParamsForVersion', + 'Set-EmptyStringParamsToNull', + 'Test-ExchangeSetting', + 'Write-InvalidSettingVerbose', + 'Write-FunctionEntry', + 'Start-ExchangeScheduledTask', + 'Test-CmdletHasParameter', + 'Get-PreviousError', + 'Assert-NoNewError', + 'Restart-ExistingAppPool', + 'Test-UMLanguagePackInstalled', + 'Compare-IPAddressToString', + 'Compare-SmtpAddressToString', + 'Compare-IPAddressesToArray', + 'Compare-PSCredential', + 'Test-ExtendedProtectionSPNList', + 'Assert-IsSupportedWithExchangeVersion', + 'Invoke-DotSourcedScript', + 'Remove-HelperSnapin', + 'Wait-ForProcessStart', + 'Wait-ForProcessStop', + 'Assert-ExchangeSetupArgumentsComplete', + 'Get-StringFromHashtable', + 'Get-DomainDNFromFQDN', + 'Set-DSCMachineStatus' + ) + + # Cmdlets to export from this module + CmdletsToExport = @() + + # Private data to pass to the module specified in RootModule/ModuleToProcess. + # This may also contain a PSData hashtable with additional module metadata used by PowerShell. + PrivateData = @{ + + PSData = @{ + IconUri = 'https://dsccommunity.org/images/DSC_Logo_300p.png' + + # Tags applied to this module. These help with module discovery in online galleries. + Tags = @('DesiredStateConfiguration', 'DSC', 'DSCResourceKit', 'DSCResource') + + # A URL to the license for this module. + LicenseUri = 'https://github.com/dsccommunity/xExchange/blob/master/LICENSE' + + # A URL to the main website for this project. + ProjectUri = 'https://github.com/dsccommunity/xExchange' + + # ReleaseNotes of this module + ReleaseNotes = '' + + Prerelease = '' + } # End of PSData hashtable + + } # End of PrivateData hashtable +} diff --git a/Tests/Data/MailboxDatabaseCopiesV7.6.csv b/tests/Data/MailboxDatabaseCopiesV7.6.csv similarity index 100% rename from Tests/Data/MailboxDatabaseCopiesV7.6.csv rename to tests/Data/MailboxDatabaseCopiesV7.6.csv diff --git a/Tests/Data/MailboxDatabasesBad.csv b/tests/Data/MailboxDatabasesBad.csv similarity index 100% rename from Tests/Data/MailboxDatabasesBad.csv rename to tests/Data/MailboxDatabasesBad.csv diff --git a/Tests/Data/MailboxDatabasesV6.6.csv b/tests/Data/MailboxDatabasesV6.6.csv similarity index 100% rename from Tests/Data/MailboxDatabasesV6.6.csv rename to tests/Data/MailboxDatabasesV6.6.csv diff --git a/Tests/Data/MailboxDatabasesV7.6.csv b/tests/Data/MailboxDatabasesV7.6.csv similarity index 100% rename from Tests/Data/MailboxDatabasesV7.6.csv rename to tests/Data/MailboxDatabasesV7.6.csv diff --git a/Tests/Data/ServersV7.6.csv b/tests/Data/ServersV7.6.csv similarity index 100% rename from Tests/Data/ServersV7.6.csv rename to tests/Data/ServersV7.6.csv diff --git a/Tests/Data/TestCert1.pfx b/tests/Data/TestCert1.pfx similarity index 100% rename from Tests/Data/TestCert1.pfx rename to tests/Data/TestCert1.pfx diff --git a/Tests/Data/TestCert2.pfx b/tests/Data/TestCert2.pfx similarity index 100% rename from Tests/Data/TestCert2.pfx rename to tests/Data/TestCert2.pfx diff --git a/tests/Integration/MSFT_xExchActiveSyncVirtualDirectory.Integration.Tests.ps1 b/tests/Integration/MSFT_xExchActiveSyncVirtualDirectory.Integration.Tests.ps1 new file mode 100644 index 00000000..bf1f1e19 --- /dev/null +++ b/tests/Integration/MSFT_xExchActiveSyncVirtualDirectory.Integration.Tests.ps1 @@ -0,0 +1,267 @@ +<# + .SYNOPSIS + Automated integration test for MSFT_xExchActiveSyncVirtualDirectory DSC Resource. + This test module requires use of credentials. + The first run through of the tests will prompt for credentials from the logged on user. +#> + +#region HEADER +[System.String] $script:moduleRoot = Split-Path -Parent (Split-Path -Parent $PSScriptRoot) +[System.String] $script:DSCModuleName = 'xExchange' +[System.String] $script:DSCResourceFriendlyName = 'xExchActiveSyncVirtualDirectory' +[System.String] $script:DSCResourceName = "MSFT_$($script:DSCResourceFriendlyName)" + +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Force +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'source' -ChildPath (Join-Path -Path 'Modules' -ChildPath 'xExchangeHelper\xExchangeHelper.psd1'))) -Force +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'source' -ChildPath (Join-Path -Path 'DSCResources' -ChildPath (Join-Path -Path "$($script:DSCResourceName)" -ChildPath "$($script:DSCResourceName).psm1")))) + +# Check if Exchange is installed on this machine. If not, we can't run tests +[System.Boolean] $exchangeInstalled = Test-ExchangeSetupComplete + +#endregion HEADER + +if ($exchangeInstalled) +{ + # Get required credentials to use for the test + $shellCredentials = Get-TestCredential + + # Get the Server FQDN for using in URL's + if ($null -eq $serverFqdn) + { + $serverFqdn = [System.Net.Dns]::GetHostByName($env:COMPUTERNAME).HostName + } + + if ($null -eq $webCertAuthInstalled) + { + $webCertAuth = Get-WindowsFeature -Name Web-Cert-Auth + + if ($webCertAuth.InstallState -ne 'Installed') + { + $webCertAuthInstalled = $false + Write-Verbose -Message 'Web-Cert-Auth is not installed. Skipping certificate based authentication tests.' + } + else + { + $webCertAuthInstalled = $true + } + } + + if ($webCertAuthInstalled -eq $true) + { + # Get the thumbprint to use for ActiveSync Cert Based Auth + if ($null -eq $cbaCertThumbprint) + { + $cbaCertThumbprint = Read-Host -Prompt 'Enter the thumbprint of an Exchange certificate to use when enabling Certificate Based Authentication' + } + } + + Describe 'Test Setting Properties with xExchActiveSyncVirtualDirectory' { + $testParams = @{ + Identity = "$($env:COMPUTERNAME)\Microsoft-Server-ActiveSync (Default Web Site)" + Credential = $shellCredentials + AutoCertBasedAuth = $false + AutoCertBasedAuthThumbprint = '' + BadItemReportingEnabled = $false + BasicAuthEnabled = $true + ClientCertAuth = 'Ignore' + CompressionEnabled = $true + ExtendedProtectionFlags = @('AllowDotlessspn', 'NoServicenameCheck') + ExtendedProtectionSPNList = @('http/mail.fabrikam.com', 'http/mail.fabrikam.local', 'http/wxweqc') + ExtendedProtectionTokenChecking = 'Allow' + ExternalAuthenticationMethods = @('Basic', 'Kerberos') + ExternalUrl = "https://$($serverFqdn)/Microsoft-Server-ActiveSync" + InstallIsapiFilter = $true + InternalAuthenticationMethods = @('Basic', 'Kerberos') + InternalUrl = "https://$($serverFqdn)/Microsoft-Server-ActiveSync" + MobileClientCertificateAuthorityURL = 'http://whatever.com/CA' + MobileClientCertificateProvisioningEnabled = $true + MobileClientCertTemplateName = 'MyTemplateforEAS' + # Name = "$($Node.NodeName) EAS Site" + RemoteDocumentsActionForUnknownServers = 'Block' + RemoteDocumentsAllowedServers = @('AllowedA', 'AllowedB') + RemoteDocumentsBlockedServers = @('BlockedA', 'BlockedB') + RemoteDocumentsInternalDomainSuffixList = @('InternalA', 'InternalB') + SendWatsonReport = $false + WindowsAuthEnabled = $false + } + + $expectedGetResults = @{ + Identity = "$($env:COMPUTERNAME)\Microsoft-Server-ActiveSync (Default Web Site)" + BadItemReportingEnabled = $false + BasicAuthEnabled = $true + ClientCertAuth = 'Ignore' + CompressionEnabled = $true + ExtendedProtectionTokenChecking = 'Allow' + ExternalUrl = "https://$($serverFqdn)/Microsoft-Server-ActiveSync" + InternalAuthenticationMethods = @('Basic', 'Kerberos') + InternalUrl = "https://$($serverFqdn)/Microsoft-Server-ActiveSync" + MobileClientCertificateAuthorityURL = 'http://whatever.com/CA' + MobileClientCertificateProvisioningEnabled = $true + MobileClientCertTemplateName = 'MyTemplateforEAS' + # Name = "$($Node.NodeName) EAS Site" + RemoteDocumentsActionForUnknownServers = 'Block' + SendWatsonReport = $false + WindowsAuthEnabled = $false + } + + Test-TargetResourceFunctionality -Params $testParams ` + -ContextLabel 'Set standard parameters' ` + -ExpectedGetResults $expectedGetResults + + Test-ArrayContentsEqual -TestParams $testParams ` + -DesiredArrayContents $testParams.ExtendedProtectionFlags ` + -GetResultParameterName 'ExtendedProtectionFlags' ` + -ContextLabel 'Verify ExtendedProtectionFlags' ` + -ItLabel 'ExtendedProtectionSPNList should contain three values' + + Test-ArrayContentsEqual -TestParams $testParams ` + -DesiredArrayContents $testParams.ExtendedProtectionSPNList ` + -GetResultParameterName 'ExtendedProtectionSPNList' ` + -ContextLabel 'Verify ExtendedProtectionSPNList' ` + -ItLabel 'ExtendedProtectionSPNList should contain three values' + + Test-ArrayContentsEqual -TestParams $testParams ` + -DesiredArrayContents $testParams.ExternalAuthenticationMethods ` + -GetResultParameterName 'ExternalAuthenticationMethods' ` + -ContextLabel 'Verify ExternalAuthenticationMethods' ` + -ItLabel 'ExternalAuthenticationMethods should contain two values' + + Test-ArrayContentsEqual -TestParams $testParams ` + -DesiredArrayContents $testParams.InternalAuthenticationMethods ` + -GetResultParameterName 'InternalAuthenticationMethods' ` + -ContextLabel 'Verify InternalAuthenticationMethods' ` + -ItLabel 'InternalAuthenticationMethods should contain two values' + + Test-ArrayContentsEqual -TestParams $testParams ` + -DesiredArrayContents $testParams.RemoteDocumentsAllowedServers ` + -GetResultParameterName 'RemoteDocumentsAllowedServers' ` + -ContextLabel 'Verify RemoteDocumentsAllowedServers' ` + -ItLabel 'RemoteDocumentsAllowedServers should contain two values' + + Test-ArrayContentsEqual -TestParams $testParams ` + -DesiredArrayContents $testParams.RemoteDocumentsBlockedServers ` + -GetResultParameterName 'RemoteDocumentsBlockedServers' ` + -ContextLabel 'Verify RemoteDocumentsBlockedServers' ` + -ItLabel 'RemoteDocumentsBlockedServers should contain two values' + + Test-ArrayContentsEqual -TestParams $testParams ` + -DesiredArrayContents $testParams.RemoteDocumentsInternalDomainSuffixList ` + -GetResultParameterName 'RemoteDocumentsInternalDomainSuffixList' ` + -ContextLabel 'Verify RemoteDocumentsInternalDomainSuffixList' ` + -ItLabel 'RemoteDocumentsInternalDomainSuffixList should contain two values' + + $testParams.ExternalUrl = '' + $testParams.InternalUrl = '' + $expectedGetResults.ExternalUrl = '' + $expectedGetResults.InternalUrl = '' + + Test-TargetResourceFunctionality -Params $testParams ` + -ContextLabel 'Try with empty URLs' ` + -ExpectedGetResults $expectedGetResults + + if ($webCertAuthInstalled -eq $true) + { + $testParams.AutoCertBasedAuth = $true + $testParams.AutoCertBasedAuthThumbprint = $cbaCertThumbprint + $testParams.ClientCertAuth = 'Required' + $expectedGetResults.ClientCertAuth = 'Required' + + Test-TargetResourceFunctionality -Params $testParams ` + -ContextLabel 'Try enabling certificate based authentication' ` + -ExpectedGetResults $expectedGetResults + } + + Context 'Test missing ExtendedProtectionFlags for ExtendedProtectionSPNList' { + $testParams.ExtendedProtectionFlags = @('NoServicenameCheck') + + It 'Should hit exception for missing ExtendedProtectionFlags AllowDotlessSPN' { + { Set-TargetResource @testParams } | Should -Throw + } + + It 'Test results should be true after adding missing ExtendedProtectionFlags' { + $testParams.ExtendedProtectionFlags = @('AllowDotlessSPN') + Set-TargetResource @testParams + $testResults = Test-TargetResource @testParams + $testResults | Should -Be $true + } + } + + Context 'Test invalid combination in ExtendedProtectionFlags' { + $testParams.ExtendedProtectionFlags = @('NoServicenameCheck', 'None') + + It 'Should hit exception for invalid combination ExtendedProtectionFlags' { + { Set-TargetResource @testParams } | Should -Throw + } + + It 'Test results should be true after correction of ExtendedProtectionFlags' { + $testParams.ExtendedProtectionFlags = @('AllowDotlessSPN') + Set-TargetResource @testParams + $testResults = Test-TargetResource @testParams + $testResults | Should -Be $true + } + } + + $testParams.ActiveSyncServer = "https://eas.$($env:USERDNSDOMAIN)/Microsoft-Server-ActiveSync" + $testParams.Remove('ExternalUrl') + $expectedGetResults.ActiveSyncServer = "https://eas.$($env:USERDNSDOMAIN)/Microsoft-Server-ActiveSync" + $expectedGetResults.ExternalUrl = "https://eas.$($env:USERDNSDOMAIN)/Microsoft-Server-ActiveSync" + + Test-TargetResourceFunctionality -Params $testParams ` + -ContextLabel 'Try by setting External URL via ActiveSyncServer' ` + -ExpectedGetResults $expectedGetResults + + # Set values back to default + $testParams = @{ + Identity = "$($env:COMPUTERNAME)\Microsoft-Server-ActiveSync (Default Web Site)" + Credential = $shellCredentials + BadItemReportingEnabled = $true + BasicAuthEnabled = $false + ClientCertAuth = 'Ignore' + CompressionEnabled = $false + ExtendedProtectionFlags = 'None' + ExtendedProtectionSPNList = $null + ExtendedProtectionTokenChecking = 'None' + ExternalAuthenticationMethods = $null + InternalAuthenticationMethods = $null + MobileClientCertificateAuthorityURL = $null + MobileClientCertificateProvisioningEnabled = $false + MobileClientCertTemplateName = $null + RemoteDocumentsActionForUnknownServers = 'Allow' + RemoteDocumentsAllowedServers = $null + RemoteDocumentsBlockedServers = $null + RemoteDocumentsInternalDomainSuffixList = $null + SendWatsonReport = $true + WindowsAuthEnabled = $true + } + + $expectedGetResults = @{ + Identity = "$($env:COMPUTERNAME)\Microsoft-Server-ActiveSync (Default Web Site)" + BadItemReportingEnabled = $true + BasicAuthEnabled = $false + ClientCertAuth = 'Ignore' + CompressionEnabled = $false + ExtendedProtectionTokenChecking = 'None' + ExtendedProtectionFlags = [System.String[]] @() + ExtendedProtectionSPNList = [System.String[]] @() + ExternalAuthenticationMethods = [System.String[]] @() + InternalAuthenticationMethods = [System.String[]] @() + MobileClientCertificateAuthorityURL = '' + MobileClientCertificateProvisioningEnabled = $false + MobileClientCertTemplateName = '' + RemoteDocumentsActionForUnknownServers = 'Allow' + RemoteDocumentsAllowedServers = $null + RemoteDocumentsBlockedServers = $null + RemoteDocumentsInternalDomainSuffixList = $null + SendWatsonReport = $true + WindowsAuthEnabled = $true + } + + Test-TargetResourceFunctionality -Params $testParams ` + -ContextLabel 'Reset values to default' ` + -ExpectedGetResults $expectedGetResults + } +} +else +{ + Write-Verbose -Message 'Tests in this file require that Exchange is installed to be run.' +} diff --git a/Tests/Integration/MSFT_xExchAntiMalwareScanning.Integration.Tests.ps1 b/tests/Integration/MSFT_xExchAntiMalwareScanning.Integration.Tests.ps1 similarity index 67% rename from Tests/Integration/MSFT_xExchAntiMalwareScanning.Integration.Tests.ps1 rename to tests/Integration/MSFT_xExchAntiMalwareScanning.Integration.Tests.ps1 index fcd69b21..ccaa205d 100644 --- a/Tests/Integration/MSFT_xExchAntiMalwareScanning.Integration.Tests.ps1 +++ b/tests/Integration/MSFT_xExchAntiMalwareScanning.Integration.Tests.ps1 @@ -11,9 +11,9 @@ [System.String] $script:DSCResourceFriendlyName = 'xExchAntiMalwareScanning' [System.String] $script:DSCResourceName = "MSFT_$($script:DSCResourceFriendlyName)" -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'Tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Force -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'Modules' -ChildPath 'xExchangeHelper.psm1')) -Force -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'DSCResources' -ChildPath (Join-Path -Path "$($script:DSCResourceName)" -ChildPath "$($script:DSCResourceName).psm1"))) +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Force +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'source' -ChildPath (Join-Path -Path 'Modules' -ChildPath 'xExchangeHelper\xExchangeHelper.psd1'))) -Force +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'source' -ChildPath (Join-Path -Path 'DSCResources' -ChildPath (Join-Path -Path "$($script:DSCResourceName)" -ChildPath "$($script:DSCResourceName).psm1")))) # Check if Exchange is installed on this machine. If not, we can't run tests [System.Boolean] $exchangeInstalled = Test-ExchangeSetupComplete @@ -28,8 +28,8 @@ if ($exchangeInstalled) Describe 'Test Enabling and Disabling Malware Scanning' { # Test enabling with no restart of the service $testParams = @{ - Enabled = $true - Credential = $shellCredentials + Enabled = $true + Credential = $shellCredentials AllowServiceRestart = $false } @@ -38,16 +38,16 @@ if ($exchangeInstalled) } Test-TargetResourceFunctionality -Params $testParams ` - -ContextLabel 'Enable Malware Scanning - No Restart' ` - -ExpectedGetResults $expectedGetResults + -ContextLabel 'Enable Malware Scanning - No Restart' ` + -ExpectedGetResults $expectedGetResults # Test disabling with no restart of the service $testParams.Enabled = $false $expectedGetResults.Enabled = $false Test-TargetResourceFunctionality -Params $testParams ` - -ContextLabel 'Disable Malware Scanning - No Restart' ` - -ExpectedGetResults $expectedGetResults + -ContextLabel 'Disable Malware Scanning - No Restart' ` + -ExpectedGetResults $expectedGetResults # Test enabling with a restart of the service @@ -56,8 +56,8 @@ if ($exchangeInstalled) $expectedGetResults.Enabled = $true Test-TargetResourceFunctionality -Params $testParams ` - -ContextLabel 'Enable Malware Scanning - With Restart' ` - -ExpectedGetResults $expectedGetResults + -ContextLabel 'Enable Malware Scanning - With Restart' ` + -ExpectedGetResults $expectedGetResults # Test disabling with a restart of the service @@ -65,8 +65,8 @@ if ($exchangeInstalled) $expectedGetResults.Enabled = $false Test-TargetResourceFunctionality -Params $testParams ` - -ContextLabel 'Disable Malware Scanning - With Restart' ` - -ExpectedGetResults $expectedGetResults + -ContextLabel 'Disable Malware Scanning - With Restart' ` + -ExpectedGetResults $expectedGetResults } } else diff --git a/Tests/Integration/MSFT_xExchAutoMountPoint.Integration.Tests.ps1 b/tests/Integration/MSFT_xExchAutoMountPoint.Integration.Tests.ps1 similarity index 79% rename from Tests/Integration/MSFT_xExchAutoMountPoint.Integration.Tests.ps1 rename to tests/Integration/MSFT_xExchAutoMountPoint.Integration.Tests.ps1 index 91c3013d..a93026ec 100644 --- a/Tests/Integration/MSFT_xExchAutoMountPoint.Integration.Tests.ps1 +++ b/tests/Integration/MSFT_xExchAutoMountPoint.Integration.Tests.ps1 @@ -9,8 +9,9 @@ [System.String] $script:DSCResourceFriendlyName = 'xExchAutoMountPoint' [System.String] $script:DSCResourceName = "MSFT_$($script:DSCResourceFriendlyName)" -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'Tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Force -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'DSCResources' -ChildPath (Join-Path -Path "$($script:DSCResourceName)" -ChildPath "$($script:DSCResourceName).psm1"))) +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Force +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'source' -ChildPath (Join-Path -Path 'Modules' -ChildPath 'xExchangeHelper\xExchangeHelper.psd1'))) -Force +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'source' -ChildPath (Join-Path -Path 'DSCResources' -ChildPath (Join-Path -Path "$($script:DSCResourceName)" -ChildPath "$($script:DSCResourceName).psm1")))) #endregion HEADER @@ -85,7 +86,7 @@ function Test-MountPointSetup { $dbPath = Join-Path $AutoDagDatabasesRootFolderPath $dbName - $dbPartition = Get-Partition | Where-Object {$_.AccessPaths.Count -gt 0 -and $_.AccessPaths.Contains("$dbPath\")} + $dbPartition = Get-Partition | Where-Object { $_.AccessPaths.Count -gt 0 -and $_.AccessPaths.Contains("$dbPath\") } if ($null -ne $dbPartition) { @@ -121,7 +122,7 @@ function Test-MountPointSetup # what we know about it if (!$foundExVolMountPoint) { - [String[]] $exVolAccessPaths = $dbPartition.AccessPaths | Where-Object {$_ -like "*$AutoDagVolumesRootFolderPath\$VolumePrefix*"} + [String[]] $exVolAccessPaths = $dbPartition.AccessPaths | Where-Object { $_ -like "*$AutoDagVolumesRootFolderPath\$VolumePrefix*" } if ($exVolAccessPaths.Count -gt 0) { @@ -151,7 +152,7 @@ function Test-MountPointSetup } # Now try to find and test any requested spare volumes - [Object[]] $otherExVolPartitions = Get-Partition | Where-Object {$_.AccessPaths -like "*$AutoDagVolumesRootFolderPath\$VolumePrefix*" -and $_.DiskNumber -NotIn $exDiskNumbers} + [Object[]] $otherExVolPartitions = Get-Partition | Where-Object { $_.AccessPaths -like "*$AutoDagVolumesRootFolderPath\$VolumePrefix*" -and $_.DiskNumber -NotIn $exDiskNumbers } [Object[]] $otherExVolDisks = $otherExVolPartitions.DiskNumber It "Extra $VolumePrefix Partition Count Same as Disk Count" { @@ -233,7 +234,7 @@ function Test-DiskAndPartitionSetup # Removes existing Exchange partitions and related folders function Remove-MountPointAndFolderSetup { - [CmdletBinding(SupportsShouldProcess=$True)] + [CmdletBinding(SupportsShouldProcess = $True)] param ( [Parameter()] @@ -246,7 +247,7 @@ function Remove-MountPointAndFolderSetup ) # Find the disk numbers of any disk that currently has an Exchange partition on it - [Object[]] $exDiskNumbers = (Get-Partition | Where-Object {$_.AccessPaths -like "*$AutoDagDatabasesRootFolderPath*" -or $_.AccessPaths -like "*$AutoDagVolumesRootFolderPath*"}).DiskNumber + [Object[]] $exDiskNumbers = (Get-Partition | Where-Object { $_.AccessPaths -like "*$AutoDagDatabasesRootFolderPath*" -or $_.AccessPaths -like "*$AutoDagVolumesRootFolderPath*" }).DiskNumber # Remove all partitions from any Exchange disk. This ensures the System Reserved # partitions are also removed, which is necessary for xExchAutoMountPoint to find @@ -259,14 +260,14 @@ function Remove-MountPointAndFolderSetup # Remove any folders in the ExchangeDatabases and ExchangeVolumes directories. # Do so using Directory.Delete(), as Remove-Item doesn't seem to work against # current or former mount points, even with -Force. - foreach($folder in Get-ChildItem -Path $AutoDagDatabasesRootFolderPath -ErrorAction SilentlyContinue | Where-Object {$_.GetType().Name -like 'DirectoryInfo'}) + foreach ($folder in Get-ChildItem -Path $AutoDagDatabasesRootFolderPath -ErrorAction SilentlyContinue | Where-Object { $_.GetType().Name -like 'DirectoryInfo' }) { - [System.IO.Directory]::Delete($folder.FullName,$true) + [System.IO.Directory]::Delete($folder.FullName, $true) } - foreach($folder in Get-ChildItem -Path $AutoDagVolumesRootFolderPath -ErrorAction SilentlyContinue | Where-Object {$_.GetType().Name -like 'DirectoryInfo'}) + foreach ($folder in Get-ChildItem -Path $AutoDagVolumesRootFolderPath -ErrorAction SilentlyContinue | Where-Object { $_.GetType().Name -like 'DirectoryInfo' }) { - [System.IO.Directory]::Delete($folder.FullName,$true) + [System.IO.Directory]::Delete($folder.FullName, $true) } } @@ -278,7 +279,9 @@ function Remove-MountPointAndFolderSetup Remove-MountPointAndFolderSetup -AutoDagDatabasesRootFolderPath $autoDagDatabasesRootFolderPath -AutoDagVolumesRootFolderPath $autoDagVolumesRootFolderPath # Make sure we have enough empty disks to work with to perform required tests -$unpartitionedDisks = Get-Disk | ForEach-Object {if (($_ | Get-Partition).Count -eq 0) {$_}} +$unpartitionedDisks = Get-Disk | ForEach-Object { if (($_ | Get-Partition).Count -eq 0) + { $_ + } } if ($unpartitionedDisks.Count -lt 2) { @@ -286,45 +289,44 @@ if ($unpartitionedDisks.Count -lt 2) return } -$existingExMountPoints = Get-Partition | Where-Object {$_.AccessPaths -like "*$autoDagDatabasesRootFolderPath*" -or $_.AccessPaths -like "*$autoDagVolumesRootFolderPath*"} +$existingExMountPoints = Get-Partition | Where-Object { $_.AccessPaths -like "*$autoDagDatabasesRootFolderPath*" -or $_.AccessPaths -like "*$autoDagVolumesRootFolderPath*" } if ($existingExMountPoints.Count -gt 0) { Write-Verbose -Message "$($existingExMountPoints.Count) mount points already exist in the Exchange Databases or Exchange Volumes folder. Clean these up before running tests." return } - -# Begin testing +# Begin Testing Describe 'Test xExchAutoMountPoint Scenarios' { # Run through initial testing using 1 DB disk with 4 DB mount points, 1 spare, REFS file system, and GPT partitioning $testParams = @{ - Identity = $env:COMPUTERNAME - AutoDagDatabasesRootFolderPath = $autoDagDatabasesRootFolderPath - AutoDagVolumesRootFolderPath = $autoDagVolumesRootFolderPath - DiskToDBMap = @('IntegrationTestDB1,IntegrationTestDB2,IntegrationTestDB3,IntegrationTestDB4') - SpareVolumeCount = 1 + Identity = $env:COMPUTERNAME + AutoDagDatabasesRootFolderPath = $autoDagDatabasesRootFolderPath + AutoDagVolumesRootFolderPath = $autoDagVolumesRootFolderPath + DiskToDBMap = @('IntegrationTestDB1,IntegrationTestDB2,IntegrationTestDB3,IntegrationTestDB4') + SpareVolumeCount = 1 EnsureExchangeVolumeMountPointIsLast = $true - CreateSubfolders = $true - FileSystem = 'REFS' - PartitioningScheme = 'GPT' - UnitSize = '64K' - VolumePrefix = 'EXVOL' + CreateSubfolders = $true + FileSystem = 'REFS' + PartitioningScheme = 'GPT' + UnitSize = '64K' + VolumePrefix = 'EXVOL' } $expectedGetResults = @{ - Identity = $env:COMPUTERNAME + Identity = $env:COMPUTERNAME AutoDagDatabasesRootFolderPath = $autoDagDatabasesRootFolderPath - AutoDagVolumesRootFolderPath = $autoDagVolumesRootFolderPath - SpareVolumeCount = 1 - FileSystem = 'REFS' - PartitioningScheme = 'GPT' - UnitSize = '64K' - VolumePrefix = 'EXVOL' + AutoDagVolumesRootFolderPath = $autoDagVolumesRootFolderPath + SpareVolumeCount = 1 + FileSystem = 'REFS' + PartitioningScheme = 'GPT' + UnitSize = '64K' + VolumePrefix = 'EXVOL' } Test-TargetResourceFunctionality -Params $testParams ` - -ContextLabel 'Configure database disk with 4 DB folder mount points, and a spare disk' ` - -ExpectedGetResults $expectedGetResults + -ContextLabel 'Configure database disk with 4 DB folder mount points, and a spare disk' ` + -ExpectedGetResults $expectedGetResults Test-MountPointSetup -AutoDagDatabasesRootFolderPath $testParams.AutoDagDatabasesRootFolderPath -AutoDagVolumesRootFolderPath $testParams.AutoDagVolumesRootFolderPath -DiskToDBMap $testParams.DiskToDBMap -SpareVolumeCount $testParams.SpareVolumeCount -EnsureExchangeVolumeMountPointIsLast $testParams.EnsureExchangeVolumeMountPointIsLast -CreateSubfolders $testParams.CreateSubfolders -FileSystem $testParams.FileSystem -PartitioningScheme $testParams.PartitioningScheme -UnitSize $testParams.UnitSize -VolumePrefix $testParams.VolumePrefix @@ -354,8 +356,8 @@ Describe 'Test xExchAutoMountPoint Scenarios' { $testParams.CreateSubfolders = $false Test-TargetResourceFunctionality -Params $testParams ` - -ContextLabel 'Configure 2 database disks with 8 DB folder mount points, and no spare disk' ` - -ExpectedGetResults $expectedGetResults + -ContextLabel 'Configure 2 database disks with 8 DB folder mount points, and no spare disk' ` + -ExpectedGetResults $expectedGetResults Test-MountPointSetup -AutoDagDatabasesRootFolderPath $testParams.AutoDagDatabasesRootFolderPath -AutoDagVolumesRootFolderPath $testParams.AutoDagVolumesRootFolderPath -DiskToDBMap $testParams.DiskToDBMap -SpareVolumeCount $testParams.SpareVolumeCount -EnsureExchangeVolumeMountPointIsLast $testParams.EnsureExchangeVolumeMountPointIsLast -CreateSubfolders $testParams.CreateSubfolders -FileSystem $testParams.FileSystem -PartitioningScheme $testParams.PartitioningScheme -UnitSize $testParams.UnitSize -VolumePrefix $testParams.VolumePrefix } diff --git a/Tests/Integration/MSFT_xExchAutodiscoverVirtualDirectory.Integration.Tests.ps1 b/tests/Integration/MSFT_xExchAutodiscoverVirtualDirectory.Integration.Tests.ps1 similarity index 65% rename from Tests/Integration/MSFT_xExchAutodiscoverVirtualDirectory.Integration.Tests.ps1 rename to tests/Integration/MSFT_xExchAutodiscoverVirtualDirectory.Integration.Tests.ps1 index 3e043f98..41b275de 100644 --- a/Tests/Integration/MSFT_xExchAutodiscoverVirtualDirectory.Integration.Tests.ps1 +++ b/tests/Integration/MSFT_xExchAutodiscoverVirtualDirectory.Integration.Tests.ps1 @@ -11,9 +11,10 @@ [System.String] $script:DSCResourceFriendlyName = 'xExchAutodiscoverVirtualDirectory' [System.String] $script:DSCResourceName = "MSFT_$($script:DSCResourceFriendlyName)" -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'Tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Force -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'Modules' -ChildPath 'xExchangeHelper.psm1')) -Force -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'DSCResources' -ChildPath (Join-Path -Path "$($script:DSCResourceName)" -ChildPath "$($script:DSCResourceName).psm1"))) +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Force +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'source' -ChildPath (Join-Path -Path 'Modules' -ChildPath 'xExchangeHelper\xExchangeHelper.psd1'))) -Force +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'source' -ChildPath (Join-Path -Path 'DSCResources' -ChildPath (Join-Path -Path "$($script:DSCResourceName)" -ChildPath "$($script:DSCResourceName).psm1")))) + # Check if Exchange is installed on this machine. If not, we can't run tests [System.Boolean] $exchangeInstalled = Test-ExchangeSetupComplete @@ -32,43 +33,43 @@ if ($exchangeInstalled) Describe 'Test Setting Properties with xExchAutodiscoverVirtualDirectory' { $testParams = @{ - Identity = "$($env:COMPUTERNAME)\Autodiscover (Default Web Site)" - Credential = $shellCredentials - BasicAuthentication = $true - DigestAuthentication = $false - ExtendedProtectionFlags = @('AllowDotlessspn', 'NoServicenameCheck') - ExtendedProtectionSPNList = @('http/mail.fabrikam.com', 'http/mail.fabrikam.local', 'http/wxweqc') + Identity = "$($env:COMPUTERNAME)\Autodiscover (Default Web Site)" + Credential = $shellCredentials + BasicAuthentication = $true + DigestAuthentication = $false + ExtendedProtectionFlags = @('AllowDotlessspn', 'NoServicenameCheck') + ExtendedProtectionSPNList = @('http/mail.fabrikam.com', 'http/mail.fabrikam.local', 'http/wxweqc') ExtendedProtectionTokenChecking = 'Allow' - OAuthAuthentication = $true - WindowsAuthentication = $true - WSSecurityAuthentication = $true + OAuthAuthentication = $true + WindowsAuthentication = $true + WSSecurityAuthentication = $true } $expectedGetResults = @{ - Identity = "$($env:COMPUTERNAME)\Autodiscover (Default Web Site)" - BasicAuthentication = $true - DigestAuthentication = $false + Identity = "$($env:COMPUTERNAME)\Autodiscover (Default Web Site)" + BasicAuthentication = $true + DigestAuthentication = $false ExtendedProtectionTokenChecking = 'Allow' - OAuthAuthentication = $true - WindowsAuthentication = $true - WSSecurityAuthentication = $true + OAuthAuthentication = $true + WindowsAuthentication = $true + WSSecurityAuthentication = $true } Test-TargetResourceFunctionality -Params $testParams ` - -ContextLabel 'Set standard parameters' ` - -ExpectedGetResults $expectedGetResults + -ContextLabel 'Set standard parameters' ` + -ExpectedGetResults $expectedGetResults Test-ArrayContentsEqual -TestParams $testParams ` - -DesiredArrayContents $testParams.ExtendedProtectionFlags ` - -GetResultParameterName 'ExtendedProtectionFlags' ` - -ContextLabel 'Verify ExtendedProtectionFlags' ` - -ItLabel 'ExtendedProtectionSPNList should contain three values' + -DesiredArrayContents $testParams.ExtendedProtectionFlags ` + -GetResultParameterName 'ExtendedProtectionFlags' ` + -ContextLabel 'Verify ExtendedProtectionFlags' ` + -ItLabel 'ExtendedProtectionSPNList should contain three values' Test-ArrayContentsEqual -TestParams $testParams ` - -DesiredArrayContents $testParams.ExtendedProtectionSPNList ` - -GetResultParameterName 'ExtendedProtectionSPNList' ` - -ContextLabel 'Verify ExtendedProtectionSPNList' ` - -ItLabel 'ExtendedProtectionSPNList should contain three values' + -DesiredArrayContents $testParams.ExtendedProtectionSPNList ` + -GetResultParameterName 'ExtendedProtectionSPNList' ` + -ContextLabel 'Verify ExtendedProtectionSPNList' ` + -ItLabel 'ExtendedProtectionSPNList should contain three values' Context 'Test missing ExtendedProtectionFlags for ExtendedProtectionSPNList' { $testParams.ExtendedProtectionFlags = @('NoServicenameCheck') @@ -118,8 +119,8 @@ if ($exchangeInstalled) $expectedGetResults.WSSecurityAuthentication = $true Test-TargetResourceFunctionality -Params $testParams ` - -ContextLabel 'Change some parameters' ` - -ExpectedGetResults $expectedGetResults + -ContextLabel 'Change some parameters' ` + -ExpectedGetResults $expectedGetResults } } else diff --git a/Tests/Integration/MSFT_xExchClientAccessServer.Integration.Tests.ps1 b/tests/Integration/MSFT_xExchClientAccessServer.Integration.Tests.ps1 similarity index 69% rename from Tests/Integration/MSFT_xExchClientAccessServer.Integration.Tests.ps1 rename to tests/Integration/MSFT_xExchClientAccessServer.Integration.Tests.ps1 index 2b33619b..ed7535e4 100644 --- a/Tests/Integration/MSFT_xExchClientAccessServer.Integration.Tests.ps1 +++ b/tests/Integration/MSFT_xExchClientAccessServer.Integration.Tests.ps1 @@ -11,9 +11,9 @@ [System.String] $script:DSCResourceFriendlyName = 'xExchClientAccessServer' [System.String] $script:DSCResourceName = "MSFT_$($script:DSCResourceFriendlyName)" -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'Tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Force -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'Modules' -ChildPath 'xExchangeHelper.psm1')) -Force -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'DSCResources' -ChildPath (Join-Path -Path "$($script:DSCResourceName)" -ChildPath "$($script:DSCResourceName).psm1"))) +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Force +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'source' -ChildPath (Join-Path -Path 'Modules' -ChildPath 'xExchangeHelper\xExchangeHelper.psd1'))) -Force +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'source' -ChildPath (Join-Path -Path 'DSCResources' -ChildPath (Join-Path -Path "$($script:DSCResourceName)" -ChildPath "$($script:DSCResourceName).psm1")))) # Check if Exchange is installed on this machine. If not, we can't run tests [System.Boolean] $exchangeInstalled = Test-ExchangeSetupComplete @@ -43,43 +43,43 @@ if ($exchangeInstalled) # Do standard URL and scope tests $testParams = @{ - Identity = $env:COMPUTERNAME - Credential = $shellCredentials + Identity = $env:COMPUTERNAME + Credential = $shellCredentials AutoDiscoverServiceInternalUri = "https://$($serverFqdn)/autodiscover/autodiscover.xml" - AutoDiscoverSiteScope = 'Site1' + AutoDiscoverSiteScope = 'Site1' } $expectedGetResults = @{ - Identity = $env:COMPUTERNAME + Identity = $env:COMPUTERNAME AutoDiscoverServiceInternalUri = "https://$($serverFqdn)/autodiscover/autodiscover.xml" - AutoDiscoverSiteScope = 'Site1' + AutoDiscoverSiteScope = 'Site1' } Test-TargetResourceFunctionality -Params $testParams ` - -ContextLabel 'Set autod url and site scope' ` - -ExpectedGetResults $expectedGetResults + -ContextLabel 'Set autod url and site scope' ` + -ExpectedGetResults $expectedGetResults # Now set the URL to empty $testParams.AutoDiscoverServiceInternalUri = '' $expectedGetResults.AutoDiscoverServiceInternalUri = '' Test-TargetResourceFunctionality -Params $testParams ` - -ContextLabel 'Set url to empty' ` - -ExpectedGetResults $expectedGetResults + -ContextLabel 'Set url to empty' ` + -ExpectedGetResults $expectedGetResults # Now try multiple sites in the site scope $testParams.AutoDiscoverSiteScope = 'Site1', 'Site2' - $expectedGetResults = @{} + $expectedGetResults = @{ } Test-TargetResourceFunctionality -Params $testParams ` - -ContextLabel 'Set site scope to multi value'` - -ExpectedGetResults $expectedGetResults + -ContextLabel 'Set site scope to multi value'` + -ExpectedGetResults $expectedGetResults Test-ArrayContentsEqual -TestParams $testParams ` - -DesiredArrayContents $testParams.AutoDiscoverSiteScope ` - -GetResultParameterName 'AutoDiscoverSiteScope' ` - -ContextLabel 'Verify AutoDiscoverSiteScope' ` - -ItLabel 'AutoDiscoverSiteScope should contain two values' + -DesiredArrayContents $testParams.AutoDiscoverSiteScope ` + -GetResultParameterName 'AutoDiscoverSiteScope' ` + -ContextLabel 'Verify AutoDiscoverSiteScope' ` + -ItLabel 'AutoDiscoverSiteScope should contain two values' # Now set the site scope to $null $testParams.AutoDiscoverSiteScope = $null @@ -88,14 +88,14 @@ if ($exchangeInstalled) } Test-TargetResourceFunctionality -Params $testParams ` - -ContextLabel 'Set site scope to null' ` - -ExpectedGetResults $expectedGetResults + -ContextLabel 'Set site scope to null' ` + -ExpectedGetResults $expectedGetResults Test-ArrayContentsEqual -TestParams $testParams ` - -DesiredArrayContents $testParams.AutoDiscoverSiteScope ` - -GetResultParameterName 'AutoDiscoverSiteScope' ` - -ContextLabel 'Verify AutoDiscoverSiteScope' ` - -ItLabel 'AutoDiscoverSiteScope should be empty' + -DesiredArrayContents $testParams.AutoDiscoverSiteScope ` + -GetResultParameterName 'AutoDiscoverSiteScope' ` + -ContextLabel 'Verify AutoDiscoverSiteScope' ` + -ItLabel 'AutoDiscoverSiteScope should be empty' # Create AlternateServiceAccount credentials if ($null -eq $asaCredentials) @@ -103,27 +103,27 @@ if ($exchangeInstalled) $UserASA = 'Fabrikam\ASA' $PWordASA = New-Object -TypeName System.Security.SecureString $asaCredentials = New-Object -TypeName System.Management.Automation.PSCredential ` - -ArgumentList $UserASA, $PWordASA + -ArgumentList $UserASA, $PWordASA } # Now set AlternateServiceAccount account - $testParams.Add('AlternateServiceAccountCredential',$asaCredentials) - $expectedGetResults.Add('AlternateServiceAccountCredential',$asaCredentials) + $testParams.Add('AlternateServiceAccountCredential', $asaCredentials) + $expectedGetResults.Add('AlternateServiceAccountCredential', $asaCredentials) # Alter Autodiscover settings and make sure they're picked up along with AlternateServiceAccount change $testParams.AutoDiscoverSiteScope = 'Site3' $expectedGetResults.AutoDiscoverSiteScope = 'Site3' Test-TargetResourceFunctionality -Params $testParams ` - -ContextLabel 'Set AlternateServiceAccountCredential' ` - -ExpectedGetResults $expectedGetResults + -ContextLabel 'Set AlternateServiceAccountCredential' ` + -ExpectedGetResults $expectedGetResults # Test for invalid AlternateServiceAccount account format Context 'Test looking for invalid format of AlternateServiceAccount account' { $UserASA = 'Fabrikam/ASA' $PWordASA = New-Object -TypeName System.Security.SecureString $asaCredentials = New-Object -TypeName System.Management.Automation.PSCredential ` - -ArgumentList $UserASA, $PWordASA + -ArgumentList $UserASA, $PWordASA # Set the invalid credentials $testParams['AlternateServiceAccountCredential'] = $asaCredentials @@ -140,7 +140,7 @@ if ($exchangeInstalled) # Now clear AlternateServiceAccount account credentials $testParams.Remove('AlternateServiceAccountCredential') - $testParams.Add('RemoveAlternateServiceAccountCredentials',$true) + $testParams.Add('RemoveAlternateServiceAccountCredentials', $true) $expectedGetResults.Remove('AlternateServiceAccountCredential') # Alter Autodiscover settings and make sure they're picked up along with AlternateServiceAccount change @@ -148,8 +148,8 @@ if ($exchangeInstalled) $expectedGetResults.AutoDiscoverSiteScope = 'Site4' Test-TargetResourceFunctionality -Params $testParams ` - -ContextLabel 'Clear AlternateServiceAccountCredential' ` - -ExpectedGetResults $expectedGetResults + -ContextLabel 'Clear AlternateServiceAccountCredential' ` + -ExpectedGetResults $expectedGetResults } } else diff --git a/Tests/Integration/MSFT_xExchDatabaseAvailabilityGroup.Integration.Tests.ps1 b/tests/Integration/MSFT_xExchDatabaseAvailabilityGroup.Integration.Tests.ps1 similarity index 83% rename from Tests/Integration/MSFT_xExchDatabaseAvailabilityGroup.Integration.Tests.ps1 rename to tests/Integration/MSFT_xExchDatabaseAvailabilityGroup.Integration.Tests.ps1 index 645b2dc5..b63eee4a 100644 --- a/Tests/Integration/MSFT_xExchDatabaseAvailabilityGroup.Integration.Tests.ps1 +++ b/tests/Integration/MSFT_xExchDatabaseAvailabilityGroup.Integration.Tests.ps1 @@ -67,7 +67,7 @@ if ($null -ne $adModule) if ($null -eq $fcNode1 -or !$fcNode1.Installed) { Write-Error -Message ('The Failover-Clustering role must be fully installed on' + $($serverFqdn) + ` - 'before the server can be added to the cluster. Skipping all DAG tests.') + 'before the server can be added to the cluster. Skipping all DAG tests.') return } @@ -78,7 +78,7 @@ if ($null -ne $adModule) if ($null -eq $fcNode2 -or !$fcNode2.Installed) { Write-Error -Message ('The Failover-Clustering role must be fully installed on' + $($secondDAGMember) + ` - 'before the server can be added to the cluster. Skipping tests that would utilize this DAG member.') + 'before the server can be added to the cluster. Skipping tests that would utilize this DAG member.') $secondDAGMember = '' } @@ -111,10 +111,10 @@ if ($null -ne $adModule) } # Remove the existing DAG - Initialize-TestForDAG -ServerName @($env:COMPUTERNAME,$secondDAGMember) ` - -DAGName $dagName ` - -DatabaseName $testDBName ` - -ShellCredentials $shellCredentials + Initialize-TestForDAG -ServerName @($env:COMPUTERNAME, $secondDAGMember) ` + -DAGName $dagName ` + -DatabaseName $testDBName ` + -ShellCredentials $shellCredentials Describe 'Test Creating and Modifying a DAG, adding DAG members, creating a DAG database, and adding database copies' { # Create a new DAG @@ -181,14 +181,14 @@ if ($null -ne $adModule) } Test-TargetResourceFunctionality -Params $dagTestParams ` - -ContextLabel 'Create the test DAG' ` - -ExpectedGetResults $dagExpectedGetResults + -ContextLabel 'Create the test DAG' ` + -ExpectedGetResults $dagExpectedGetResults Test-ArrayContentsEqual -TestParams $dagTestParams ` - -DesiredArrayContents $dagTestParams.DatabaseAvailabilityGroupIpAddresses ` - -GetResultParameterName 'DatabaseAvailabilityGroupIpAddresses' ` - -ContextLabel 'Verify DatabaseAvailabilityGroupIpAddresses' ` - -ItLabel 'DatabaseAvailabilityGroupIpAddresses should contain two values' + -DesiredArrayContents $dagTestParams.DatabaseAvailabilityGroupIpAddresses ` + -GetResultParameterName 'DatabaseAvailabilityGroupIpAddresses' ` + -ContextLabel 'Verify DatabaseAvailabilityGroupIpAddresses' ` + -ItLabel 'DatabaseAvailabilityGroupIpAddresses should contain two values' # Add this server as a DAG member Get-Module MSFT_xExch* | Remove-Module -ErrorAction SilentlyContinue @@ -208,8 +208,8 @@ if ($null -ne $adModule) } Test-TargetResourceFunctionality -Params $dagMemberTestParams ` - -ContextLabel 'Add first member to the test DAG' ` - -ExpectedGetResults $dagMemberExpectedGetResults + -ContextLabel 'Add first member to the test DAG' ` + -ExpectedGetResults $dagMemberExpectedGetResults # Do second DAG member tests if a second member was specified if (([System.String]::IsNullOrEmpty($secondDAGMember)) -eq $false) @@ -229,8 +229,8 @@ if ($null -ne $adModule) } Test-TargetResourceFunctionality -Params $dagMemberTestParams ` - -ContextLabel 'Add second member to the test DAG' ` - -ExpectedGetResults $dagMemberExpectedGetResults + -ContextLabel 'Add second member to the test DAG' ` + -ExpectedGetResults $dagMemberExpectedGetResults # Test the DAG again, with props that only take effect once there are members Get-Module MSFT_xExch* | Remove-Module -ErrorAction SilentlyContinue @@ -239,14 +239,14 @@ if ($null -ne $adModule) $dagExpectedGetResults.DatacenterActivationMode = 'DagOnly' Test-TargetResourceFunctionality -Params $dagTestParams ` - -ContextLabel 'Set remaining props on the test DAG' ` - -ExpectedGetResults $dagExpectedGetResults + -ContextLabel 'Set remaining props on the test DAG' ` + -ExpectedGetResults $dagExpectedGetResults Test-ArrayContentsEqual -TestParams $dagTestParams ` - -DesiredArrayContents $dagTestParams.DatabaseAvailabilityGroupIpAddresses ` - -GetResultParameterName 'DatabaseAvailabilityGroupIpAddresses' ` - -ContextLabel 'Verify DatabaseAvailabilityGroupIpAddresses' ` - -ItLabel 'DatabaseAvailabilityGroupIpAddresses should contain two values' + -DesiredArrayContents $dagTestParams.DatabaseAvailabilityGroupIpAddresses ` + -GetResultParameterName 'DatabaseAvailabilityGroupIpAddresses' ` + -ContextLabel 'Verify DatabaseAvailabilityGroupIpAddresses' ` + -ItLabel 'DatabaseAvailabilityGroupIpAddresses should contain two values' # Create a new DAG database Get-Module MSFT_xExch* | Remove-Module -ErrorAction SilentlyContinue @@ -271,8 +271,8 @@ if ($null -ne $adModule) } Test-TargetResourceFunctionality -Params $dagDBTestParams ` - -ContextLabel 'Create test database' ` - -ExpectedGetResults $dagDBExpectedGetResults + -ContextLabel 'Create test database' ` + -ExpectedGetResults $dagDBExpectedGetResults # Add DB Copy Get-Module MSFT_xExch* | Remove-Module -ErrorAction SilentlyContinue @@ -307,8 +307,8 @@ if ($null -ne $adModule) } Test-TargetResourceFunctionality -Params $dagDBCopyTestParams ` - -ContextLabel 'Add a database copy' ` - -ExpectedGetResults $dagDBCopyExpectedGetResults + -ContextLabel 'Add a database copy' ` + -ExpectedGetResults $dagDBCopyExpectedGetResults $dagDBCopyTestParams = @{ Identity = $testDBName @@ -336,8 +336,8 @@ if ($null -ne $adModule) } Test-TargetResourceFunctionality -Params $dagDBCopyTestParams ` - -ContextLabel 'Change database copy settings' ` - -ExpectedGetResults $dagDBCopyExpectedGetResults + -ContextLabel 'Change database copy settings' ` + -ExpectedGetResults $dagDBCopyExpectedGetResults #Remove test database before doing other add copy tests. @@ -348,9 +348,9 @@ if ($null -ne $adModule) $dagDBCopyExpectedGetResults.ActivationPreference = 2 Test-TargetResourceFunctionality -Params $dagDBCopyTestParams ` - -ContextLabel 'Add a database copy with ActivationPreference higher than future copy count' ` - -ExpectedGetResults $dagDBCopyExpectedGetResults ` - -ExpectedTestResult $false + -ContextLabel 'Add a database copy with ActivationPreference higher than future copy count' ` + -ExpectedGetResults $dagDBCopyExpectedGetResults ` + -ExpectedTestResult $false #Remove test database before doing other add copy tests. Remove-CopiesOfTestDatabase -DatabaseName $testDBName @@ -361,9 +361,9 @@ if ($null -ne $adModule) $dagDBCopyExpectedGetResults.ActivationPreference = 2 Test-TargetResourceFunctionality -Params $dagDBCopyTestParams ` - -ContextLabel 'Add a database copy with SeedingPostponed' ` - -ExpectedGetResults $dagDBCopyExpectedGetResults ` - -ExpectedTestResult $true + -ContextLabel 'Add a database copy with SeedingPostponed' ` + -ExpectedGetResults $dagDBCopyExpectedGetResults ` + -ExpectedTestResult $true } } } diff --git a/Tests/Integration/MSFT_xExchEcpVirtualDirectory.Integration.Tests.ps1 b/tests/Integration/MSFT_xExchEcpVirtualDirectory.Integration.Tests.ps1 similarity index 92% rename from Tests/Integration/MSFT_xExchEcpVirtualDirectory.Integration.Tests.ps1 rename to tests/Integration/MSFT_xExchEcpVirtualDirectory.Integration.Tests.ps1 index e635789a..a36c8bc7 100644 --- a/Tests/Integration/MSFT_xExchEcpVirtualDirectory.Integration.Tests.ps1 +++ b/tests/Integration/MSFT_xExchEcpVirtualDirectory.Integration.Tests.ps1 @@ -11,9 +11,9 @@ [System.String] $script:DSCResourceFriendlyName = 'xExchEcpVirtualDirectory' [System.String] $script:DSCResourceName = "MSFT_$($script:DSCResourceFriendlyName)" -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'Tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Force -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'Modules' -ChildPath 'xExchangeHelper.psm1')) -Force -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'DSCResources' -ChildPath (Join-Path -Path "$($script:DSCResourceName)" -ChildPath "$($script:DSCResourceName).psm1"))) +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Force +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'source' -ChildPath (Join-Path -Path 'Modules' -ChildPath 'xExchangeHelper\xExchangeHelper.psd1'))) -Force +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'source' -ChildPath (Join-Path -Path 'DSCResources' -ChildPath (Join-Path -Path "$($script:DSCResourceName)" -ChildPath "$($script:DSCResourceName).psm1")))) # Check if Exchange is installed on this machine. If not, we can't run tests [System.Boolean] $exchangeInstalled = Test-ExchangeSetupComplete diff --git a/Tests/Integration/MSFT_xExchEventLogLevel.Integration.Tests.ps1 b/tests/Integration/MSFT_xExchEventLogLevel.Integration.Tests.ps1 similarity index 70% rename from Tests/Integration/MSFT_xExchEventLogLevel.Integration.Tests.ps1 rename to tests/Integration/MSFT_xExchEventLogLevel.Integration.Tests.ps1 index 47f0463c..0c34f2af 100644 --- a/Tests/Integration/MSFT_xExchEventLogLevel.Integration.Tests.ps1 +++ b/tests/Integration/MSFT_xExchEventLogLevel.Integration.Tests.ps1 @@ -11,9 +11,9 @@ [System.String] $script:DSCResourceFriendlyName = 'xExchEventLogLevel' [System.String] $script:DSCResourceName = "MSFT_$($script:DSCResourceFriendlyName)" -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'Tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Force -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'Modules' -ChildPath 'xExchangeHelper.psm1')) -Force -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'DSCResources' -ChildPath (Join-Path -Path "$($script:DSCResourceName)" -ChildPath "$($script:DSCResourceName).psm1"))) +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Force +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'source' -ChildPath (Join-Path -Path 'Modules' -ChildPath 'xExchangeHelper\xExchangeHelper.psd1'))) -Force +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'source' -ChildPath (Join-Path -Path 'DSCResources' -ChildPath (Join-Path -Path "$($script:DSCResourceName)" -ChildPath "$($script:DSCResourceName).psm1")))) # Check if Exchange is installed on this machine. If not, we can't run tests [System.Boolean] $exchangeInstalled = Test-ExchangeSetupComplete @@ -28,8 +28,8 @@ if ($exchangeInstalled) Describe 'Test Enabling and Disabling Event Log Levels' { # Set event log level to high $testParams = @{ - Identity = 'MSExchangeTransport\DSN' - Level = 'High' + Identity = 'MSExchangeTransport\DSN' + Level = 'High' Credential = $shellCredentials } @@ -38,16 +38,16 @@ if ($exchangeInstalled) } Test-TargetResourceFunctionality -Params $testParams ` - -ContextLabel 'Set MSExchangeTransport\DSN to High' ` - -ExpectedGetResults $expectedGetResults + -ContextLabel 'Set MSExchangeTransport\DSN to High' ` + -ExpectedGetResults $expectedGetResults # Set event log level to lowest $testParams.Level = 'Lowest' $expectedGetResults.Level = 'Lowest' Test-TargetResourceFunctionality -Params $testParams ` - -ContextLabel 'Set MSExchangeTransport\DSN to Lowest' ` - -ExpectedGetResults $expectedGetResults + -ContextLabel 'Set MSExchangeTransport\DSN to Lowest' ` + -ExpectedGetResults $expectedGetResults } } else diff --git a/Tests/Integration/MSFT_xExchExchangeCertificate.Integration.Tests.ps1 b/tests/Integration/MSFT_xExchExchangeCertificate.Integration.Tests.ps1 similarity index 88% rename from Tests/Integration/MSFT_xExchExchangeCertificate.Integration.Tests.ps1 rename to tests/Integration/MSFT_xExchExchangeCertificate.Integration.Tests.ps1 index b5e2042d..c4fe8610 100644 --- a/Tests/Integration/MSFT_xExchExchangeCertificate.Integration.Tests.ps1 +++ b/tests/Integration/MSFT_xExchExchangeCertificate.Integration.Tests.ps1 @@ -15,9 +15,9 @@ Param() [System.String] $script:DSCResourceFriendlyName = 'xExchExchangeCertificate' [System.String] $script:DSCResourceName = "MSFT_$($script:DSCResourceFriendlyName)" -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'Tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Force -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'Modules' -ChildPath 'xExchangeHelper.psm1')) -Force -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'DSCResources' -ChildPath (Join-Path -Path "$($script:DSCResourceName)" -ChildPath "$($script:DSCResourceName).psm1"))) +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Force +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'source' -ChildPath (Join-Path -Path 'Modules' -ChildPath 'xExchangeHelper\xExchangeHelper.psd1'))) -Force +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'source' -ChildPath (Join-Path -Path 'DSCResources' -ChildPath (Join-Path -Path "$($script:DSCResourceName)" -ChildPath "$($script:DSCResourceName).psm1")))) # Check if Exchange is installed on this machine. If not, we can't run tests [System.Boolean] $exchangeInstalled = Test-ExchangeSetupComplete @@ -35,8 +35,8 @@ if ($exchangeInstalled) [System.String] $testCertThumbprint1 = '766358855A7361C6D99D4FB58903AB0833296B2A' [System.String] $testCertThumbprint2 = '4C14890860F4126A18560779B8AF8B818B900F5A' - [System.String] $testCertPath1 = Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'Tests' -ChildPath (Join-Path -Path 'Data' -ChildPath 'TestCert1.pfx')) - [System.String] $testCertPath2 = Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'Tests' -ChildPath (Join-Path -Path 'Data' -ChildPath 'TestCert2.pfx')) + [System.String] $testCertPath1 = Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'tests' -ChildPath (Join-Path -Path 'Data' -ChildPath 'TestCert1.pfx')) + [System.String] $testCertPath2 = Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'tests' -ChildPath (Join-Path -Path 'Data' -ChildPath 'TestCert2.pfx')) Describe 'Test Installing, Enabling, and Removing Exchange Certificates' { # Test installing and enabling test cert 1 diff --git a/Tests/Integration/MSFT_xExchExchangeServer.Integration.Tests.ps1 b/tests/Integration/MSFT_xExchExchangeServer.Integration.Tests.ps1 similarity index 95% rename from Tests/Integration/MSFT_xExchExchangeServer.Integration.Tests.ps1 rename to tests/Integration/MSFT_xExchExchangeServer.Integration.Tests.ps1 index 10f5e1ba..2f588011 100644 --- a/Tests/Integration/MSFT_xExchExchangeServer.Integration.Tests.ps1 +++ b/tests/Integration/MSFT_xExchExchangeServer.Integration.Tests.ps1 @@ -13,9 +13,9 @@ [System.String] $script:DSCResourceFriendlyName = 'xExchExchangeServer' [System.String] $script:DSCResourceName = "MSFT_$($script:DSCResourceFriendlyName)" -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'Tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Force -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'Modules' -ChildPath 'xExchangeHelper.psm1')) -Force -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'DSCResources' -ChildPath (Join-Path -Path "$($script:DSCResourceName)" -ChildPath "$($script:DSCResourceName).psm1"))) +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Force +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'source' -ChildPath (Join-Path -Path 'Modules' -ChildPath 'xExchangeHelper\xExchangeHelper.psd1'))) -Force +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'source' -ChildPath (Join-Path -Path 'DSCResources' -ChildPath (Join-Path -Path "$($script:DSCResourceName)" -ChildPath "$($script:DSCResourceName).psm1")))) # Check if Exchange is installed on this machine. If not, we can't run tests [System.Boolean] $exchangeInstalled = Test-ExchangeSetupComplete diff --git a/Tests/Integration/MSFT_xExchFrontendTransportService.Integration.Tests.ps1 b/tests/Integration/MSFT_xExchFrontendTransportService.Integration.Tests.ps1 similarity index 95% rename from Tests/Integration/MSFT_xExchFrontendTransportService.Integration.Tests.ps1 rename to tests/Integration/MSFT_xExchFrontendTransportService.Integration.Tests.ps1 index 961249a3..24d7696f 100644 --- a/Tests/Integration/MSFT_xExchFrontendTransportService.Integration.Tests.ps1 +++ b/tests/Integration/MSFT_xExchFrontendTransportService.Integration.Tests.ps1 @@ -11,9 +11,9 @@ [System.String] $script:DSCResourceFriendlyName = 'xExchFrontendTransportService' [System.String] $script:DSCResourceName = "MSFT_$($script:DSCResourceFriendlyName)" -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'Tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Force -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'Modules' -ChildPath 'xExchangeHelper.psm1')) -Force -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'DSCResources' -ChildPath (Join-Path -Path "$($script:DSCResourceName)" -ChildPath "$($script:DSCResourceName).psm1"))) +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Force +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'source' -ChildPath (Join-Path -Path 'Modules' -ChildPath 'xExchangeHelper\xExchangeHelper.psd1'))) -Force +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'source' -ChildPath (Join-Path -Path 'DSCResources' -ChildPath (Join-Path -Path "$($script:DSCResourceName)" -ChildPath "$($script:DSCResourceName).psm1")))) # Check if Exchange is installed on this machine. If not, we can't run tests [System.Boolean] $exchangeInstalled = Test-ExchangeSetupComplete diff --git a/Tests/Integration/MSFT_xExchImapSettings.Integration.Tests.ps1 b/tests/Integration/MSFT_xExchImapSettings.Integration.Tests.ps1 similarity index 90% rename from Tests/Integration/MSFT_xExchImapSettings.Integration.Tests.ps1 rename to tests/Integration/MSFT_xExchImapSettings.Integration.Tests.ps1 index 796c8a2a..7ccb408a 100644 --- a/Tests/Integration/MSFT_xExchImapSettings.Integration.Tests.ps1 +++ b/tests/Integration/MSFT_xExchImapSettings.Integration.Tests.ps1 @@ -11,9 +11,9 @@ [System.String] $script:DSCResourceFriendlyName = 'xExchImapSettings' [System.String] $script:DSCResourceName = "MSFT_$($script:DSCResourceFriendlyName)" -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'Tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Force -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'Modules' -ChildPath 'xExchangeHelper.psm1')) -Force -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'DSCResources' -ChildPath (Join-Path -Path "$($script:DSCResourceName)" -ChildPath "$($script:DSCResourceName).psm1"))) +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Force +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'source' -ChildPath (Join-Path -Path 'Modules' -ChildPath 'xExchangeHelper\xExchangeHelper.psd1'))) -Force +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'source' -ChildPath (Join-Path -Path 'DSCResources' -ChildPath (Join-Path -Path "$($script:DSCResourceName)" -ChildPath "$($script:DSCResourceName).psm1")))) # Check if Exchange is installed on this machine. If not, we can't run tests [System.Boolean] $exchangeInstalled = Test-ExchangeSetupComplete diff --git a/Tests/Integration/MSFT_xExchMailboxDatabase.Integration.Tests.ps1 b/tests/Integration/MSFT_xExchMailboxDatabase.Integration.Tests.ps1 similarity index 97% rename from Tests/Integration/MSFT_xExchMailboxDatabase.Integration.Tests.ps1 rename to tests/Integration/MSFT_xExchMailboxDatabase.Integration.Tests.ps1 index 649309cc..02ae48cf 100644 --- a/Tests/Integration/MSFT_xExchMailboxDatabase.Integration.Tests.ps1 +++ b/tests/Integration/MSFT_xExchMailboxDatabase.Integration.Tests.ps1 @@ -11,9 +11,9 @@ [System.String] $script:DSCResourceFriendlyName = 'xExchMailboxDatabase' [System.String] $script:DSCResourceName = "MSFT_$($script:DSCResourceFriendlyName)" -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'Tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Force -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'Modules' -ChildPath 'xExchangeHelper.psm1')) -Force -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'DSCResources' -ChildPath (Join-Path -Path "$($script:DSCResourceName)" -ChildPath "$($script:DSCResourceName).psm1"))) +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Force +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'source' -ChildPath (Join-Path -Path 'Modules' -ChildPath 'xExchangeHelper\xExchangeHelper.psd1'))) -Force +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'source' -ChildPath (Join-Path -Path 'DSCResources' -ChildPath (Join-Path -Path "$($script:DSCResourceName)" -ChildPath "$($script:DSCResourceName).psm1")))) # Check if Exchange is installed on this machine. If not, we can't run tests [System.Boolean] $exchangeInstalled = Test-ExchangeSetupComplete diff --git a/Tests/Integration/MSFT_xExchMailboxServer.Integration.Tests.ps1 b/tests/Integration/MSFT_xExchMailboxServer.Integration.Tests.ps1 similarity index 97% rename from Tests/Integration/MSFT_xExchMailboxServer.Integration.Tests.ps1 rename to tests/Integration/MSFT_xExchMailboxServer.Integration.Tests.ps1 index f3f8d537..7ba4392b 100644 --- a/Tests/Integration/MSFT_xExchMailboxServer.Integration.Tests.ps1 +++ b/tests/Integration/MSFT_xExchMailboxServer.Integration.Tests.ps1 @@ -11,9 +11,9 @@ [System.String] $script:DSCResourceFriendlyName = 'xExchMailboxServer' [System.String] $script:DSCResourceName = "MSFT_$($script:DSCResourceFriendlyName)" -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'Tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Force -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'Modules' -ChildPath 'xExchangeHelper.psm1')) -Force -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'DSCResources' -ChildPath (Join-Path -Path "$($script:DSCResourceName)" -ChildPath "$($script:DSCResourceName).psm1"))) +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Force +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'source' -ChildPath (Join-Path -Path 'Modules' -ChildPath 'xExchangeHelper\xExchangeHelper.psd1'))) -Force +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'source' -ChildPath (Join-Path -Path 'DSCResources' -ChildPath (Join-Path -Path "$($script:DSCResourceName)" -ChildPath "$($script:DSCResourceName).psm1")))) # Check if Exchange is installed on this machine. If not, we can't run tests [System.Boolean] $exchangeInstalled = Test-ExchangeSetupComplete diff --git a/Tests/Integration/MSFT_xExchMailboxTransportService.Integration.Tests.ps1 b/tests/Integration/MSFT_xExchMailboxTransportService.Integration.Tests.ps1 similarity index 93% rename from Tests/Integration/MSFT_xExchMailboxTransportService.Integration.Tests.ps1 rename to tests/Integration/MSFT_xExchMailboxTransportService.Integration.Tests.ps1 index ab388e82..76c20a06 100644 --- a/Tests/Integration/MSFT_xExchMailboxTransportService.Integration.Tests.ps1 +++ b/tests/Integration/MSFT_xExchMailboxTransportService.Integration.Tests.ps1 @@ -11,9 +11,9 @@ [System.String] $script:DSCResourceFriendlyName = 'xExchMailboxTransportService' [System.String] $script:DSCResourceName = "MSFT_$($script:DSCResourceFriendlyName)" -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'Tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Force -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'Modules' -ChildPath 'xExchangeHelper.psm1')) -Force -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'DSCResources' -ChildPath (Join-Path -Path "$($script:DSCResourceName)" -ChildPath "$($script:DSCResourceName).psm1"))) +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Force +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'source' -ChildPath (Join-Path -Path 'Modules' -ChildPath 'xExchangeHelper\xExchangeHelper.psd1'))) -Force +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'source' -ChildPath (Join-Path -Path 'DSCResources' -ChildPath (Join-Path -Path "$($script:DSCResourceName)" -ChildPath "$($script:DSCResourceName).psm1")))) # Check if Exchange is installed on this machine. If not, we can't run tests [System.Boolean] $exchangeInstalled = Test-ExchangeSetupComplete diff --git a/Tests/Integration/MSFT_xExchMaintenanceMode.Integration.Tests.ps1 b/tests/Integration/MSFT_xExchMaintenanceMode.Integration.Tests.ps1 similarity index 98% rename from Tests/Integration/MSFT_xExchMaintenanceMode.Integration.Tests.ps1 rename to tests/Integration/MSFT_xExchMaintenanceMode.Integration.Tests.ps1 index da5520bc..c4619281 100644 --- a/Tests/Integration/MSFT_xExchMaintenanceMode.Integration.Tests.ps1 +++ b/tests/Integration/MSFT_xExchMaintenanceMode.Integration.Tests.ps1 @@ -11,9 +11,9 @@ [System.String] $script:DSCResourceFriendlyName = 'xExchMaintenanceMode' [System.String] $script:DSCResourceName = "MSFT_$($script:DSCResourceFriendlyName)" -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'Tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Force -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'Modules' -ChildPath 'xExchangeHelper.psm1')) -Force -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'DSCResources' -ChildPath (Join-Path -Path "$($script:DSCResourceName)" -ChildPath "$($script:DSCResourceName).psm1"))) +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Force +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'source' -ChildPath (Join-Path -Path 'Modules' -ChildPath 'xExchangeHelper\xExchangeHelper.psd1'))) -Force +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'source' -ChildPath (Join-Path -Path 'DSCResources' -ChildPath (Join-Path -Path "$($script:DSCResourceName)" -ChildPath "$($script:DSCResourceName).psm1")))) # Check if Exchange is installed on this machine. If not, we can't run tests [System.Boolean] $exchangeInstalled = Test-ExchangeSetupComplete diff --git a/Tests/Integration/MSFT_xExchMapiVirtualDirectory.Integration.Tests.ps1 b/tests/Integration/MSFT_xExchMapiVirtualDirectory.Integration.Tests.ps1 similarity index 91% rename from Tests/Integration/MSFT_xExchMapiVirtualDirectory.Integration.Tests.ps1 rename to tests/Integration/MSFT_xExchMapiVirtualDirectory.Integration.Tests.ps1 index 6d5a852d..f00bfc02 100644 --- a/Tests/Integration/MSFT_xExchMapiVirtualDirectory.Integration.Tests.ps1 +++ b/tests/Integration/MSFT_xExchMapiVirtualDirectory.Integration.Tests.ps1 @@ -11,9 +11,9 @@ [System.String] $script:DSCResourceFriendlyName = 'xExchMapiVirtualDirectory' [System.String] $script:DSCResourceName = "MSFT_$($script:DSCResourceFriendlyName)" -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'Tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Force -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'Modules' -ChildPath 'xExchangeHelper.psm1')) -Force -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'DSCResources' -ChildPath (Join-Path -Path "$($script:DSCResourceName)" -ChildPath "$($script:DSCResourceName).psm1"))) +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Force +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'source' -ChildPath (Join-Path -Path 'Modules' -ChildPath 'xExchangeHelper\xExchangeHelper.psd1'))) -Force +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'source' -ChildPath (Join-Path -Path 'DSCResources' -ChildPath (Join-Path -Path "$($script:DSCResourceName)" -ChildPath "$($script:DSCResourceName).psm1")))) # Check if Exchange is installed on this machine. If not, we can't run tests [System.Boolean] $exchangeInstalled = Test-ExchangeSetupComplete diff --git a/Tests/Integration/MSFT_xExchOabVirtualDirectory.Integration.Tests.ps1 b/tests/Integration/MSFT_xExchOabVirtualDirectory.Integration.Tests.ps1 similarity index 91% rename from Tests/Integration/MSFT_xExchOabVirtualDirectory.Integration.Tests.ps1 rename to tests/Integration/MSFT_xExchOabVirtualDirectory.Integration.Tests.ps1 index 42625d24..3670b7d0 100644 --- a/Tests/Integration/MSFT_xExchOabVirtualDirectory.Integration.Tests.ps1 +++ b/tests/Integration/MSFT_xExchOabVirtualDirectory.Integration.Tests.ps1 @@ -11,9 +11,9 @@ [System.String] $script:DSCResourceFriendlyName = 'xExchOabVirtualDirectory' [System.String] $script:DSCResourceName = "MSFT_$($script:DSCResourceFriendlyName)" -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'Tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Force -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'Modules' -ChildPath 'xExchangeHelper.psm1')) -Force -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'DSCResources' -ChildPath (Join-Path -Path "$($script:DSCResourceName)" -ChildPath "$($script:DSCResourceName).psm1"))) +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Force +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'source' -ChildPath (Join-Path -Path 'Modules' -ChildPath 'xExchangeHelper\xExchangeHelper.psd1'))) -Force +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'source' -ChildPath (Join-Path -Path 'DSCResources' -ChildPath (Join-Path -Path "$($script:DSCResourceName)" -ChildPath "$($script:DSCResourceName).psm1")))) # Check if Exchange is installed on this machine. If not, we can't run tests [System.Boolean] $exchangeInstalled = Test-ExchangeSetupComplete diff --git a/Tests/Integration/MSFT_xExchOutlookAnywhere.Integration.Tests.ps1 b/tests/Integration/MSFT_xExchOutlookAnywhere.Integration.Tests.ps1 similarity index 91% rename from Tests/Integration/MSFT_xExchOutlookAnywhere.Integration.Tests.ps1 rename to tests/Integration/MSFT_xExchOutlookAnywhere.Integration.Tests.ps1 index 66059321..70acc678 100644 --- a/Tests/Integration/MSFT_xExchOutlookAnywhere.Integration.Tests.ps1 +++ b/tests/Integration/MSFT_xExchOutlookAnywhere.Integration.Tests.ps1 @@ -11,9 +11,9 @@ [System.String] $script:DSCResourceFriendlyName = 'xExchOutlookAnywhere' [System.String] $script:DSCResourceName = "MSFT_$($script:DSCResourceFriendlyName)" -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'Tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Force -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'Modules' -ChildPath 'xExchangeHelper.psm1')) -Force -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'DSCResources' -ChildPath (Join-Path -Path "$($script:DSCResourceName)" -ChildPath "$($script:DSCResourceName).psm1"))) +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Force +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'source' -ChildPath (Join-Path -Path 'Modules' -ChildPath 'xExchangeHelper\xExchangeHelper.psd1'))) -Force +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'source' -ChildPath (Join-Path -Path 'DSCResources' -ChildPath (Join-Path -Path "$($script:DSCResourceName)" -ChildPath "$($script:DSCResourceName).psm1")))) # Check if Exchange is installed on this machine. If not, we can't run tests [System.Boolean] $exchangeInstalled = Test-ExchangeSetupComplete diff --git a/Tests/Integration/MSFT_xExchOwaVirtualDirectory.Integration.Tests.ps1 b/tests/Integration/MSFT_xExchOwaVirtualDirectory.Integration.Tests.ps1 similarity index 95% rename from Tests/Integration/MSFT_xExchOwaVirtualDirectory.Integration.Tests.ps1 rename to tests/Integration/MSFT_xExchOwaVirtualDirectory.Integration.Tests.ps1 index 86612fd0..9e0aeaf3 100644 --- a/Tests/Integration/MSFT_xExchOwaVirtualDirectory.Integration.Tests.ps1 +++ b/tests/Integration/MSFT_xExchOwaVirtualDirectory.Integration.Tests.ps1 @@ -11,9 +11,9 @@ [System.String] $script:DSCResourceFriendlyName = 'xExchOwaVirtualDirectory' [System.String] $script:DSCResourceName = "MSFT_$($script:DSCResourceFriendlyName)" -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'Tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Force -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'Modules' -ChildPath 'xExchangeHelper.psm1')) -Force -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'DSCResources' -ChildPath (Join-Path -Path "$($script:DSCResourceName)" -ChildPath "$($script:DSCResourceName).psm1"))) +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Force +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'source' -ChildPath (Join-Path -Path 'Modules' -ChildPath 'xExchangeHelper\xExchangeHelper.psd1'))) -Force +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'source' -ChildPath (Join-Path -Path 'DSCResources' -ChildPath (Join-Path -Path "$($script:DSCResourceName)" -ChildPath "$($script:DSCResourceName).psm1")))) # Check if Exchange is installed on this machine. If not, we can't run tests [System.Boolean] $exchangeInstalled = Test-ExchangeSetupComplete diff --git a/Tests/Integration/MSFT_xExchPopSettings.Integration.Tests.ps1 b/tests/Integration/MSFT_xExchPopSettings.Integration.Tests.ps1 similarity index 90% rename from Tests/Integration/MSFT_xExchPopSettings.Integration.Tests.ps1 rename to tests/Integration/MSFT_xExchPopSettings.Integration.Tests.ps1 index fa242fd5..061c7f31 100644 --- a/Tests/Integration/MSFT_xExchPopSettings.Integration.Tests.ps1 +++ b/tests/Integration/MSFT_xExchPopSettings.Integration.Tests.ps1 @@ -11,9 +11,9 @@ [System.String] $script:DSCResourceFriendlyName = 'xExchPopSettings' [System.String] $script:DSCResourceName = "MSFT_$($script:DSCResourceFriendlyName)" -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'Tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Force -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'Modules' -ChildPath 'xExchangeHelper.psm1')) -Force -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'DSCResources' -ChildPath (Join-Path -Path "$($script:DSCResourceName)" -ChildPath "$($script:DSCResourceName).psm1"))) +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Force +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'source' -ChildPath (Join-Path -Path 'Modules' -ChildPath 'xExchangeHelper\xExchangeHelper.psd1'))) -Force +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'source' -ChildPath (Join-Path -Path 'DSCResources' -ChildPath (Join-Path -Path "$($script:DSCResourceName)" -ChildPath "$($script:DSCResourceName).psm1")))) # Check if Exchange is installed on this machine. If not, we can't run tests [System.Boolean] $exchangeInstalled = Test-ExchangeSetupComplete diff --git a/Tests/Integration/MSFT_xExchPowershellVirtualDirectory.Integration.Tests.ps1 b/tests/Integration/MSFT_xExchPowershellVirtualDirectory.Integration.Tests.ps1 similarity index 88% rename from Tests/Integration/MSFT_xExchPowershellVirtualDirectory.Integration.Tests.ps1 rename to tests/Integration/MSFT_xExchPowershellVirtualDirectory.Integration.Tests.ps1 index 38e445db..8a66f38b 100644 --- a/Tests/Integration/MSFT_xExchPowershellVirtualDirectory.Integration.Tests.ps1 +++ b/tests/Integration/MSFT_xExchPowershellVirtualDirectory.Integration.Tests.ps1 @@ -11,9 +11,9 @@ [System.String] $script:DSCResourceFriendlyName = 'xExchPowershellVirtualDirectory' [System.String] $script:DSCResourceName = "MSFT_$($script:DSCResourceFriendlyName)" -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'Tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Force -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'Modules' -ChildPath 'xExchangeHelper.psm1')) -Force -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'DSCResources' -ChildPath (Join-Path -Path "$($script:DSCResourceName)" -ChildPath "$($script:DSCResourceName).psm1"))) +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Force +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'source' -ChildPath (Join-Path -Path 'Modules' -ChildPath 'xExchangeHelper\xExchangeHelper.psd1'))) -Force +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'source' -ChildPath (Join-Path -Path 'DSCResources' -ChildPath (Join-Path -Path "$($script:DSCResourceName)" -ChildPath "$($script:DSCResourceName).psm1")))) # Check if Exchange is installed on this machine. If not, we can't run tests [System.Boolean] $exchangeInstalled = Test-ExchangeSetupComplete diff --git a/Tests/Integration/MSFT_xExchReceiveConnector.Integration.Tests.ps1 b/tests/Integration/MSFT_xExchReceiveConnector.Integration.Tests.ps1 similarity index 96% rename from Tests/Integration/MSFT_xExchReceiveConnector.Integration.Tests.ps1 rename to tests/Integration/MSFT_xExchReceiveConnector.Integration.Tests.ps1 index f0408510..ff714447 100644 --- a/Tests/Integration/MSFT_xExchReceiveConnector.Integration.Tests.ps1 +++ b/tests/Integration/MSFT_xExchReceiveConnector.Integration.Tests.ps1 @@ -11,9 +11,9 @@ [System.String] $script:DSCResourceFriendlyName = 'xExchReceiveConnector' [System.String] $script:DSCResourceName = "MSFT_$($script:DSCResourceFriendlyName)" -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'Tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Force -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'Modules' -ChildPath 'xExchangeHelper.psm1')) -Force -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'DSCResources' -ChildPath (Join-Path -Path "$($script:DSCResourceName)" -ChildPath "$($script:DSCResourceName).psm1"))) +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Force +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'source' -ChildPath (Join-Path -Path 'Modules' -ChildPath 'xExchangeHelper\xExchangeHelper.psd1'))) -Force +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'source' -ChildPath (Join-Path -Path 'DSCResources' -ChildPath (Join-Path -Path "$($script:DSCResourceName)" -ChildPath "$($script:DSCResourceName).psm1")))) # Check if Exchange is installed on this machine. If not, we can't run tests [System.Boolean] $exchangeInstalled = Test-ExchangeSetupComplete diff --git a/Tests/Integration/MSFT_xExchTransportService.Integration.Tests.ps1 b/tests/Integration/MSFT_xExchTransportService.Integration.Tests.ps1 similarity index 97% rename from Tests/Integration/MSFT_xExchTransportService.Integration.Tests.ps1 rename to tests/Integration/MSFT_xExchTransportService.Integration.Tests.ps1 index 67c31c58..7454576d 100644 --- a/Tests/Integration/MSFT_xExchTransportService.Integration.Tests.ps1 +++ b/tests/Integration/MSFT_xExchTransportService.Integration.Tests.ps1 @@ -11,9 +11,9 @@ [System.String] $script:DSCResourceFriendlyName = 'xExchTransportService' [System.String] $script:DSCResourceName = "MSFT_$($script:DSCResourceFriendlyName)" -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'Tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Force -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'Modules' -ChildPath 'xExchangeHelper.psm1')) -Force -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'DSCResources' -ChildPath (Join-Path -Path "$($script:DSCResourceName)" -ChildPath "$($script:DSCResourceName).psm1"))) +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Force +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'source' -ChildPath (Join-Path -Path 'Modules' -ChildPath 'xExchangeHelper\xExchangeHelper.psd1'))) -Force +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'source' -ChildPath (Join-Path -Path 'DSCResources' -ChildPath (Join-Path -Path "$($script:DSCResourceName)" -ChildPath "$($script:DSCResourceName).psm1")))) # Check if Exchange is installed on this machine. If not, we can't run tests [System.Boolean] $exchangeInstalled = Test-ExchangeSetupComplete diff --git a/Tests/Integration/MSFT_xExchUMCallRouterSettings.Integration.Tests.ps1 b/tests/Integration/MSFT_xExchUMCallRouterSettings.Integration.Tests.ps1 similarity index 85% rename from Tests/Integration/MSFT_xExchUMCallRouterSettings.Integration.Tests.ps1 rename to tests/Integration/MSFT_xExchUMCallRouterSettings.Integration.Tests.ps1 index 2a309985..503ea8aa 100644 --- a/Tests/Integration/MSFT_xExchUMCallRouterSettings.Integration.Tests.ps1 +++ b/tests/Integration/MSFT_xExchUMCallRouterSettings.Integration.Tests.ps1 @@ -11,9 +11,9 @@ [System.String] $script:DSCResourceFriendlyName = 'xExchUMCallRouterSettings' [System.String] $script:DSCResourceName = "MSFT_$($script:DSCResourceFriendlyName)" -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'Tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Force -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'Modules' -ChildPath 'xExchangeHelper.psm1')) -Force -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'DSCResources' -ChildPath (Join-Path -Path "$($script:DSCResourceName)" -ChildPath "$($script:DSCResourceName).psm1"))) +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Force +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'source' -ChildPath (Join-Path -Path 'Modules' -ChildPath 'xExchangeHelper\xExchangeHelper.psd1'))) -Force +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'source' -ChildPath (Join-Path -Path 'DSCResources' -ChildPath (Join-Path -Path "$($script:DSCResourceName)" -ChildPath "$($script:DSCResourceName).psm1")))) # Check if Exchange is installed on this machine. If not, we can't run tests [System.Boolean] $exchangeInstalled = Test-ExchangeSetupComplete diff --git a/Tests/Integration/MSFT_xExchUMService.Integration.Tests.ps1 b/tests/Integration/MSFT_xExchUMService.Integration.Tests.ps1 similarity index 90% rename from Tests/Integration/MSFT_xExchUMService.Integration.Tests.ps1 rename to tests/Integration/MSFT_xExchUMService.Integration.Tests.ps1 index 0ea02e00..28ccc690 100644 --- a/Tests/Integration/MSFT_xExchUMService.Integration.Tests.ps1 +++ b/tests/Integration/MSFT_xExchUMService.Integration.Tests.ps1 @@ -11,9 +11,9 @@ [System.String] $script:DSCResourceFriendlyName = 'xExchUMService' [System.String] $script:DSCResourceName = "MSFT_$($script:DSCResourceFriendlyName)" -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'Tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Force -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'Modules' -ChildPath 'xExchangeHelper.psm1')) -Force -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'DSCResources' -ChildPath (Join-Path -Path "$($script:DSCResourceName)" -ChildPath "$($script:DSCResourceName).psm1"))) +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Force +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'source' -ChildPath (Join-Path -Path 'Modules' -ChildPath 'xExchangeHelper\xExchangeHelper.psd1'))) -Force +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'source' -ChildPath (Join-Path -Path 'DSCResources' -ChildPath (Join-Path -Path "$($script:DSCResourceName)" -ChildPath "$($script:DSCResourceName).psm1")))) # Check if Exchange is installed on this machine. If not, we can't run tests [System.Boolean] $exchangeInstalled = Test-ExchangeSetupComplete diff --git a/Tests/Integration/MSFT_xExchWebServicesVirtualDirectory.Integration.Tests.ps1 b/tests/Integration/MSFT_xExchWebServicesVirtualDirectory.Integration.Tests.ps1 similarity index 94% rename from Tests/Integration/MSFT_xExchWebServicesVirtualDirectory.Integration.Tests.ps1 rename to tests/Integration/MSFT_xExchWebServicesVirtualDirectory.Integration.Tests.ps1 index 14692d91..cca8adc4 100644 --- a/Tests/Integration/MSFT_xExchWebServicesVirtualDirectory.Integration.Tests.ps1 +++ b/tests/Integration/MSFT_xExchWebServicesVirtualDirectory.Integration.Tests.ps1 @@ -11,9 +11,9 @@ [System.String] $script:DSCResourceFriendlyName = 'xExchWebServicesVirtualDirectory' [System.String] $script:DSCResourceName = "MSFT_$($script:DSCResourceFriendlyName)" -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'Tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Force -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'Modules' -ChildPath 'xExchangeHelper.psm1')) -Force -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'DSCResources' -ChildPath (Join-Path -Path "$($script:DSCResourceName)" -ChildPath "$($script:DSCResourceName).psm1"))) +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Force +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'source' -ChildPath (Join-Path -Path 'Modules' -ChildPath 'xExchangeHelper\xExchangeHelper.psd1'))) -Force +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'source' -ChildPath (Join-Path -Path 'DSCResources' -ChildPath (Join-Path -Path "$($script:DSCResourceName)" -ChildPath "$($script:DSCResourceName).psm1")))) # Check if Exchange is installed on this machine. If not, we can't run tests [System.Boolean] $exchangeInstalled = Test-ExchangeSetupComplete diff --git a/Tests/Integration/xExchangeCommon.Integration.Tests.ps1 b/tests/Integration/xExchangeCommon.Integration.Tests.ps1 similarity index 97% rename from Tests/Integration/xExchangeCommon.Integration.Tests.ps1 rename to tests/Integration/xExchangeCommon.Integration.Tests.ps1 index a4473039..ba0f15b1 100644 --- a/Tests/Integration/xExchangeCommon.Integration.Tests.ps1 +++ b/tests/Integration/xExchangeCommon.Integration.Tests.ps1 @@ -4,11 +4,10 @@ This test module requires use of credentials. The first run through of the tests will prompt for credentials from the logged on user. #> - $script:moduleRoot = Split-Path -Parent (Split-Path -Parent $PSScriptRoot) -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'Tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Force -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'Modules' -ChildPath 'xExchangeHelper.psm1')) -Force +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Force +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'source' -ChildPath (Join-Path -Path 'Modules' -ChildPath 'xExchangeHelper\xExchangeHelper.psd1'))) -Force <# .SYNOPSIS @@ -116,7 +115,7 @@ if ($exchangeInstalled) throw 'Failed to retrieve ADObjectID for test mailbox' } - $testMailboxSecondaryAddress = ($testMailbox.EmailAddresses | Where-Object {$_.IsPrimaryAddress -eq $false -and $_.Prefix -like 'SMTP'} | Select-Object -First 1).AddressString + $testMailboxSecondaryAddress = ($testMailbox.EmailAddresses | Where-Object { $_.IsPrimaryAddress -eq $false -and $_.Prefix -like 'SMTP' } | Select-Object -First 1).AddressString if ([String]::IsNullOrEmpty($testMailboxSecondaryAddress)) { diff --git a/Tests/TestHelpers/xExchangeTestHelper.psm1 b/tests/TestHelpers/xExchangeTestHelper.psm1 similarity index 93% rename from Tests/TestHelpers/xExchangeTestHelper.psm1 rename to tests/TestHelpers/xExchangeTestHelper.psm1 index 454b3bd3..95353d6d 100644 --- a/Tests/TestHelpers/xExchangeTestHelper.psm1 +++ b/tests/TestHelpers/xExchangeTestHelper.psm1 @@ -43,7 +43,7 @@ function Test-TargetResourceFunctionality Context $ContextLabel { $addedVerbose = $false - if ($null -eq ($Params.Keys | Where-Object -FilterScript {$_ -like 'Verbose'})) + if ($null -eq ($Params.Keys | Where-Object -FilterScript { $_ -like 'Verbose' })) { $Params.Add('Verbose', $true) $addedVerbose = $true @@ -173,7 +173,7 @@ function Test-CommonGetTargetResourceFunctionality if ($getTargetResourceCommand.Count -eq 1) { - foreach ($getTargetResourceParam in $getTargetResourceCommand.Parameters.Keys | Where-Object -FilterScript {$GetResult.ContainsKey($_)}) + foreach ($getTargetResourceParam in $getTargetResourceCommand.Parameters.Keys | Where-Object -FilterScript { $GetResult.ContainsKey($_) }) { $getResultMemberType = '$null' @@ -316,11 +316,11 @@ function Initialize-TestForDAG Write-Verbose -Message 'Cleaning up test DAG and related resources' - Get-RemoteExchangeSession -Credential $ShellCredentials -CommandsToLoad '*-MailboxDatabase',` - '*-DatabaseAvailabilityGroup',` - 'Remove-DatabaseAvailabilityGroupServer',` - 'Get-MailboxDatabaseCopyStatus',` - 'Remove-MailboxDatabaseCopy' + Get-RemoteExchangeSession -Credential $ShellCredentials -CommandsToLoad '*-MailboxDatabase', ` + '*-DatabaseAvailabilityGroup', ` + 'Remove-DatabaseAvailabilityGroupServer', ` + 'Get-MailboxDatabaseCopyStatus', ` + 'Remove-MailboxDatabaseCopy' $existingDB = Get-MailboxDatabase -Identity "$($DatabaseName)" -Status -ErrorAction SilentlyContinue @@ -423,7 +423,7 @@ function Remove-TestDatabase foreach ($server in $ServerName) { Get-ChildItem -LiteralPath "\\$($server)\c`$\Program Files\Microsoft\Exchange Server\V15\Mailbox\$($DatabaseName)" ` - -ErrorAction SilentlyContinue | Remove-Item -Recurse -Force -Confirm:$false -ErrorAction SilentlyContinue + -ErrorAction SilentlyContinue | Remove-Item -Recurse -Force -Confirm:$false -ErrorAction SilentlyContinue } } @@ -510,7 +510,7 @@ function Get-DSCTestMailbox if ($dbsOnServer.Count -gt 0) { - $newMailboxParams.Add('Database',$dbsOnServer[0].Name) + $newMailboxParams.Add('Database', $dbsOnServer[0].Name) } $testMailbox = New-Mailbox @newMailboxParams @@ -532,11 +532,11 @@ function Get-DSCTestMailbox } # Add the secondary SMTP if necessary - if (($testMailbox.EmailAddresses | Where-Object {$_.AddressString -like $secondarySMTP}).Count -eq 0) + if (($testMailbox.EmailAddresses | Where-Object { $_.AddressString -like $secondarySMTP }).Count -eq 0) { Write-Verbose -Message "Adding secondary SMTP on test mailbox: $testMailboxName" - $testMailbox | Set-Mailbox -EmailAddresses @{add=$secondarySMTP} + $testMailbox | Set-Mailbox -EmailAddresses @{add = $secondarySMTP } $changedMailbox = $true } @@ -683,4 +683,36 @@ function Get-TestDomainController return $dcToTestAgainst } +function Invoke-TestSetup +{ + [CmdletBinding()] + param ( + [Parameter()] + [System.String] + $DSCModuleName, + + [Parameter()] + [System.String] + $DSCResourceName + ) + try + { + Import-Module -Name DscResource.Test -Force + } + catch [System.IO.FileNotFoundException] + { + throw 'DscResource.Test module dependency not found. Please run ".\build.ps1 -Tasks build" first.' + } + + $splat = @{ + DSCModuleName = $DSCModuleName + DscResource = $DSCResourceName + ResourceType = 'Mof' + TestType = 'Unit' + } + + Initialize-TestEnvironment @splat +} + Export-ModuleMember -Function * + diff --git a/Tests/Unit/MSFT_xExchAcceptedDomain.tests.ps1 b/tests/Unit/MSFT_xExchAcceptedDomain.tests.ps1 similarity index 92% rename from Tests/Unit/MSFT_xExchAcceptedDomain.tests.ps1 rename to tests/Unit/MSFT_xExchAcceptedDomain.tests.ps1 index 4ad5f1e2..2c50c0c9 100644 --- a/Tests/Unit/MSFT_xExchAcceptedDomain.tests.ps1 +++ b/tests/Unit/MSFT_xExchAcceptedDomain.tests.ps1 @@ -1,41 +1,18 @@ -#region HEADER $script:DSCModuleName = 'xExchange' $script:DSCResourceName = 'MSFT_xExchAcceptedDomain' - -# Unit Test Template Version: 1.2.4 $script:moduleRoot = Split-Path -Parent (Split-Path -Parent $PSScriptRoot) -if ( (-not (Test-Path -Path (Join-Path -Path $script:moduleRoot -ChildPath 'DSCResource.Tests'))) -or ` - (-not (Test-Path -Path (Join-Path -Path $script:moduleRoot -ChildPath 'DSCResource.Tests\TestHelper.psm1'))) ) -{ - & git.exe @('clone', 'https://github.com/PowerShell/DscResource.Tests.git', (Join-Path -Path $script:moduleRoot -ChildPath 'DscResource.Tests')) -} - -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'DSCResource.Tests' -ChildPath 'TestHelper.psm1')) -Force -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'Tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Global -Force - -$TestEnvironment = Initialize-TestEnvironment ` - -DSCModuleName $script:DSCModuleName ` - -DSCResourceName $script:DSCResourceName ` - -ResourceType 'Mof' ` - -TestType Unit -#endregion HEADER +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Global -Force -function Invoke-TestSetup -{ - -} +$script:testEnvironment = Invoke-TestSetup -DSCModuleName $script:dscModuleName -DSCResourceName $script:dscResourceName function Invoke-TestCleanup { - Restore-TestEnvironment -TestEnvironment $TestEnvironment + Restore-TestEnvironment -TestEnvironment $script:testEnvironment } - # Begin Testing try { - Invoke-TestSetup - InModuleScope $script:DSCResourceName { function New-AcceptedDomain diff --git a/Tests/Unit/MSFT_xExchActiveSyncVirtualDirectory.tests.ps1 b/tests/Unit/MSFT_xExchActiveSyncVirtualDirectory.tests.ps1 similarity index 78% rename from Tests/Unit/MSFT_xExchActiveSyncVirtualDirectory.tests.ps1 rename to tests/Unit/MSFT_xExchActiveSyncVirtualDirectory.tests.ps1 index 7d9aecd4..3749174e 100644 --- a/Tests/Unit/MSFT_xExchActiveSyncVirtualDirectory.tests.ps1 +++ b/tests/Unit/MSFT_xExchActiveSyncVirtualDirectory.tests.ps1 @@ -1,41 +1,19 @@ -#region HEADER $script:DSCModuleName = 'xExchange' $script:DSCResourceName = 'MSFT_xExchActiveSyncVirtualDirectory' - -# Unit Test Template Version: 1.2.4 $script:moduleRoot = Split-Path -Parent (Split-Path -Parent $PSScriptRoot) -if ( (-not (Test-Path -Path (Join-Path -Path $script:moduleRoot -ChildPath 'DSCResource.Tests'))) -or ` - (-not (Test-Path -Path (Join-Path -Path $script:moduleRoot -ChildPath 'DSCResource.Tests\TestHelper.psm1'))) ) -{ - & git @('clone', 'https://github.com/PowerShell/DscResource.Tests.git', (Join-Path -Path $script:moduleRoot -ChildPath 'DscResource.Tests')) -} - -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'DSCResource.Tests' -ChildPath 'TestHelper.psm1')) -Force -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'Tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Global -Force - -$TestEnvironment = Initialize-TestEnvironment ` - -DSCModuleName $script:DSCModuleName ` - -DSCResourceName $script:DSCResourceName ` - -ResourceType 'Mof' ` - -TestType Unit -#endregion HEADER +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Global -Force -function Invoke-TestSetup -{ - -} +$script:testEnvironment = Invoke-TestSetup -DSCModuleName $script:dscModuleName -DSCResourceName $script:dscResourceName function Invoke-TestCleanup { - Restore-TestEnvironment -TestEnvironment $TestEnvironment + Restore-TestEnvironment -TestEnvironment $script:testEnvironment } # Begin Testing try { - Invoke-TestSetup - InModuleScope $script:DSCResourceName { Describe 'MSFT_xExchActiveSyncVirtualDirectory\Get-TargetResource' -Tag 'Get' { AfterEach { @@ -87,3 +65,4 @@ finally { Invoke-TestCleanup } + diff --git a/Tests/Unit/MSFT_xExchAddressList.tests.ps1 b/tests/Unit/MSFT_xExchAddressList.tests.ps1 similarity index 93% rename from Tests/Unit/MSFT_xExchAddressList.tests.ps1 rename to tests/Unit/MSFT_xExchAddressList.tests.ps1 index 44244622..f61d6734 100644 --- a/Tests/Unit/MSFT_xExchAddressList.tests.ps1 +++ b/tests/Unit/MSFT_xExchAddressList.tests.ps1 @@ -1,41 +1,19 @@ -#region HEADER $script:DSCModuleName = 'xExchange' $script:DSCResourceName = 'MSFT_xExchAddressList' - -# Unit Test Template Version: 1.2.4 $script:moduleRoot = Split-Path -Parent (Split-Path -Parent $PSScriptRoot) -if ( (-not (Test-Path -Path (Join-Path -Path $script:moduleRoot -ChildPath 'DSCResource.Tests'))) -or ` - (-not (Test-Path -Path (Join-Path -Path $script:moduleRoot -ChildPath 'DSCResource.Tests\TestHelper.psm1'))) ) -{ - & git.exe @('clone', 'https://github.com/PowerShell/DscResource.Tests.git', (Join-Path -Path $script:moduleRoot -ChildPath 'DscResource.Tests')) -} - -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'DSCResource.Tests' -ChildPath 'TestHelper.psm1')) -Force -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'Tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Global -Force - -$TestEnvironment = Initialize-TestEnvironment ` - -DSCModuleName $script:DSCModuleName ` - -DSCResourceName $script:DSCResourceName ` - -ResourceType 'Mof' ` - -TestType Unit -#endregion HEADER +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Global -Force -function Invoke-TestSetup -{ - -} +$script:testEnvironment = Invoke-TestSetup -DSCModuleName $script:dscModuleName -DSCResourceName $script:dscResourceName function Invoke-TestCleanup { - Restore-TestEnvironment -TestEnvironment $TestEnvironment + Restore-TestEnvironment -TestEnvironment $script:testEnvironment } # Begin Testing try { - Invoke-TestSetup - InModuleScope $script:DSCResourceName { function Remove-AddressList { @@ -317,3 +295,4 @@ finally { Invoke-TestCleanup } + diff --git a/Tests/Unit/MSFT_xExchAntiMalwareScanning.tests.ps1 b/tests/Unit/MSFT_xExchAntiMalwareScanning.tests.ps1 similarity index 82% rename from Tests/Unit/MSFT_xExchAntiMalwareScanning.tests.ps1 rename to tests/Unit/MSFT_xExchAntiMalwareScanning.tests.ps1 index bd0e9f2e..86baa65a 100644 --- a/Tests/Unit/MSFT_xExchAntiMalwareScanning.tests.ps1 +++ b/tests/Unit/MSFT_xExchAntiMalwareScanning.tests.ps1 @@ -1,50 +1,30 @@ -#region HEADER $script:DSCModuleName = 'xExchange' $script:DSCResourceName = 'MSFT_xExchAntiMalwareScanning' - -# Unit Test Template Version: 1.2.3 $script:moduleRoot = Split-Path -Parent (Split-Path -Parent $PSScriptRoot) -if ( (-not (Test-Path -Path (Join-Path -Path $script:moduleRoot -ChildPath 'DSCResource.Tests'))) -or ` - (-not (Test-Path -Path (Join-Path -Path $script:moduleRoot -ChildPath 'DSCResource.Tests\TestHelper.psm1'))) ) -{ - & git @('clone', 'https://github.com/PowerShell/DscResource.Tests.git', (Join-Path -Path $script:moduleRoot -ChildPath 'DSCResource.Tests')) -} -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'DSCResource.Tests' -ChildPath 'TestHelper.psm1')) -Force -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'Tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Global -Force +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Global -Force -$TestEnvironment = Initialize-TestEnvironment ` - -DSCModuleName $script:DSCModuleName ` - -DSCResourceName $script:DSCResourceName ` - -ResourceType 'Mof' ` - -TestType Unit - -#endregion HEADER - -function Invoke-TestSetup -{ - -} +$script:testEnvironment = Invoke-TestSetup -DSCModuleName $script:dscModuleName -DSCResourceName $script:dscResourceName function Invoke-TestCleanup { - Restore-TestEnvironment -TestEnvironment $TestEnvironment + Restore-TestEnvironment -TestEnvironment $script:testEnvironment } # Begin Testing try { - Invoke-TestSetup - InModuleScope $script:DSCResourceName { <# Define an empty function for Get-TransportAgent, so pester has something to Mock This cmdlet is normally loaded as part of Get-RemoteExchangeSession. #> - function Get-TransportAgent {} + function Get-TransportAgent + { + } - $fakeCredentials = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList 'fakeuser', (New-Object -TypeName System.Security.SecureString) - $mockEnableScriptPath = 'C:\Program Files\Microsoft\Exchange Server\V15\Scripts\Enable-AntimalwareScanning.ps1' + $fakeCredentials = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList 'fakeuser', (New-Object -TypeName System.Security.SecureString) + $mockEnableScriptPath = 'C:\Program Files\Microsoft\Exchange Server\V15\Scripts\Enable-AntimalwareScanning.ps1' $mockDisableScriptPath = 'C:\Program Files\Microsoft\Exchange Server\V15\Scripts\Disable-AntimalwareScanning.ps1' Describe 'MSFT_xExchAntiMalwareScanning\Get-TargetResource' -Tag 'Get' { @@ -101,7 +81,7 @@ try MsiInstallPath = 'C:\Program Files\Microsoft\Exchange Server\V15\' } } - Mock -CommandName Invoke-DotSourcedScript -Verifiable -ParameterFilter {$ScriptPath -eq $mockEnableScriptPath -and $ScriptParams.Count -eq 0} + Mock -CommandName Invoke-DotSourcedScript -Verifiable -ParameterFilter { $ScriptPath -eq $mockEnableScriptPath -and $ScriptParams.Count -eq 0 } Set-TargetResource -Enabled $true -Credential $fakeCredentials -AllowServiceRestart $false } @@ -114,7 +94,7 @@ try MsiInstallPath = 'C:\Program Files\Microsoft\Exchange Server\V15\' } } - Mock -CommandName Invoke-DotSourcedScript -Verifiable -ParameterFilter {$ScriptPath -eq $mockEnableScriptPath -and $ScriptParams.ContainsKey('ForceRestart') -and $ScriptParams.ForceRestart -eq $true} + Mock -CommandName Invoke-DotSourcedScript -Verifiable -ParameterFilter { $ScriptPath -eq $mockEnableScriptPath -and $ScriptParams.ContainsKey('ForceRestart') -and $ScriptParams.ForceRestart -eq $true } Set-TargetResource -Enabled $true -Credential $fakeCredentials -AllowServiceRestart $true } @@ -128,7 +108,7 @@ try MsiInstallPath = 'C:\Program Files\Microsoft\Exchange Server\V15\' } } - Mock -CommandName Invoke-DotSourcedScript -Verifiable -ParameterFilter {$ScriptPath -eq $mockDisableScriptPath -and $ScriptParams.Count -eq 0} + Mock -CommandName Invoke-DotSourcedScript -Verifiable -ParameterFilter { $ScriptPath -eq $mockDisableScriptPath -and $ScriptParams.Count -eq 0 } Set-TargetResource -Enabled $false -Credential $fakeCredentials -AllowServiceRestart $false } @@ -141,7 +121,7 @@ try MsiInstallPath = 'C:\Program Files\Microsoft\Exchange Server\V15\' } } - Mock -CommandName Invoke-DotSourcedScript -Verifiable -ParameterFilter {$ScriptPath -eq $mockDisableScriptPath -and $ScriptParams.ContainsKey('ForceRestart') -and $ScriptParams.ForceRestart -eq $true} + Mock -CommandName Invoke-DotSourcedScript -Verifiable -ParameterFilter { $ScriptPath -eq $mockDisableScriptPath -and $ScriptParams.ContainsKey('ForceRestart') -and $ScriptParams.ForceRestart -eq $true } Set-TargetResource -Enabled $false -Credential $fakeCredentials -AllowServiceRestart $true } @@ -212,7 +192,7 @@ try Context 'When Get-TransportAgent does not return an agent status' { It 'Should return False' { Mock -CommandName Get-RemoteExchangeSession -Verifiable -MockWith { return $null } - Mock -CommandName Get-TransportAgent -Verifiable -MockWith { return $null} + Mock -CommandName Get-TransportAgent -Verifiable -MockWith { return $null } $testResults = Test-TargetResource -Enabled $false -Credential $fakeCredentials @@ -226,3 +206,4 @@ finally { Invoke-TestCleanup } + diff --git a/Tests/Unit/MSFT_xExchAutoMountPoint.tests.ps1 b/tests/Unit/MSFT_xExchAutoMountPoint.tests.ps1 similarity index 59% rename from Tests/Unit/MSFT_xExchAutoMountPoint.tests.ps1 rename to tests/Unit/MSFT_xExchAutoMountPoint.tests.ps1 index 6543c0cd..460c3782 100644 --- a/Tests/Unit/MSFT_xExchAutoMountPoint.tests.ps1 +++ b/tests/Unit/MSFT_xExchAutoMountPoint.tests.ps1 @@ -1,42 +1,24 @@ -#region HEADER $script:DSCModuleName = 'xExchange' $script:DSCResourceName = 'MSFT_xExchAutoMountPoint' - -# Unit Test Template Version: 1.2.4 $script:moduleRoot = Split-Path -Parent (Split-Path -Parent $PSScriptRoot) -if ( (-not (Test-Path -Path (Join-Path -Path $script:moduleRoot -ChildPath 'DSCResource.Tests'))) -or ` - (-not (Test-Path -Path (Join-Path -Path $script:moduleRoot -ChildPath 'DSCResource.Tests\TestHelper.psm1'))) ) -{ - & git @('clone', 'https://github.com/PowerShell/DscResource.Tests.git', (Join-Path -Path $script:moduleRoot -ChildPath 'DscResource.Tests')) -} - -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'DSCResource.Tests' -ChildPath 'TestHelper.psm1')) -Force -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'Tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Global -Force - -$TestEnvironment = Initialize-TestEnvironment ` - -DSCModuleName $script:DSCModuleName ` - -DSCResourceName $script:DSCResourceName ` - -ResourceType 'Mof' ` - -TestType Unit - -#endregion HEADER -function Invoke-TestSetup -{ +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Global -Force -} +$script:testEnvironment = Invoke-TestSetup -DSCModuleName $script:dscModuleName -DSCResourceName $script:dscResourceName function Invoke-TestCleanup { - Restore-TestEnvironment -TestEnvironment $TestEnvironment + Restore-TestEnvironment -TestEnvironment $script:testEnvironment } # Begin Testing try { - Invoke-TestSetup - InModuleScope $script:DSCResourceName { + function Get-DiskInfo + { + + } Describe 'MSFT_xExchAutoMountPoint\Get-TargetResource' -Tag 'Get' { AfterEach { Assert-VerifiableMock @@ -52,7 +34,7 @@ try Context 'When Get-TargetResource is called' { Mock -CommandName Write-FunctionEntry -Verifiable - Mock -CommandName Get-DiskInfo -Verifiable -MockWith { return @{} } + Mock -CommandName Get-DiskInfo -Verifiable -MockWith { return @{ } } Mock -CommandName Get-DiskToDBMap -Verifiable -MockWith { return $getTargetResourceParams.DiskToDBMap } Test-CommonGetTargetResourceFunctionality -GetTargetResourceParams $getTargetResourceParams @@ -64,3 +46,4 @@ finally { Invoke-TestCleanup } + diff --git a/Tests/Unit/MSFT_xExchAutodiscoverVirtualDirectory.tests.ps1 b/tests/Unit/MSFT_xExchAutodiscoverVirtualDirectory.tests.ps1 similarity index 82% rename from Tests/Unit/MSFT_xExchAutodiscoverVirtualDirectory.tests.ps1 rename to tests/Unit/MSFT_xExchAutodiscoverVirtualDirectory.tests.ps1 index d4e15579..38e76fe3 100644 --- a/Tests/Unit/MSFT_xExchAutodiscoverVirtualDirectory.tests.ps1 +++ b/tests/Unit/MSFT_xExchAutodiscoverVirtualDirectory.tests.ps1 @@ -1,41 +1,19 @@ -#region HEADER $script:DSCModuleName = 'xExchange' $script:DSCResourceName = 'MSFT_xExchAutodiscoverVirtualDirectory' - -# Unit Test Template Version: 1.2.4 $script:moduleRoot = Split-Path -Parent (Split-Path -Parent $PSScriptRoot) -if ( (-not (Test-Path -Path (Join-Path -Path $script:moduleRoot -ChildPath 'DSCResource.Tests'))) -or ` - (-not (Test-Path -Path (Join-Path -Path $script:moduleRoot -ChildPath 'DSCResource.Tests\TestHelper.psm1'))) ) -{ - & git @('clone', 'https://github.com/PowerShell/DscResource.Tests.git', (Join-Path -Path $script:moduleRoot -ChildPath 'DscResource.Tests')) -} - -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'DSCResource.Tests' -ChildPath 'TestHelper.psm1')) -Force -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'Tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Global -Force - -$TestEnvironment = Initialize-TestEnvironment ` - -DSCModuleName $script:DSCModuleName ` - -DSCResourceName $script:DSCResourceName ` - -ResourceType 'Mof' ` - -TestType Unit -#endregion HEADER +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Global -Force -function Invoke-TestSetup -{ - -} +$script:testEnvironment = Invoke-TestSetup -DSCModuleName $script:dscModuleName -DSCResourceName $script:dscResourceName function Invoke-TestCleanup { - Restore-TestEnvironment -TestEnvironment $TestEnvironment + Restore-TestEnvironment -TestEnvironment $script:testEnvironment } # Begin Testing try { - Invoke-TestSetup - InModuleScope $script:DSCResourceName { Mock -CommandName Write-FunctionEntry -Verifiable @@ -74,12 +52,14 @@ try } Context 'When Set-TargetResource is called' { - function Set-AutodiscoverVirtualDirectory { } + function Set-AutodiscoverVirtualDirectory + { + } Mock -CommandName Get-RemoteExchangeSession -Verifiable It 'Should warn about restarting the MSExchangeAutodiscoverAppPool' { Mock -CommandName Set-AutodiscoverVirtualDirectory -Verifiable - Mock -CommandName Write-Warning -ParameterFilter {$Message -eq 'The configuration will not take effect until MSExchangeAutodiscoverAppPool is manually recycled.'} + Mock -CommandName Write-Warning -ParameterFilter { $Message -eq 'The configuration will not take effect until MSExchangeAutodiscoverAppPool is manually recycled.' } Set-TargetResource @commonTargetResourceParams } @@ -138,7 +118,9 @@ try Context 'When Get-AutodiscoverVirtualDirectoryInternal is called' { It 'Should call the expected functions' { - function Get-AutodiscoverVirtualDirectory { } + function Get-AutodiscoverVirtualDirectory + { + } Mock -CommandName Get-AutodiscoverVirtualDirectory -Verifiable -MockWith { return $commonAutodiscoverVirtualDirectoryInternalStandardOutput } Get-AutodiscoverVirtualDirectoryInternal @commonTargetResourceParams diff --git a/Tests/Unit/MSFT_xExchClientAccessServer.tests.ps1 b/tests/Unit/MSFT_xExchClientAccessServer.tests.ps1 similarity index 74% rename from Tests/Unit/MSFT_xExchClientAccessServer.tests.ps1 rename to tests/Unit/MSFT_xExchClientAccessServer.tests.ps1 index 87e68962..dfac0954 100644 --- a/Tests/Unit/MSFT_xExchClientAccessServer.tests.ps1 +++ b/tests/Unit/MSFT_xExchClientAccessServer.tests.ps1 @@ -1,41 +1,19 @@ -#region HEADER $script:DSCModuleName = 'xExchange' $script:DSCResourceName = 'MSFT_xExchClientAccessServer' - -# Unit Test Template Version: 1.2.4 $script:moduleRoot = Split-Path -Parent (Split-Path -Parent $PSScriptRoot) -if ( (-not (Test-Path -Path (Join-Path -Path $script:moduleRoot -ChildPath 'DSCResource.Tests'))) -or ` - (-not (Test-Path -Path (Join-Path -Path $script:moduleRoot -ChildPath 'DSCResource.Tests\TestHelper.psm1'))) ) -{ - & git @('clone', 'https://github.com/PowerShell/DscResource.Tests.git', (Join-Path -Path $script:moduleRoot -ChildPath 'DscResource.Tests')) -} - -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'DSCResource.Tests' -ChildPath 'TestHelper.psm1')) -Force -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'Tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Global -Force - -$TestEnvironment = Initialize-TestEnvironment ` - -DSCModuleName $script:DSCModuleName ` - -DSCResourceName $script:DSCResourceName ` - -ResourceType 'Mof' ` - -TestType Unit -#endregion HEADER +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Global -Force -function Invoke-TestSetup -{ - -} +$script:testEnvironment = Invoke-TestSetup -DSCModuleName $script:dscModuleName -DSCResourceName $script:dscResourceName function Invoke-TestCleanup { - Restore-TestEnvironment -TestEnvironment $TestEnvironment + Restore-TestEnvironment -TestEnvironment $script:testEnvironment } # Begin Testing try { - Invoke-TestSetup - InModuleScope $script:DSCResourceName { Describe 'MSFT_xExchClientAccessServer\Get-TargetResource' -Tag 'Get' { AfterEach { @@ -74,12 +52,12 @@ try Context 'When AutoDiscoverSiteScope is not null' { It 'Should try to convert AutoDiscoverSiteScope to an array' { - $siteScopeOut = @('Site1','Site2') + $siteScopeOut = @('Site1', 'Site2') Mock -CommandName Get-ClientAccessServerInternal -Verifiable -MockWith { $siteScopeVar = New-Object -TypeName PSObject - Add-Member -MemberType ScriptMethod -InputObject $siteScopeVar -Name 'ToArray' -Value { return @('Site1','Site2') } + Add-Member -MemberType ScriptMethod -InputObject $siteScopeVar -Name 'ToArray' -Value { return @('Site1', 'Site2') } return @{ AutoDiscoverSiteScope = $siteScopeVar @@ -98,3 +76,4 @@ finally { Invoke-TestCleanup } + diff --git a/Tests/Unit/MSFT_xExchDatabaseAvailabilityGroup.tests.ps1 b/tests/Unit/MSFT_xExchDatabaseAvailabilityGroup.tests.ps1 similarity index 77% rename from Tests/Unit/MSFT_xExchDatabaseAvailabilityGroup.tests.ps1 rename to tests/Unit/MSFT_xExchDatabaseAvailabilityGroup.tests.ps1 index 244e8378..38dfe8bf 100644 --- a/Tests/Unit/MSFT_xExchDatabaseAvailabilityGroup.tests.ps1 +++ b/tests/Unit/MSFT_xExchDatabaseAvailabilityGroup.tests.ps1 @@ -1,41 +1,19 @@ -#region HEADER $script:DSCModuleName = 'xExchange' $script:DSCResourceName = 'MSFT_xExchDatabaseAvailabilityGroup' - -# Unit Test Template Version: 1.2.4 $script:moduleRoot = Split-Path -Parent (Split-Path -Parent $PSScriptRoot) -if ( (-not (Test-Path -Path (Join-Path -Path $script:moduleRoot -ChildPath 'DSCResource.Tests'))) -or ` - (-not (Test-Path -Path (Join-Path -Path $script:moduleRoot -ChildPath 'DSCResource.Tests\TestHelper.psm1'))) ) -{ - & git @('clone', 'https://github.com/PowerShell/DscResource.Tests.git', (Join-Path -Path $script:moduleRoot -ChildPath 'DscResource.Tests')) -} - -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'DSCResource.Tests' -ChildPath 'TestHelper.psm1')) -Force -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'Tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Global -Force - -$TestEnvironment = Initialize-TestEnvironment ` - -DSCModuleName $script:DSCModuleName ` - -DSCResourceName $script:DSCResourceName ` - -ResourceType 'Mof' ` - -TestType Unit -#endregion HEADER +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Global -Force -function Invoke-TestSetup -{ - -} +$script:testEnvironment = Invoke-TestSetup -DSCModuleName $script:dscModuleName -DSCResourceName $script:dscResourceName function Invoke-TestCleanup { - Restore-TestEnvironment -TestEnvironment $TestEnvironment + Restore-TestEnvironment -TestEnvironment $script:testEnvironment } # Begin Testing try { - Invoke-TestSetup - InModuleScope $script:DSCResourceName { Describe 'MSFT_xExchDatabaseAvailabilityGroup\Get-TargetResource' -Tag 'Get' { AfterEach { @@ -88,3 +66,4 @@ finally { Invoke-TestCleanup } + diff --git a/Tests/Unit/MSFT_xExchDatabaseAvailabilityGroupMember.tests.ps1 b/tests/Unit/MSFT_xExchDatabaseAvailabilityGroupMember.tests.ps1 similarity index 64% rename from Tests/Unit/MSFT_xExchDatabaseAvailabilityGroupMember.tests.ps1 rename to tests/Unit/MSFT_xExchDatabaseAvailabilityGroupMember.tests.ps1 index a1648ca2..95e8db28 100644 --- a/Tests/Unit/MSFT_xExchDatabaseAvailabilityGroupMember.tests.ps1 +++ b/tests/Unit/MSFT_xExchDatabaseAvailabilityGroupMember.tests.ps1 @@ -1,42 +1,20 @@ -#region HEADER $script:DSCModuleName = 'xExchange' $script:DSCResourceName = 'MSFT_xExchDatabaseAvailabilityGroupMember' - -# Unit Test Template Version: 1.2.4 $script:moduleRoot = Split-Path -Parent (Split-Path -Parent $PSScriptRoot) -if ( (-not (Test-Path -Path (Join-Path -Path $script:moduleRoot -ChildPath 'DSCResource.Tests'))) -or ` - (-not (Test-Path -Path (Join-Path -Path $script:moduleRoot -ChildPath 'DSCResource.Tests\TestHelper.psm1'))) ) -{ - & git @('clone', 'https://github.com/PowerShell/DscResource.Tests.git', (Join-Path -Path $script:moduleRoot -ChildPath 'DscResource.Tests')) -} - -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'DSCResource.Tests' -ChildPath 'TestHelper.psm1')) -Force -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'Tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Global -Force - -$TestEnvironment = Initialize-TestEnvironment ` - -DSCModuleName $script:DSCModuleName ` - -DSCResourceName $script:DSCResourceName ` - -ResourceType 'Mof' ` - -TestType Unit -#endregion HEADER +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Global -Force -function Invoke-TestSetup -{ - -} +$script:testEnvironment = Invoke-TestSetup -DSCModuleName $script:dscModuleName -DSCResourceName $script:dscResourceName function Invoke-TestCleanup { - Restore-TestEnvironment -TestEnvironment $TestEnvironment + Restore-TestEnvironment -TestEnvironment $script:testEnvironment } # Begin Testing try { - Invoke-TestSetup - - InModuleScope $script:DSCResourceName { + InModuleScope $script:DSCResourceName { Describe 'MSFT_xExchDatabaseAvailabilityGroupMember\Get-TargetResource' -Tag 'Get' { # Override Exchange cmdlets function Get-DatabaseAvailabilityGroup {} @@ -72,3 +50,4 @@ finally { Invoke-TestCleanup } + diff --git a/Tests/Unit/MSFT_xExchDatabaseAvailabilityGroupNetwork.tests.ps1 b/tests/Unit/MSFT_xExchDatabaseAvailabilityGroupNetwork.tests.ps1 similarity index 65% rename from Tests/Unit/MSFT_xExchDatabaseAvailabilityGroupNetwork.tests.ps1 rename to tests/Unit/MSFT_xExchDatabaseAvailabilityGroupNetwork.tests.ps1 index 69027819..13078d83 100644 --- a/Tests/Unit/MSFT_xExchDatabaseAvailabilityGroupNetwork.tests.ps1 +++ b/tests/Unit/MSFT_xExchDatabaseAvailabilityGroupNetwork.tests.ps1 @@ -1,42 +1,20 @@ -#region HEADER $script:DSCModuleName = 'xExchange' $script:DSCResourceName = 'MSFT_xExchDatabaseAvailabilityGroupNetwork' - -# Unit Test Template Version: 1.2.4 $script:moduleRoot = Split-Path -Parent (Split-Path -Parent $PSScriptRoot) -if ( (-not (Test-Path -Path (Join-Path -Path $script:moduleRoot -ChildPath 'DSCResource.Tests'))) -or ` - (-not (Test-Path -Path (Join-Path -Path $script:moduleRoot -ChildPath 'DSCResource.Tests\TestHelper.psm1'))) ) -{ - & git @('clone', 'https://github.com/PowerShell/DscResource.Tests.git', (Join-Path -Path $script:moduleRoot -ChildPath 'DscResource.Tests')) -} - -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'DSCResource.Tests' -ChildPath 'TestHelper.psm1')) -Force -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'Tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Global -Force - -$TestEnvironment = Initialize-TestEnvironment ` - -DSCModuleName $script:DSCModuleName ` - -DSCResourceName $script:DSCResourceName ` - -ResourceType 'Mof' ` - -TestType Unit -#endregion HEADER +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Global -Force -function Invoke-TestSetup -{ - -} +$script:testEnvironment = Invoke-TestSetup -DSCModuleName $script:dscModuleName -DSCResourceName $script:dscResourceName function Invoke-TestCleanup { - Restore-TestEnvironment -TestEnvironment $TestEnvironment + Restore-TestEnvironment -TestEnvironment $script:testEnvironment } # Begin Testing try { - Invoke-TestSetup - - InModuleScope $script:DSCResourceName { + InModuleScope $script:DSCResourceName { Describe 'MSFT_xExchDatabaseAvailabilityGroupNetwork\Get-TargetResource' -Tag 'Get' { # Override Exchange cmdlets function Get-DatabaseAvailabilityGroup {} @@ -72,3 +50,4 @@ finally { Invoke-TestCleanup } + diff --git a/Tests/Unit/MSFT_xExchEcpVirtualDirectory.tests.ps1 b/tests/Unit/MSFT_xExchEcpVirtualDirectory.tests.ps1 similarity index 84% rename from Tests/Unit/MSFT_xExchEcpVirtualDirectory.tests.ps1 rename to tests/Unit/MSFT_xExchEcpVirtualDirectory.tests.ps1 index b12b2ef4..6edf1df2 100644 --- a/Tests/Unit/MSFT_xExchEcpVirtualDirectory.tests.ps1 +++ b/tests/Unit/MSFT_xExchEcpVirtualDirectory.tests.ps1 @@ -1,42 +1,20 @@ -#region HEADER $script:DSCModuleName = 'xExchange' $script:DSCResourceName = 'MSFT_xExchEcpVirtualDirectory' - -# Unit Test Template Version: 1.2.4 $script:moduleRoot = Split-Path -Parent (Split-Path -Parent $PSScriptRoot) -if ( (-not (Test-Path -Path (Join-Path -Path $script:moduleRoot -ChildPath 'DSCResource.Tests'))) -or ` - (-not (Test-Path -Path (Join-Path -Path $script:moduleRoot -ChildPath 'DSCResource.Tests\TestHelper.psm1'))) ) -{ - & git @('clone', 'https://github.com/PowerShell/DscResource.Tests.git', (Join-Path -Path $script:moduleRoot -ChildPath 'DscResource.Tests')) -} - -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'DSCResource.Tests' -ChildPath 'TestHelper.psm1')) -Force -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'Tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Global -Force - -$TestEnvironment = Initialize-TestEnvironment ` - -DSCModuleName $script:DSCModuleName ` - -DSCResourceName $script:DSCResourceName ` - -ResourceType 'Mof' ` - -TestType Unit -#endregion HEADER +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Global -Force -function Invoke-TestSetup -{ - -} +$script:testEnvironment = Invoke-TestSetup -DSCModuleName $script:dscModuleName -DSCResourceName $script:dscResourceName function Invoke-TestCleanup { - Restore-TestEnvironment -TestEnvironment $TestEnvironment + Restore-TestEnvironment -TestEnvironment $script:testEnvironment } # Begin Testing try { - Invoke-TestSetup - - InModuleScope $script:DSCResourceName { + InModuleScope $script:DSCResourceName { function Set-ECPVirtualDirectory { } @@ -146,3 +124,4 @@ finally { Invoke-TestCleanup } + diff --git a/Tests/Unit/MSFT_xExchEventLogLevel.tests.ps1 b/tests/Unit/MSFT_xExchEventLogLevel.tests.ps1 similarity index 60% rename from Tests/Unit/MSFT_xExchEventLogLevel.tests.ps1 rename to tests/Unit/MSFT_xExchEventLogLevel.tests.ps1 index d63ee7fd..df6817d0 100644 --- a/Tests/Unit/MSFT_xExchEventLogLevel.tests.ps1 +++ b/tests/Unit/MSFT_xExchEventLogLevel.tests.ps1 @@ -1,42 +1,20 @@ -#region HEADER $script:DSCModuleName = 'xExchange' $script:DSCResourceName = 'MSFT_xExchEventLogLevel' - -# Unit Test Template Version: 1.2.4 $script:moduleRoot = Split-Path -Parent (Split-Path -Parent $PSScriptRoot) -if ( (-not (Test-Path -Path (Join-Path -Path $script:moduleRoot -ChildPath 'DSCResource.Tests'))) -or ` - (-not (Test-Path -Path (Join-Path -Path $script:moduleRoot -ChildPath 'DSCResource.Tests\TestHelper.psm1'))) ) -{ - & git @('clone', 'https://github.com/PowerShell/DscResource.Tests.git', (Join-Path -Path $script:moduleRoot -ChildPath 'DscResource.Tests')) -} - -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'DSCResource.Tests' -ChildPath 'TestHelper.psm1')) -Force -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'Tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Global -Force - -$TestEnvironment = Initialize-TestEnvironment ` - -DSCModuleName $script:DSCModuleName ` - -DSCResourceName $script:DSCResourceName ` - -ResourceType 'Mof' ` - -TestType Unit -#endregion HEADER +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Global -Force -function Invoke-TestSetup -{ - -} +$script:testEnvironment = Invoke-TestSetup -DSCModuleName $script:dscModuleName -DSCResourceName $script:dscResourceName function Invoke-TestCleanup { - Restore-TestEnvironment -TestEnvironment $TestEnvironment + Restore-TestEnvironment -TestEnvironment $script:testEnvironment } # Begin Testing try { - Invoke-TestSetup - - InModuleScope $script:DSCResourceName { + InModuleScope $script:DSCResourceName { Describe 'MSFT_xExchEventLogLevel\Get-TargetResource' -Tag 'Get' { # Override Exchange cmdlets function Get-EventLogLevel {} @@ -69,3 +47,4 @@ finally { Invoke-TestCleanup } + diff --git a/Tests/Unit/MSFT_xExchExchangeCertificate.tests.ps1 b/tests/Unit/MSFT_xExchExchangeCertificate.tests.ps1 similarity index 59% rename from Tests/Unit/MSFT_xExchExchangeCertificate.tests.ps1 rename to tests/Unit/MSFT_xExchExchangeCertificate.tests.ps1 index dc62b796..a5b6fd8e 100644 --- a/Tests/Unit/MSFT_xExchExchangeCertificate.tests.ps1 +++ b/tests/Unit/MSFT_xExchExchangeCertificate.tests.ps1 @@ -1,42 +1,20 @@ -#region HEADER $script:DSCModuleName = 'xExchange' $script:DSCResourceName = 'MSFT_xExchExchangeCertificate' - -# Unit Test Template Version: 1.2.4 $script:moduleRoot = Split-Path -Parent (Split-Path -Parent $PSScriptRoot) -if ( (-not (Test-Path -Path (Join-Path -Path $script:moduleRoot -ChildPath 'DSCResource.Tests'))) -or ` - (-not (Test-Path -Path (Join-Path -Path $script:moduleRoot -ChildPath 'DSCResource.Tests\TestHelper.psm1'))) ) -{ - & git @('clone', 'https://github.com/PowerShell/DscResource.Tests.git', (Join-Path -Path $script:moduleRoot -ChildPath 'DscResource.Tests')) -} - -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'DSCResource.Tests' -ChildPath 'TestHelper.psm1')) -Force -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'Tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Global -Force - -$TestEnvironment = Initialize-TestEnvironment ` - -DSCModuleName $script:DSCModuleName ` - -DSCResourceName $script:DSCResourceName ` - -ResourceType 'Mof' ` - -TestType Unit -#endregion HEADER +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Global -Force -function Invoke-TestSetup -{ - -} +$script:testEnvironment = Invoke-TestSetup -DSCModuleName $script:dscModuleName -DSCResourceName $script:dscResourceName function Invoke-TestCleanup { - Restore-TestEnvironment -TestEnvironment $TestEnvironment + Restore-TestEnvironment -TestEnvironment $script:testEnvironment } # Begin Testing try { - Invoke-TestSetup - - InModuleScope $script:DSCResourceName { + InModuleScope $script:DSCResourceName { Describe 'MSFT_xExchExchangeCertificate\Get-TargetResource' -Tag 'Get' { AfterEach { Assert-VerifiableMock @@ -66,3 +44,4 @@ finally { Invoke-TestCleanup } + diff --git a/Tests/Unit/MSFT_xExchExchangeServer.tests.ps1 b/tests/Unit/MSFT_xExchExchangeServer.tests.ps1 similarity index 91% rename from Tests/Unit/MSFT_xExchExchangeServer.tests.ps1 rename to tests/Unit/MSFT_xExchExchangeServer.tests.ps1 index 158115da..0ddb6455 100644 --- a/Tests/Unit/MSFT_xExchExchangeServer.tests.ps1 +++ b/tests/Unit/MSFT_xExchExchangeServer.tests.ps1 @@ -4,27 +4,7 @@ $script:DSCResourceName = 'MSFT_xExchExchangeServer' # Unit Test Template Version: 1.2.4 $script:moduleRoot = Split-Path -Parent (Split-Path -Parent $PSScriptRoot) -if ( (-not (Test-Path -Path (Join-Path -Path $script:moduleRoot -ChildPath 'DSCResource.Tests'))) -or ` - (-not (Test-Path -Path (Join-Path -Path $script:moduleRoot -ChildPath 'DSCResource.Tests\TestHelper.psm1'))) ) -{ - & git @('clone', 'https://github.com/PowerShell/DscResource.Tests.git', (Join-Path -Path $script:moduleRoot -ChildPath 'DscResource.Tests')) -} - -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'DSCResource.Tests' -ChildPath 'TestHelper.psm1')) -Force -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'Tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Global -Force - -$TestEnvironment = Initialize-TestEnvironment ` - -DSCModuleName $script:DSCModuleName ` - -DSCResourceName $script:DSCResourceName ` - -ResourceType 'Mof' ` - -TestType Unit - -#endregion HEADER - -function Invoke-TestSetup -{ - -} +$script:testEnvironment = Invoke-TestSetup -DSCModuleName $script:dscModuleName -DSCResourceName $script:dscResourceName function Invoke-TestCleanup { @@ -34,8 +14,6 @@ function Invoke-TestCleanup # Begin Testing try { - Invoke-TestSetup - InModuleScope $script:DSCResourceName { $commonTargetResourceParams = @{ Identity = 'ActiveSyncVirtualDirectory' @@ -116,14 +94,16 @@ try Describe 'MSFT_xExchExchangeServer\Set-TargetResource' -Tag 'Set' { # Override Exchange cmdlets - function Set-ExchangeServer {} + function Set-ExchangeServer + { + } AfterEach { Assert-VerifiableMock } Mock -CommandName Remove-NotApplicableParamsForCurrentState -Verifiable - Mock -CommandName Remove-FromPSBoundParametersUsingHashtable -Verifiable -ParameterFilter {$ParamsToRemove.Contains('AllowServiceRestart')} + Mock -CommandName Remove-FromPSBoundParametersUsingHashtable -Verifiable -ParameterFilter { $ParamsToRemove.Contains('AllowServiceRestart') } Mock -CommandName Get-ExchangeServerInternal -Verifiable -MockWith { return $getExchangeServerStandardOutput } Mock -CommandName Set-EmptyStringParamsToNull -Verifiable Mock -CommandName Set-ExchangeServer -Verifiable @@ -141,7 +121,7 @@ try Context 'When the server needs to be licensed, and allow restart is false' { It 'Should warn that a Information Store restart is required' { - Mock -CommandName Write-Warning -Verifiable -ParameterFilter {$Message -eq 'The configuration will not take effect until MSExchangeIS is manually restarted.'} + Mock -CommandName Write-Warning -Verifiable -ParameterFilter { $Message -eq 'The configuration will not take effect until MSExchangeIS is manually restarted.' } Set-TargetResource @commonTargetResourceParams } @@ -208,7 +188,7 @@ try Context 'When InternetWebProxy is not empty, Compare-StringToString returns false, and the returned InternetWebProxy matches the input InternetWebProxy' { It 'Should return true' { Mock -CommandName Get-ExchangeServerInternal -MockWith { return $getExchangeServerStandardOutput } - Mock -CommandName Compare-StringToString -MockWith { return $false} + Mock -CommandName Compare-StringToString -MockWith { return $false } Test-TargetResource @commonTargetResourceParams | Should -Be $true } @@ -219,7 +199,7 @@ try $getExchangeServerStandardOutput.InternetWebProxy.AbsoluteUri = 'someotherproxy.local' Mock -CommandName Get-ExchangeServerInternal -MockWith { return $getExchangeServerStandardOutput } - Mock -CommandName Compare-StringToString -MockWith { return $false} + Mock -CommandName Compare-StringToString -MockWith { return $false } Mock -CommandName Write-InvalidSettingVerbose Test-TargetResource @commonTargetResourceParams | Should -Be $false @@ -250,7 +230,9 @@ try Describe 'MSFT_xExchExchangeServer\Get-ExchangeServerInternal' -Tag 'Helper' { # Override Exchange cmdlets - function Get-ExchangeServer {} + function Get-ExchangeServer + { + } AfterEach { Assert-VerifiableMock diff --git a/Tests/Unit/MSFT_xExchFrontendTransportService.tests.ps1 b/tests/Unit/MSFT_xExchFrontendTransportService.tests.ps1 similarity index 57% rename from Tests/Unit/MSFT_xExchFrontendTransportService.tests.ps1 rename to tests/Unit/MSFT_xExchFrontendTransportService.tests.ps1 index 51a1e609..0ebabe05 100644 --- a/Tests/Unit/MSFT_xExchFrontendTransportService.tests.ps1 +++ b/tests/Unit/MSFT_xExchFrontendTransportService.tests.ps1 @@ -1,41 +1,19 @@ -#region HEADER $script:DSCModuleName = 'xExchange' $script:DSCResourceName = 'MSFT_xExchFrontendTransportService' - -# Unit Test Template Version: 1.2.4 $script:moduleRoot = Split-Path -Parent (Split-Path -Parent $PSScriptRoot) -if ( (-not (Test-Path -Path (Join-Path -Path $script:moduleRoot -ChildPath 'DSCResource.Tests'))) -or ` - (-not (Test-Path -Path (Join-Path -Path $script:moduleRoot -ChildPath 'DSCResource.Tests\TestHelper.psm1'))) ) -{ - & git @('clone', 'https://github.com/PowerShell/DscResource.Tests.git', (Join-Path -Path $script:moduleRoot -ChildPath 'DscResource.Tests')) -} - -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'DSCResource.Tests' -ChildPath 'TestHelper.psm1')) -Force -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'Tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Global -Force -$TestEnvironment = Initialize-TestEnvironment ` - -DSCModuleName $script:DSCModuleName ` - -DSCResourceName $script:DSCResourceName ` - -ResourceType 'Mof' ` - -TestType Unit +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Global -Force -#endregion HEADER - -function Invoke-TestSetup -{ - -} +$script:testEnvironment = Invoke-TestSetup -DSCModuleName $script:dscModuleName -DSCResourceName $script:dscResourceName function Invoke-TestCleanup { - Restore-TestEnvironment -TestEnvironment $TestEnvironment + Restore-TestEnvironment -TestEnvironment $script:testEnvironment } # Begin Testing try { - Invoke-TestSetup - InModuleScope $script:DSCResourceName { $commonTargetResourceParams = @{ @@ -44,53 +22,55 @@ try } $commonFrontendTransportServiceStandardOutput = @{ - AgentLogEnabled = [System.Boolean] $false - AgentLogMaxAge = [System.String] '' - AgentLogMaxDirectorySize = [System.String] '' - AgentLogMaxFileSize = [System.String] '' - AgentLogPath = [System.String] '' - AntispamAgentsEnabled = [System.Boolean] $false - ConnectivityLogEnabled = [System.Boolean] $false - ConnectivityLogMaxAge = [System.String] '' - ConnectivityLogMaxDirectorySize = [System.String] '' - ConnectivityLogMaxFileSize = [System.String] '' - ConnectivityLogPath = [System.String] '' - DnsLogEnabled = [System.Boolean] $false - DnsLogMaxAge = [System.String] '' - DnsLogMaxDirectorySize = [System.String] '' - DnsLogMaxFileSize = [System.String] '' - DnsLogPath = [System.String] '' - ExternalDNSAdapterEnabled = [System.Boolean] $false - ExternalDNSAdapterGuid = [System.String] '' - ExternalDNSProtocolOption = [System.String] '' - ExternalDNSServers = [System.String[]] @('externaldns.contoso.com') - ExternalIPAddress = [System.String] '1.2.3.4' - InternalDNSAdapterEnabled = [System.Boolean] $false - InternalDNSAdapterGuid = [System.String] '' - InternalDNSProtocolOption = [System.String] '' - InternalDNSServers = [System.String[]] @('internaldns.contoso.com') - IntraOrgConnectorProtocolLoggingLevel = [System.String] '' - MaxConnectionRatePerMinute = [System.Int32] 1 - ReceiveProtocolLogMaxAge = [System.String] '' - ReceiveProtocolLogMaxDirectorySize = [System.String] '' - ReceiveProtocolLogMaxFileSize = [System.String] '' - ReceiveProtocolLogPath = [System.String] '' - RoutingTableLogMaxAge = [System.String] '' - RoutingTableLogMaxDirectorySize = [System.String] '' - RoutingTableLogPath = [System.String] '' - SendProtocolLogMaxAge = [System.String] '' - SendProtocolLogMaxDirectorySize = [System.String] '' - SendProtocolLogMaxFileSize = [System.String] '' - SendProtocolLogPath = [System.String] '' - TransientFailureRetryCount = [System.Int32] 1 - TransientFailureRetryInterval = [System.String] '' + AgentLogEnabled = [System.Boolean] $false + AgentLogMaxAge = [System.String] '' + AgentLogMaxDirectorySize = [System.String] '' + AgentLogMaxFileSize = [System.String] '' + AgentLogPath = [System.String] '' + AntispamAgentsEnabled = [System.Boolean] $false + ConnectivityLogEnabled = [System.Boolean] $false + ConnectivityLogMaxAge = [System.String] '' + ConnectivityLogMaxDirectorySize = [System.String] '' + ConnectivityLogMaxFileSize = [System.String] '' + ConnectivityLogPath = [System.String] '' + DnsLogEnabled = [System.Boolean] $false + DnsLogMaxAge = [System.String] '' + DnsLogMaxDirectorySize = [System.String] '' + DnsLogMaxFileSize = [System.String] '' + DnsLogPath = [System.String] '' + ExternalDNSAdapterEnabled = [System.Boolean] $false + ExternalDNSAdapterGuid = [System.String] '' + ExternalDNSProtocolOption = [System.String] '' + ExternalDNSServers = [System.String[]] @('externaldns.contoso.com') + ExternalIPAddress = [System.String] '1.2.3.4' + InternalDNSAdapterEnabled = [System.Boolean] $false + InternalDNSAdapterGuid = [System.String] '' + InternalDNSProtocolOption = [System.String] '' + InternalDNSServers = [System.String[]] @('internaldns.contoso.com') + IntraOrgConnectorProtocolLoggingLevel = [System.String] '' + MaxConnectionRatePerMinute = [System.Int32] 1 + ReceiveProtocolLogMaxAge = [System.String] '' + ReceiveProtocolLogMaxDirectorySize = [System.String] '' + ReceiveProtocolLogMaxFileSize = [System.String] '' + ReceiveProtocolLogPath = [System.String] '' + RoutingTableLogMaxAge = [System.String] '' + RoutingTableLogMaxDirectorySize = [System.String] '' + RoutingTableLogPath = [System.String] '' + SendProtocolLogMaxAge = [System.String] '' + SendProtocolLogMaxDirectorySize = [System.String] '' + SendProtocolLogMaxFileSize = [System.String] '' + SendProtocolLogPath = [System.String] '' + TransientFailureRetryCount = [System.Int32] 1 + TransientFailureRetryInterval = [System.String] '' } Mock -CommandName Write-FunctionEntry -Verifiable Describe 'MSFT_xExchFrontendTransportService\Get-TargetResource' -Tag 'Get' { # Override Exchange cmdlets - function Get-FrontendTransportService {} + function Get-FrontendTransportService + { + } Mock -CommandName Get-RemoteExchangeSession -Verifiable Mock -CommandName Get-FrontendTransportService -Verifiable -MockWith { return $commonFrontendTransportServiceStandardOutput } @@ -106,7 +86,9 @@ try Describe 'MSFT_xExchFrontendTransportService\Set-TargetResource' -Tag 'Set' { # Override Exchange cmdlets Mock -CommandName Get-RemoteExchangeSession -Verifiable - function Set-FrontendTransportService {} + function Set-FrontendTransportService + { + } AfterEach { Assert-VerifiableMock @@ -160,7 +142,7 @@ try $AllowServiceRestart = $setTargetResourceParams.AllowServiceRestart $setTargetResourceParams.AllowServiceRestart = $false Mock -CommandName Set-FrontendTransportService -Verifiable - Mock -CommandName Write-Warning -Verifiable -ParameterFilter {$Message -eq 'The configuration will not take effect until the MSExchangeFrontEndTransport service is manually restarted.'} + Mock -CommandName Write-Warning -Verifiable -ParameterFilter { $Message -eq 'The configuration will not take effect until the MSExchangeFrontEndTransport service is manually restarted.' } Set-TargetResource @setTargetResourceParams $setTargetResourceParams.AllowServiceRestart = $AllowServiceRestart @@ -172,7 +154,9 @@ try # Override Exchange cmdlets Mock -CommandName Get-RemoteExchangeSession -Verifiable - function Get-FrontendTransportService {} + function Get-FrontendTransportService + { + } AfterEach { Assert-VerifiableMock @@ -205,3 +189,4 @@ finally { Invoke-TestCleanup } + diff --git a/Tests/Unit/MSFT_xExchImapSettings.tests.ps1 b/tests/Unit/MSFT_xExchImapSettings.tests.ps1 similarity index 85% rename from Tests/Unit/MSFT_xExchImapSettings.tests.ps1 rename to tests/Unit/MSFT_xExchImapSettings.tests.ps1 index f652a1d7..9cc7eb5b 100644 --- a/Tests/Unit/MSFT_xExchImapSettings.tests.ps1 +++ b/tests/Unit/MSFT_xExchImapSettings.tests.ps1 @@ -4,27 +4,7 @@ $script:DSCResourceName = 'MSFT_xExchImapSettings' # Unit Test Template Version: 1.2.4 $script:moduleRoot = Split-Path -Parent (Split-Path -Parent $PSScriptRoot) -if ( (-not (Test-Path -Path (Join-Path -Path $script:moduleRoot -ChildPath 'DSCResource.Tests'))) -or ` - (-not (Test-Path -Path (Join-Path -Path $script:moduleRoot -ChildPath 'DSCResource.Tests\TestHelper.psm1'))) ) -{ - & git @('clone', 'https://github.com/PowerShell/DscResource.Tests.git', (Join-Path -Path $script:moduleRoot -ChildPath 'DscResource.Tests')) -} - -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'DSCResource.Tests' -ChildPath 'TestHelper.psm1')) -Force -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'Tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Global -Force - -$TestEnvironment = Initialize-TestEnvironment ` - -DSCModuleName $script:DSCModuleName ` - -DSCResourceName $script:DSCResourceName ` - -ResourceType 'Mof' ` - -TestType Unit - -#endregion HEADER - -function Invoke-TestSetup -{ - -} +$script:testEnvironment = Invoke-TestSetup -DSCModuleName $script:dscModuleName -DSCResourceName $script:dscResourceName function Invoke-TestCleanup { @@ -34,8 +14,6 @@ function Invoke-TestCleanup # Begin Testing try { - Invoke-TestSetup - InModuleScope $script:DSCResourceName { Mock -CommandName Write-FunctionEntry -Verifiable @@ -93,7 +71,9 @@ try Describe 'MSFT_xExchImapSettings\Set-TargetResource' -Tag 'Set' { # Override Exchange cmdlets Mock -CommandName Get-RemoteExchangeSession -Verifiable - function Set-ImapSettings {} + function Set-ImapSettings + { + } AfterEach { Assert-VerifiableMock @@ -112,7 +92,7 @@ try $AllowServiceRestart = $commonTargetResourceParams.AllowServiceRestart $commonTargetResourceParams.AllowServiceRestart = $false Mock -CommandName Set-ImapSettings -Verifiable - Mock -CommandName Write-Warning -Verifiable -ParameterFilter {$Message -eq 'The configuration will not take effect until MSExchangeIMAP4 services are manually restarted.'} + Mock -CommandName Write-Warning -Verifiable -ParameterFilter { $Message -eq 'The configuration will not take effect until MSExchangeIMAP4 services are manually restarted.' } Set-TargetResource @commonTargetResourceParams $commonTargetResourceParams.AllowServiceRestart = $AllowServiceRestart @@ -153,7 +133,9 @@ try Describe 'MSFT_xExchImapSettings\Get-ImapSettingsInternal' -Tag 'Helper' { # Override Exchange cmdlets - function Get-ImapSettings { } + function Get-ImapSettings + { + } AfterEach { Assert-VerifiableMock @@ -170,9 +152,12 @@ try Describe 'MSFT_xExchImapSettings\Get-ImapSettingsInternal' -Tag 'Helper' { # Override Exchange cmdlets - function Get-ImapSettings { } + function Get-ImapSettings + { + } AfterEach { + Assert-VerifiableMock } diff --git a/Tests/Unit/MSFT_xExchInstall.tests.ps1 b/tests/Unit/MSFT_xExchInstall.tests.ps1 similarity index 86% rename from Tests/Unit/MSFT_xExchInstall.tests.ps1 rename to tests/Unit/MSFT_xExchInstall.tests.ps1 index 657a39a0..6e4127dd 100644 --- a/Tests/Unit/MSFT_xExchInstall.tests.ps1 +++ b/tests/Unit/MSFT_xExchInstall.tests.ps1 @@ -1,41 +1,19 @@ -#region HEADER $script:DSCModuleName = 'xExchange' -$script:DSCResourceName = "MSFT_xExchInstall" - -# Unit Test Template Version: 1.2.2 +$script:DSCResourceName = 'MSFT_xExchInstall' $script:moduleRoot = Split-Path -Parent (Split-Path -Parent $PSScriptRoot) -if ( (-not (Test-Path -Path (Join-Path -Path $script:moduleRoot -ChildPath 'DSCResource.Tests'))) -or ` - (-not (Test-Path -Path (Join-Path -Path $script:moduleRoot -ChildPath 'DSCResource.Tests\TestHelper.psm1'))) ) -{ - & git @('clone', 'https://github.com/PowerShell/DscResource.Tests.git', (Join-Path -Path $script:moduleRoot -ChildPath 'DSCResource.Tests')) -} - -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'DSCResource.Tests' -ChildPath 'TestHelper.psm1')) -Force -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'Tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Global -Force - -$TestEnvironment = Initialize-TestEnvironment ` - -DSCModuleName $script:DSCModuleName ` - -DSCResourceName $script:DSCResourceName ` - -ResourceType 'Mof' ` - -TestType Unit -#endregion HEADER +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Global -Force -function Invoke-TestSetup -{ - -} +$script:testEnvironment = Invoke-TestSetup -DSCModuleName $script:dscModuleName -DSCResourceName $script:dscResourceName function Invoke-TestCleanup { - Restore-TestEnvironment -TestEnvironment $TestEnvironment + Restore-TestEnvironment -TestEnvironment $script:testEnvironment } # Begin Testing try { - Invoke-TestSetup - InModuleScope $script:DSCResourceName { $targetResourceParams = @{ @@ -46,7 +24,7 @@ try Describe 'MSFT_xExchInstall\Get-TargetResource' -Tag 'Get' { Context 'When Get-TargetResource is called' { - Test-CommonGetTargetResourceFunctionality -GetTargetResourceParams $targetResourceParams + Test-CommonGetTargetResourceFunctionality -GetTargetResourceParams $targetResourceParams It 'Should return the input Path and Arguments' { @@ -70,8 +48,8 @@ try ShouldStartInstall = $true } } - Mock -CommandName Set-WSManConfigStatus -Verifiable -MockWith {return $true} - Mock -CommandName Write-Warning -Verifiable -ParameterFilter {$Message -like 'Server needs a reboot before the installation of Exchange can begin.'} + Mock -CommandName Set-WSManConfigStatus -Verifiable -MockWith { return $true } + Mock -CommandName Write-Warning -Verifiable -ParameterFilter { $Message -like 'Server needs a reboot before the installation of Exchange can begin.' } Set-TargetResource @targetResourceParams } @@ -84,9 +62,9 @@ try ShouldStartInstall = $true } } - Mock -CommandName Set-WSManConfigStatus -Verifiable -MockWith {return $false} + Mock -CommandName Set-WSManConfigStatus -Verifiable -MockWith { return $false } Mock -CommandName Start-ExchangeScheduledTask -Verifiable - Mock -CommandName Wait-ForProcessStart -Verifiable -MockWith {return $true} + Mock -CommandName Wait-ForProcessStart -Verifiable -MockWith { return $true } Mock -CommandName Wait-ForProcessStop -Verifiable Mock -CommandName Assert-ExchangeSetupArgumentsComplete -Verifiable @@ -101,9 +79,9 @@ try ShouldStartInstall = $true } } - Mock -CommandName Set-WSManConfigStatus -Verifiable -MockWith {return $false} + Mock -CommandName Set-WSManConfigStatus -Verifiable -MockWith { return $false } Mock -CommandName Start-ExchangeScheduledTask -Verifiable - Mock -CommandName Wait-ForProcessStart -Verifiable -MockWith {return $false} + Mock -CommandName Wait-ForProcessStart -Verifiable -MockWith { return $false } { Set-TargetResource @targetResourceParams } | Should -Throw -ExpectedMessage 'Waited 60 seconds, but was unable to detect that ExSetup.exe was started' } @@ -233,3 +211,4 @@ finally { Invoke-TestCleanup } + diff --git a/Tests/Unit/MSFT_xExchJetstress.tests.ps1 b/tests/Unit/MSFT_xExchJetstress.tests.ps1 similarity index 51% rename from Tests/Unit/MSFT_xExchJetstress.tests.ps1 rename to tests/Unit/MSFT_xExchJetstress.tests.ps1 index 2d9b6405..63516340 100644 --- a/Tests/Unit/MSFT_xExchJetstress.tests.ps1 +++ b/tests/Unit/MSFT_xExchJetstress.tests.ps1 @@ -1,42 +1,19 @@ -#region HEADER $script:DSCModuleName = 'xExchange' $script:DSCResourceName = 'MSFT_xExchJetstress' - -# Unit Test Template Version: 1.2.4 $script:moduleRoot = Split-Path -Parent (Split-Path -Parent $PSScriptRoot) -if ( (-not (Test-Path -Path (Join-Path -Path $script:moduleRoot -ChildPath 'DSCResource.Tests'))) -or ` - (-not (Test-Path -Path (Join-Path -Path $script:moduleRoot -ChildPath 'DSCResource.Tests\TestHelper.psm1'))) ) -{ - & git @('clone', 'https://github.com/PowerShell/DscResource.Tests.git', (Join-Path -Path $script:moduleRoot -ChildPath 'DscResource.Tests')) -} -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'DSCResource.Tests' -ChildPath 'TestHelper.psm1')) -Force -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'Tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Global -Force +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Global -Force -$TestEnvironment = Initialize-TestEnvironment ` - -DSCModuleName $script:DSCModuleName ` - -DSCResourceName $script:DSCResourceName ` - -ResourceType 'Mof' ` - -TestType Unit - -#endregion HEADER - -function Invoke-TestSetup -{ - -} +$script:testEnvironment = Invoke-TestSetup -DSCModuleName $script:dscModuleName -DSCResourceName $script:dscResourceName function Invoke-TestCleanup { - Restore-TestEnvironment -TestEnvironment $TestEnvironment + Restore-TestEnvironment -TestEnvironment $script:testEnvironment } - # Begin Testing try { - Invoke-TestSetup - - InModuleScope $script:DSCResourceName { + InModuleScope $script:DSCResourceName { Describe 'MSFT_xExchJetstress\Get-TargetResource' -Tag 'Get' { AfterEach { Assert-VerifiableMock @@ -60,3 +37,4 @@ finally { Invoke-TestCleanup } + diff --git a/tests/Unit/MSFT_xExchJetstressCleanup.tests.ps1 b/tests/Unit/MSFT_xExchJetstressCleanup.tests.ps1 new file mode 100644 index 00000000..d46be53f --- /dev/null +++ b/tests/Unit/MSFT_xExchJetstressCleanup.tests.ps1 @@ -0,0 +1,39 @@ +$script:DSCModuleName = 'xExchange' +$script:DSCResourceName = 'MSFT_xExchJetstressCleanup' +$script:moduleRoot = Split-Path -Parent (Split-Path -Parent $PSScriptRoot) + +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Global -Force + +$script:testEnvironment = Invoke-TestSetup -DSCModuleName $script:dscModuleName -DSCResourceName $script:dscResourceName + +function Invoke-TestCleanup +{ + Restore-TestEnvironment -TestEnvironment $script:testEnvironment +} + +# Begin Testing +try +{ + InModuleScope $script:DSCResourceName { + Describe 'MSFT_xExchJetstressCleanup\Get-TargetResource' -Tag 'Get' { + AfterEach { + Assert-VerifiableMock + } + + $getTargetResourceParams = @{ + JetstressPath = 'C:\Program Files\Exchange Jestress' + } + + Context 'When Get-TargetResource is called' { + Mock -CommandName Write-FunctionEntry -Verifiable + + Test-CommonGetTargetResourceFunctionality -GetTargetResourceParams $getTargetResourceParams + } + } + } +} +finally +{ + Invoke-TestCleanup +} + diff --git a/Tests/Unit/MSFT_xExchMailboxDatabase.tests.ps1 b/tests/Unit/MSFT_xExchMailboxDatabase.tests.ps1 similarity index 77% rename from Tests/Unit/MSFT_xExchMailboxDatabase.tests.ps1 rename to tests/Unit/MSFT_xExchMailboxDatabase.tests.ps1 index 8078dd14..29bd7a2f 100644 --- a/Tests/Unit/MSFT_xExchMailboxDatabase.tests.ps1 +++ b/tests/Unit/MSFT_xExchMailboxDatabase.tests.ps1 @@ -1,48 +1,28 @@ [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseSingularNouns', '')] param() -#region HEADER $script:DSCModuleName = 'xExchange' $script:DSCResourceName = 'MSFT_xExchMailboxDatabase' - -# Unit Test Template Version: 1.2.4 $script:moduleRoot = Split-Path -Parent (Split-Path -Parent $PSScriptRoot) -if ( (-not (Test-Path -Path (Join-Path -Path $script:moduleRoot -ChildPath 'DSCResource.Tests'))) -or ` - (-not (Test-Path -Path (Join-Path -Path $script:moduleRoot -ChildPath 'DSCResource.Tests\TestHelper.psm1'))) ) -{ - & git @('clone', 'https://github.com/PowerShell/DscResource.Tests.git', (Join-Path -Path $script:moduleRoot -ChildPath 'DscResource.Tests')) -} -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'DSCResource.Tests' -ChildPath 'TestHelper.psm1')) -Force -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'Tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Global -Force +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Global -Force -$TestEnvironment = Initialize-TestEnvironment ` - -DSCModuleName $script:DSCModuleName ` - -DSCResourceName $script:DSCResourceName ` - -ResourceType 'Mof' ` - -TestType Unit - -#endregion HEADER - -function Invoke-TestSetup -{ - -} +$script:testEnvironment = Invoke-TestSetup -DSCModuleName $script:dscModuleName -DSCResourceName $script:dscResourceName function Invoke-TestCleanup { - Restore-TestEnvironment -TestEnvironment $TestEnvironment + Restore-TestEnvironment -TestEnvironment $script:testEnvironment } # Begin Testing try { - Invoke-TestSetup - InModuleScope $script:DSCResourceName { Describe 'MSFT_xExchMailboxDatabase\Get-TargetResource' -Tag 'Get' { # Override Exchange cmdlets - function Set-ADServerSettings {} + function Set-ADServerSettings + { + } AfterEach { Assert-VerifiableMock @@ -97,3 +77,4 @@ finally { Invoke-TestCleanup } + diff --git a/Tests/Unit/MSFT_xExchMailboxDatabaseCopy.tests.ps1 b/tests/Unit/MSFT_xExchMailboxDatabaseCopy.tests.ps1 similarity index 85% rename from Tests/Unit/MSFT_xExchMailboxDatabaseCopy.tests.ps1 rename to tests/Unit/MSFT_xExchMailboxDatabaseCopy.tests.ps1 index 919aa806..5706bd43 100644 --- a/Tests/Unit/MSFT_xExchMailboxDatabaseCopy.tests.ps1 +++ b/tests/Unit/MSFT_xExchMailboxDatabaseCopy.tests.ps1 @@ -1,44 +1,18 @@ -[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseSingularNouns', '')] -param() - -#region HEADER $script:DSCModuleName = 'xExchange' $script:DSCResourceName = 'MSFT_xExchMailboxDatabaseCopy' - -# Unit Test Template Version: 1.2.4 $script:moduleRoot = Split-Path -Parent (Split-Path -Parent $PSScriptRoot) -if ( (-not (Test-Path -Path (Join-Path -Path $script:moduleRoot -ChildPath 'DSCResource.Tests'))) -or ` - (-not (Test-Path -Path (Join-Path -Path $script:moduleRoot -ChildPath 'DSCResource.Tests\TestHelper.psm1'))) ) -{ - & git @('clone', 'https://github.com/PowerShell/DscResource.Tests.git', (Join-Path -Path $script:moduleRoot -ChildPath 'DscResource.Tests')) -} -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'DSCResource.Tests' -ChildPath 'TestHelper.psm1')) -Force -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'Tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Global -Force +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Global -Force -$TestEnvironment = Initialize-TestEnvironment ` - -DSCModuleName $script:DSCModuleName ` - -DSCResourceName $script:DSCResourceName ` - -ResourceType 'Mof' ` - -TestType Unit - -#endregion HEADER - -function Invoke-TestSetup -{ - -} +$script:testEnvironment = Invoke-TestSetup -DSCModuleName $script:dscModuleName -DSCResourceName $script:dscResourceName function Invoke-TestCleanup { - Restore-TestEnvironment -TestEnvironment $TestEnvironment + Restore-TestEnvironment -TestEnvironment $script:testEnvironment } - # Begin Testing try { - Invoke-TestSetup - InModuleScope $script:DSCResourceName { $commonResourceParameters = @{ Identity = 'MailboxDatabaseCopy' @@ -51,37 +25,39 @@ try Describe 'MSFT_xExchMailboxDatabaseCopy\Get-TargetResource' -Tag 'Get' { # Override Exchange cmdlets - function Set-ADServerSettings {} + function Set-ADServerSettings + { + } AfterEach { Assert-VerifiableMock } $getMailboxDatabaseStandardOutput = @{ - DatabaseCopies = @( + DatabaseCopies = @( @{ HostServerName = $commonResourceParameters.MailboxServer } ) ActivationPreference = @( @{ - Key = @{ + Key = @{ Name = $commonResourceParameters.MailboxServer } Value = 1 } ) - ReplayLagTimes = @( + ReplayLagTimes = @( @{ - Key = @{ + Key = @{ Name = $commonResourceParameters.MailboxServer } Value = 'ReplayLagTimes' } ) - TruncationLagTimes = @( + TruncationLagTimes = @( @{ - Key = @{ + Key = @{ Name = $commonResourceParameters.MailboxServer } Value = 'TruncationLagTimes' @@ -163,7 +139,9 @@ try Describe 'MSFT_xExchMailboxDatabaseCopy\Get-MailboxDatabaseInternal' -Tag 'Helper' { # Override Exchange cmdlets - function Get-MailboxDatabase {} + function Get-MailboxDatabase + { + } AfterEach { Assert-VerifiableMock @@ -201,7 +179,9 @@ try Describe 'MSFT_xExchMailboxDatabaseCopy\Add-MailboxDatabaseCopyInternal' -Tag 'Helper' { # Override Exchange cmdlets - function Add-MailboxDatabaseCopy {} + function Add-MailboxDatabaseCopy + { + } AfterEach { Assert-VerifiableMock @@ -218,7 +198,7 @@ try It 'Should call expected functions and write a warning' { Mock -CommandName Get-MailboxDatabaseCopyCount -Verifiable -MockWith { return 1 } Mock -CommandName Get-TargetResource -Verifiable -MockWith { return 'SomeCopy' } - Mock -CommandName Write-Warning -Verifiable -ParameterFilter {$Message -like 'The configuration will not take effect until MSExchangeIS is manually restarted.'} + Mock -CommandName Write-Warning -Verifiable -ParameterFilter { $Message -like 'The configuration will not take effect until MSExchangeIS is manually restarted.' } Add-MailboxDatabaseCopyInternal @commonResourceParameters } @@ -242,7 +222,7 @@ try It 'Should remove the SeedingPostponed parameter' { Mock -CommandName Get-MailboxDatabaseCopyCount -Verifiable -MockWith { return 1 } Mock -CommandName Get-TargetResource -Verifiable -MockWith { return 'SomeCopy' } - Mock -CommandName Write-Warning -Verifiable -ParameterFilter {$Message -like 'The configuration will not take effect until MSExchangeIS is manually restarted.'} + Mock -CommandName Write-Warning -Verifiable -ParameterFilter { $Message -like 'The configuration will not take effect until MSExchangeIS is manually restarted.' } $commonResourceParameters['SeedingPostponed'] = $false @@ -264,9 +244,9 @@ try Context 'When ActivationPreference is higher than the future copy count' { It 'Should skip setting ActivationPreference' { Mock -CommandName Get-MailboxDatabaseCopyCount -Verifiable -MockWith { return 1 } - Mock -CommandName Write-Warning -Verifiable -ParameterFilter {$Message -like '*Skipping setting ActivationPreference at this point*'} + Mock -CommandName Write-Warning -Verifiable -ParameterFilter { $Message -like '*Skipping setting ActivationPreference at this point*' } Mock -CommandName Get-TargetResource -Verifiable -MockWith { return 'SomeCopy' } - Mock -CommandName Write-Warning -Verifiable -ParameterFilter {$Message -like 'The configuration will not take effect until MSExchangeIS is manually restarted.'} + Mock -CommandName Write-Warning -Verifiable -ParameterFilter { $Message -like 'The configuration will not take effect until MSExchangeIS is manually restarted.' } $commonResourceParameters['ActivationPreference'] = 3 @@ -277,7 +257,9 @@ try Describe 'MSFT_xExchMailboxDatabaseCopy\Set-MailboxDatabaseCopyInternal' -Tag 'Helper' { # Override Exchange cmdlets - function Set-MailboxDatabaseCopy {} + function Set-MailboxDatabaseCopy + { + } AfterEach { Assert-VerifiableMock diff --git a/Tests/Unit/MSFT_xExchMailboxServer.tests.ps1 b/tests/Unit/MSFT_xExchMailboxServer.tests.ps1 similarity index 85% rename from Tests/Unit/MSFT_xExchMailboxServer.tests.ps1 rename to tests/Unit/MSFT_xExchMailboxServer.tests.ps1 index fe8dd243..c3cc97ae 100644 --- a/Tests/Unit/MSFT_xExchMailboxServer.tests.ps1 +++ b/tests/Unit/MSFT_xExchMailboxServer.tests.ps1 @@ -1,42 +1,20 @@ -#region HEADER $script:DSCModuleName = 'xExchange' $script:DSCResourceName = 'MSFT_xExchMailboxServer' - -# Unit Test Template Version: 1.2.4 $script:moduleRoot = Split-Path -Parent (Split-Path -Parent $PSScriptRoot) -if ( (-not (Test-Path -Path (Join-Path -Path $script:moduleRoot -ChildPath 'DSCResource.Tests'))) -or ` - (-not (Test-Path -Path (Join-Path -Path $script:moduleRoot -ChildPath 'DSCResource.Tests\TestHelper.psm1'))) ) -{ - & git @('clone', 'https://github.com/PowerShell/DscResource.Tests.git', (Join-Path -Path $script:moduleRoot -ChildPath 'DscResource.Tests')) -} - -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'DSCResource.Tests' -ChildPath 'TestHelper.psm1')) -Force -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'Tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Global -Force - -$TestEnvironment = Initialize-TestEnvironment ` - -DSCModuleName $script:DSCModuleName ` - -DSCResourceName $script:DSCResourceName ` - -ResourceType 'Mof' ` - -TestType Unit -#endregion HEADER +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Global -Force -function Invoke-TestSetup -{ - -} +$script:testEnvironment = Invoke-TestSetup -DSCModuleName $script:dscModuleName -DSCResourceName $script:dscResourceName function Invoke-TestCleanup { - Restore-TestEnvironment -TestEnvironment $TestEnvironment + Restore-TestEnvironment -TestEnvironment $script:testEnvironment } # Begin Testing try { - Invoke-TestSetup - - InModuleScope $script:DSCResourceName { + InModuleScope $script:DSCResourceName { Describe 'MSFT_xExchMailboxServer\Get-TargetResource' -Tag 'Get' { AfterEach { Assert-VerifiableMock @@ -131,3 +109,4 @@ finally { Invoke-TestCleanup } + diff --git a/Tests/Unit/MSFT_xExchMailboxTransportService.tests.ps1 b/tests/Unit/MSFT_xExchMailboxTransportService.tests.ps1 similarity index 83% rename from Tests/Unit/MSFT_xExchMailboxTransportService.tests.ps1 rename to tests/Unit/MSFT_xExchMailboxTransportService.tests.ps1 index 09e3aa8d..6278fbd2 100644 --- a/Tests/Unit/MSFT_xExchMailboxTransportService.tests.ps1 +++ b/tests/Unit/MSFT_xExchMailboxTransportService.tests.ps1 @@ -1,40 +1,16 @@ -#region HEADER $script:DSCModuleName = 'xExchange' $script:DSCResourceName = 'MSFT_xExchMailboxTransportService' - -# Unit Test Template Version: 1.2.4 $script:moduleRoot = Split-Path -Parent (Split-Path -Parent $PSScriptRoot) -if ( (-not (Test-Path -Path (Join-Path -Path $script:moduleRoot -ChildPath 'DSCResource.Tests'))) -or ` - (-not (Test-Path -Path (Join-Path -Path $script:moduleRoot -ChildPath 'DSCResource.Tests\TestHelper.psm1'))) ) -{ - & git @('clone', 'https://github.com/PowerShell/DscResource.Tests.git', (Join-Path -Path $script:moduleRoot -ChildPath 'DscResource.Tests')) -} - -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'DSCResource.Tests' -ChildPath 'TestHelper.psm1')) -Force -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'Tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Global -Force - -$TestEnvironment = Initialize-TestEnvironment ` - -DSCModuleName $script:DSCModuleName ` - -DSCResourceName $script:DSCResourceName ` - -ResourceType 'Mof' ` - -TestType Unit - -#endregion HEADER - -function Invoke-TestSetup -{ - -} +$script:testEnvironment = Invoke-TestSetup -DSCModuleName $script:dscModuleName -DSCResourceName $script:dscResourceName function Invoke-TestCleanup { - Restore-TestEnvironment -TestEnvironment $TestEnvironment + Restore-TestEnvironment -TestEnvironment $script:testEnvironment } # Begin Testing try { - Invoke-TestSetup InModuleScope $script:DSCResourceName { @@ -87,7 +63,9 @@ try Describe 'MSFT_xExchMailboxTransportService\Get-TargetResource' -Tag 'Get' { # Override Exchange cmdlets - function Get-MailboxTransportService {} + function Get-MailboxTransportService + { + } AfterEach { Assert-VerifiableMock @@ -107,12 +85,14 @@ try } Context 'When Set-TargetResource is called' { - function Set-MailboxTransportService { } + function Set-MailboxTransportService + { + } #Mock -CommandName Get-RemoteExchangeSession -Verifiable It 'Should warn about restarting the MSExchangeDelivery and/or MSExchangeSubmission services' { Mock -CommandName Set-MailboxTransportService -Verifiable - Mock -CommandName Write-Warning -ParameterFilter {$Message -eq 'The configuration will not take effect until the MSExchangeDelivery and/or MSExchangeSubmission services are manually restarted.'} + Mock -CommandName Write-Warning -ParameterFilter { $Message -eq 'The configuration will not take effect until the MSExchangeDelivery and/or MSExchangeSubmission services are manually restarted.' } Set-TargetResource @commonTargetResourceParams } @@ -134,7 +114,9 @@ try Assert-VerifiableMock } - function Get-MailboxTransportService {} + function Get-MailboxTransportService + { + } Context 'When Test-TargetResource is called' { It 'Should return False when Get-MailboxTransportService returns null' { diff --git a/Tests/Unit/MSFT_xExchMaintenanceMode.tests.ps1 b/tests/Unit/MSFT_xExchMaintenanceMode.tests.ps1 similarity index 69% rename from Tests/Unit/MSFT_xExchMaintenanceMode.tests.ps1 rename to tests/Unit/MSFT_xExchMaintenanceMode.tests.ps1 index 90e6ded4..046b6c75 100644 --- a/Tests/Unit/MSFT_xExchMaintenanceMode.tests.ps1 +++ b/tests/Unit/MSFT_xExchMaintenanceMode.tests.ps1 @@ -1,41 +1,19 @@ -#region HEADER $script:DSCModuleName = 'xExchange' $script:DSCResourceName = 'MSFT_xExchMaintenanceMode' - -# Unit Test Template Version: 1.2.4 $script:moduleRoot = Split-Path -Parent (Split-Path -Parent $PSScriptRoot) -if ( (-not (Test-Path -Path (Join-Path -Path $script:moduleRoot -ChildPath 'DSCResource.Tests'))) -or ` - (-not (Test-Path -Path (Join-Path -Path $script:moduleRoot -ChildPath 'DSCResource.Tests\TestHelper.psm1'))) ) -{ - & git @('clone', 'https://github.com/PowerShell/DscResource.Tests.git', (Join-Path -Path $script:moduleRoot -ChildPath 'DscResource.Tests')) -} - -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'DSCResource.Tests' -ChildPath 'TestHelper.psm1')) -Force -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'Tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Global -Force - -$TestEnvironment = Initialize-TestEnvironment ` - -DSCModuleName $script:DSCModuleName ` - -DSCResourceName $script:DSCResourceName ` - -ResourceType 'Mof' ` - -TestType Unit -#endregion HEADER +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Global -Force -function Invoke-TestSetup -{ - -} +$script:testEnvironment = Invoke-TestSetup -DSCModuleName $script:dscModuleName -DSCResourceName $script:dscResourceName function Invoke-TestCleanup { - Restore-TestEnvironment -TestEnvironment $TestEnvironment + Restore-TestEnvironment -TestEnvironment $script:testEnvironment } # Begin Testing try { - Invoke-TestSetup - InModuleScope $script:DSCResourceName { Describe 'MSFT_xExchMaintenanceMode\Get-TargetResource' -Tag 'Get' { AfterEach { @@ -81,3 +59,4 @@ finally { Invoke-TestCleanup } + diff --git a/Tests/Unit/MSFT_xExchMapiVirtualDirectory.tests.ps1 b/tests/Unit/MSFT_xExchMapiVirtualDirectory.tests.ps1 similarity index 64% rename from Tests/Unit/MSFT_xExchMapiVirtualDirectory.tests.ps1 rename to tests/Unit/MSFT_xExchMapiVirtualDirectory.tests.ps1 index fc0e1852..44ab0806 100644 --- a/Tests/Unit/MSFT_xExchMapiVirtualDirectory.tests.ps1 +++ b/tests/Unit/MSFT_xExchMapiVirtualDirectory.tests.ps1 @@ -1,41 +1,19 @@ -#region HEADER $script:DSCModuleName = 'xExchange' $script:DSCResourceName = 'MSFT_xExchMapiVirtualDirectory' - -# Unit Test Template Version: 1.2.4 $script:moduleRoot = Split-Path -Parent (Split-Path -Parent $PSScriptRoot) -if ( (-not (Test-Path -Path (Join-Path -Path $script:moduleRoot -ChildPath 'DSCResource.Tests'))) -or ` - (-not (Test-Path -Path (Join-Path -Path $script:moduleRoot -ChildPath 'DSCResource.Tests\TestHelper.psm1'))) ) -{ - & git @('clone', 'https://github.com/PowerShell/DscResource.Tests.git', (Join-Path -Path $script:moduleRoot -ChildPath 'DscResource.Tests')) -} - -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'DSCResource.Tests' -ChildPath 'TestHelper.psm1')) -Force -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'Tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Global -Force - -$TestEnvironment = Initialize-TestEnvironment ` - -DSCModuleName $script:DSCModuleName ` - -DSCResourceName $script:DSCResourceName ` - -ResourceType 'Mof' ` - -TestType Unit -#endregion HEADER +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Global -Force -function Invoke-TestSetup -{ - -} +$script:testEnvironment = Invoke-TestSetup -DSCModuleName $script:dscModuleName -DSCResourceName $script:dscResourceName function Invoke-TestCleanup { - Restore-TestEnvironment -TestEnvironment $TestEnvironment + Restore-TestEnvironment -TestEnvironment $script:testEnvironment } # Begin Testing try { - Invoke-TestSetup - InModuleScope $script:DSCResourceName { Describe 'MSFT_xExchMapiVirtualDirectory\Get-TargetResource' -Tag 'Get' { AfterEach { @@ -68,3 +46,4 @@ finally { Invoke-TestCleanup } + diff --git a/Tests/Unit/MSFT_xExchOabVirtualDirectory.tests.ps1 b/tests/Unit/MSFT_xExchOabVirtualDirectory.tests.ps1 similarity index 73% rename from Tests/Unit/MSFT_xExchOabVirtualDirectory.tests.ps1 rename to tests/Unit/MSFT_xExchOabVirtualDirectory.tests.ps1 index c5e1c1cd..d10d28ef 100644 --- a/Tests/Unit/MSFT_xExchOabVirtualDirectory.tests.ps1 +++ b/tests/Unit/MSFT_xExchOabVirtualDirectory.tests.ps1 @@ -1,41 +1,19 @@ -#region HEADER $script:DSCModuleName = 'xExchange' $script:DSCResourceName = 'MSFT_xExchOabVirtualDirectory' - -# Unit Test Template Version: 1.2.4 $script:moduleRoot = Split-Path -Parent (Split-Path -Parent $PSScriptRoot) -if ( (-not (Test-Path -Path (Join-Path -Path $script:moduleRoot -ChildPath 'DSCResource.Tests'))) -or ` - (-not (Test-Path -Path (Join-Path -Path $script:moduleRoot -ChildPath 'DSCResource.Tests\TestHelper.psm1'))) ) -{ - & git @('clone', 'https://github.com/PowerShell/DscResource.Tests.git', (Join-Path -Path $script:moduleRoot -ChildPath 'DscResource.Tests')) -} - -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'DSCResource.Tests' -ChildPath 'TestHelper.psm1')) -Force -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'Tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Global -Force - -$TestEnvironment = Initialize-TestEnvironment ` - -DSCModuleName $script:DSCModuleName ` - -DSCResourceName $script:DSCResourceName ` - -ResourceType 'Mof' ` - -TestType Unit -#endregion HEADER +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Global -Force -function Invoke-TestSetup -{ - -} +$script:testEnvironment = Invoke-TestSetup -DSCModuleName $script:dscModuleName -DSCResourceName $script:dscResourceName function Invoke-TestCleanup { - Restore-TestEnvironment -TestEnvironment $TestEnvironment + Restore-TestEnvironment -TestEnvironment $script:testEnvironment } # Begin Testing try { - Invoke-TestSetup - InModuleScope $script:DSCResourceName { Describe 'MSFT_xExchOabVirtualDirectory\Get-TargetResource' -Tag 'Get' { # Override Exchange cmdlets @@ -86,3 +64,4 @@ finally { Invoke-TestCleanup } + diff --git a/Tests/Unit/MSFT_xExchOutlookAnywhere.tests.ps1 b/tests/Unit/MSFT_xExchOutlookAnywhere.tests.ps1 similarity index 70% rename from Tests/Unit/MSFT_xExchOutlookAnywhere.tests.ps1 rename to tests/Unit/MSFT_xExchOutlookAnywhere.tests.ps1 index 69f0e584..eb978696 100644 --- a/Tests/Unit/MSFT_xExchOutlookAnywhere.tests.ps1 +++ b/tests/Unit/MSFT_xExchOutlookAnywhere.tests.ps1 @@ -1,41 +1,19 @@ -#region HEADER $script:DSCModuleName = 'xExchange' $script:DSCResourceName = 'MSFT_xExchOutlookAnywhere' - -# Unit Test Template Version: 1.2.4 $script:moduleRoot = Split-Path -Parent (Split-Path -Parent $PSScriptRoot) -if ( (-not (Test-Path -Path (Join-Path -Path $script:moduleRoot -ChildPath 'DSCResource.Tests'))) -or ` - (-not (Test-Path -Path (Join-Path -Path $script:moduleRoot -ChildPath 'DSCResource.Tests\TestHelper.psm1'))) ) -{ - & git @('clone', 'https://github.com/PowerShell/DscResource.Tests.git', (Join-Path -Path $script:moduleRoot -ChildPath 'DscResource.Tests')) -} - -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'DSCResource.Tests' -ChildPath 'TestHelper.psm1')) -Force -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'Tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Global -Force - -$TestEnvironment = Initialize-TestEnvironment ` - -DSCModuleName $script:DSCModuleName ` - -DSCResourceName $script:DSCResourceName ` - -ResourceType 'Mof' ` - -TestType Unit -#endregion HEADER +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Global -Force -function Invoke-TestSetup -{ - -} +$script:testEnvironment = Invoke-TestSetup -DSCModuleName $script:dscModuleName -DSCResourceName $script:dscResourceName function Invoke-TestCleanup { - Restore-TestEnvironment -TestEnvironment $TestEnvironment + Restore-TestEnvironment -TestEnvironment $script:testEnvironment } # Begin Testing try { - Invoke-TestSetup - InModuleScope $script:DSCResourceName { Describe 'MSFT_xExchOutlookAnywhere\Get-TargetResource' -Tag 'Get' { AfterEach { @@ -75,3 +53,4 @@ finally { Invoke-TestCleanup } + diff --git a/Tests/Unit/MSFT_xExchOwaVirtualDirectory.tests.ps1 b/tests/Unit/MSFT_xExchOwaVirtualDirectory.tests.ps1 similarity index 77% rename from Tests/Unit/MSFT_xExchOwaVirtualDirectory.tests.ps1 rename to tests/Unit/MSFT_xExchOwaVirtualDirectory.tests.ps1 index fb1b8417..62f1e267 100644 --- a/Tests/Unit/MSFT_xExchOwaVirtualDirectory.tests.ps1 +++ b/tests/Unit/MSFT_xExchOwaVirtualDirectory.tests.ps1 @@ -1,41 +1,19 @@ -#region HEADER $script:DSCModuleName = 'xExchange' $script:DSCResourceName = 'MSFT_xExchOwaVirtualDirectory' - -# Unit Test Template Version: 1.2.4 $script:moduleRoot = Split-Path -Parent (Split-Path -Parent $PSScriptRoot) -if ( (-not (Test-Path -Path (Join-Path -Path $script:moduleRoot -ChildPath 'DSCResource.Tests'))) -or ` - (-not (Test-Path -Path (Join-Path -Path $script:moduleRoot -ChildPath 'DSCResource.Tests\TestHelper.psm1'))) ) -{ - & git @('clone', 'https://github.com/PowerShell/DscResource.Tests.git', (Join-Path -Path $script:moduleRoot -ChildPath 'DscResource.Tests')) -} - -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'DSCResource.Tests' -ChildPath 'TestHelper.psm1')) -Force -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'Tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Global -Force - -$TestEnvironment = Initialize-TestEnvironment ` - -DSCModuleName $script:DSCModuleName ` - -DSCResourceName $script:DSCResourceName ` - -ResourceType 'Mof' ` - -TestType Unit -#endregion HEADER +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Global -Force -function Invoke-TestSetup -{ - -} +$script:testEnvironment = Invoke-TestSetup -DSCModuleName $script:dscModuleName -DSCResourceName $script:dscResourceName function Invoke-TestCleanup { - Restore-TestEnvironment -TestEnvironment $TestEnvironment + Restore-TestEnvironment -TestEnvironment $script:testEnvironment } # Begin Testing try { - Invoke-TestSetup - InModuleScope $script:DSCResourceName { Describe 'MSFT_xExchOwaVirtualDirectory\Get-TargetResource' -Tag 'Get' { AfterEach { @@ -87,3 +65,4 @@ finally { Invoke-TestCleanup } + diff --git a/Tests/Unit/MSFT_xExchPopSettings.tests.ps1 b/tests/Unit/MSFT_xExchPopSettings.tests.ps1 similarity index 62% rename from Tests/Unit/MSFT_xExchPopSettings.tests.ps1 rename to tests/Unit/MSFT_xExchPopSettings.tests.ps1 index 1343b9b7..0986b4b9 100644 --- a/Tests/Unit/MSFT_xExchPopSettings.tests.ps1 +++ b/tests/Unit/MSFT_xExchPopSettings.tests.ps1 @@ -1,41 +1,19 @@ -#region HEADER $script:DSCModuleName = 'xExchange' $script:DSCResourceName = 'MSFT_xExchPopSettings' - -# Unit Test Template Version: 1.2.4 $script:moduleRoot = Split-Path -Parent (Split-Path -Parent $PSScriptRoot) -if ( (-not (Test-Path -Path (Join-Path -Path $script:moduleRoot -ChildPath 'DSCResource.Tests'))) -or ` - (-not (Test-Path -Path (Join-Path -Path $script:moduleRoot -ChildPath 'DSCResource.Tests\TestHelper.psm1'))) ) -{ - & git @('clone', 'https://github.com/PowerShell/DscResource.Tests.git', (Join-Path -Path $script:moduleRoot -ChildPath 'DscResource.Tests')) -} - -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'DSCResource.Tests' -ChildPath 'TestHelper.psm1')) -Force -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'Tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Global -Force - -$TestEnvironment = Initialize-TestEnvironment ` - -DSCModuleName $script:DSCModuleName ` - -DSCResourceName $script:DSCResourceName ` - -ResourceType 'Mof' ` - -TestType Unit -#endregion HEADER +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Global -Force -function Invoke-TestSetup -{ - -} +$script:testEnvironment = Invoke-TestSetup -DSCModuleName $script:dscModuleName -DSCResourceName $script:dscResourceName function Invoke-TestCleanup { - Restore-TestEnvironment -TestEnvironment $TestEnvironment + Restore-TestEnvironment -TestEnvironment $script:testEnvironment } # Begin Testing try { - Invoke-TestSetup - InModuleScope $script:DSCResourceName { Describe 'MSFT_xExchPopSettings\Get-TargetResource' -Tag 'Get' { AfterEach { @@ -67,3 +45,4 @@ finally { Invoke-TestCleanup } + diff --git a/Tests/Unit/MSFT_xExchPowershellVirtualDirectory.tests.ps1 b/tests/Unit/MSFT_xExchPowershellVirtualDirectory.tests.ps1 similarity index 66% rename from Tests/Unit/MSFT_xExchPowershellVirtualDirectory.tests.ps1 rename to tests/Unit/MSFT_xExchPowershellVirtualDirectory.tests.ps1 index 71f53d39..3541f7a3 100644 --- a/Tests/Unit/MSFT_xExchPowershellVirtualDirectory.tests.ps1 +++ b/tests/Unit/MSFT_xExchPowershellVirtualDirectory.tests.ps1 @@ -1,41 +1,19 @@ -#region HEADER $script:DSCModuleName = 'xExchange' $script:DSCResourceName = 'MSFT_xExchPowershellVirtualDirectory' - -# Unit Test Template Version: 1.2.4 $script:moduleRoot = Split-Path -Parent (Split-Path -Parent $PSScriptRoot) -if ( (-not (Test-Path -Path (Join-Path -Path $script:moduleRoot -ChildPath 'DSCResource.Tests'))) -or ` - (-not (Test-Path -Path (Join-Path -Path $script:moduleRoot -ChildPath 'DSCResource.Tests\TestHelper.psm1'))) ) -{ - & git @('clone', 'https://github.com/PowerShell/DscResource.Tests.git', (Join-Path -Path $script:moduleRoot -ChildPath 'DscResource.Tests')) -} - -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'DSCResource.Tests' -ChildPath 'TestHelper.psm1')) -Force -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'Tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Global -Force - -$TestEnvironment = Initialize-TestEnvironment ` - -DSCModuleName $script:DSCModuleName ` - -DSCResourceName $script:DSCResourceName ` - -ResourceType 'Mof' ` - -TestType Unit -#endregion HEADER +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Global -Force -function Invoke-TestSetup -{ - -} +$script:testEnvironment = Invoke-TestSetup -DSCModuleName $script:dscModuleName -DSCResourceName $script:dscResourceName function Invoke-TestCleanup { - Restore-TestEnvironment -TestEnvironment $TestEnvironment + Restore-TestEnvironment -TestEnvironment $script:testEnvironment } # Begin Testing try { - Invoke-TestSetup - InModuleScope $script:DSCResourceName { Describe 'MSFT_xExchPowershellVirtualDirectory\Get-TargetResource' -Tag 'Get' { AfterEach { @@ -70,3 +48,4 @@ finally { Invoke-TestCleanup } + diff --git a/Tests/Unit/MSFT_xExchReceiveConnector.tests.ps1 b/tests/Unit/MSFT_xExchReceiveConnector.tests.ps1 similarity index 85% rename from Tests/Unit/MSFT_xExchReceiveConnector.tests.ps1 rename to tests/Unit/MSFT_xExchReceiveConnector.tests.ps1 index c3db3cce..afb5ccae 100644 --- a/Tests/Unit/MSFT_xExchReceiveConnector.tests.ps1 +++ b/tests/Unit/MSFT_xExchReceiveConnector.tests.ps1 @@ -1,41 +1,19 @@ -#region HEADER $script:DSCModuleName = 'xExchange' $script:DSCResourceName = 'MSFT_xExchReceiveConnector' - -# Unit Test Template Version: 1.2.4 $script:moduleRoot = Split-Path -Parent (Split-Path -Parent $PSScriptRoot) -if ( (-not (Test-Path -Path (Join-Path -Path $script:moduleRoot -ChildPath 'DSCResource.Tests'))) -or ` - (-not (Test-Path -Path (Join-Path -Path $script:moduleRoot -ChildPath 'DSCResource.Tests\TestHelper.psm1'))) ) -{ - & git @('clone', 'https://github.com/PowerShell/DscResource.Tests.git', (Join-Path -Path $script:moduleRoot -ChildPath 'DscResource.Tests')) -} - -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'DSCResource.Tests' -ChildPath 'TestHelper.psm1')) -Force -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'Tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Global -Force - -$TestEnvironment = Initialize-TestEnvironment ` - -DSCModuleName $script:DSCModuleName ` - -DSCResourceName $script:DSCResourceName ` - -ResourceType 'Mof' ` - -TestType Unit -#endregion HEADER +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Global -Force -function Invoke-TestSetup -{ - -} +$script:testEnvironment = Invoke-TestSetup -DSCModuleName $script:dscModuleName -DSCResourceName $script:dscResourceName function Invoke-TestCleanup { - Restore-TestEnvironment -TestEnvironment $TestEnvironment + Restore-TestEnvironment -TestEnvironment $script:testEnvironment } # Begin Testing try { - Invoke-TestSetup - InModuleScope $script:DSCResourceName { Describe 'MSFT_xExchReceiveConnector\Get-TargetResource' -Tag 'Get' { AfterEach { @@ -115,3 +93,4 @@ finally { Invoke-TestCleanup } + diff --git a/Tests/Unit/MSFT_xExchRemoteDomain.tests.ps1 b/tests/Unit/MSFT_xExchRemoteDomain.tests.ps1 similarity index 94% rename from Tests/Unit/MSFT_xExchRemoteDomain.tests.ps1 rename to tests/Unit/MSFT_xExchRemoteDomain.tests.ps1 index 43f4fb54..db31ae29 100644 --- a/Tests/Unit/MSFT_xExchRemoteDomain.tests.ps1 +++ b/tests/Unit/MSFT_xExchRemoteDomain.tests.ps1 @@ -1,41 +1,19 @@ -#region HEADER $script:DSCModuleName = 'xExchange' $script:DSCResourceName = 'MSFT_xExchRemoteDomain' - -# Unit Test Template Version: 1.2.4 $script:moduleRoot = Split-Path -Parent (Split-Path -Parent $PSScriptRoot) -if ( (-not (Test-Path -Path (Join-Path -Path $script:moduleRoot -ChildPath 'DSCResource.Tests'))) -or ` - (-not (Test-Path -Path (Join-Path -Path $script:moduleRoot -ChildPath 'DSCResource.Tests\TestHelper.psm1'))) ) -{ - & git.exe @('clone', 'https://github.com/PowerShell/DscResource.Tests.git', (Join-Path -Path $script:moduleRoot -ChildPath 'DscResource.Tests')) -} - -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'DSCResource.Tests' -ChildPath 'TestHelper.psm1')) -Force -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'Tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Global -Force - -$TestEnvironment = Initialize-TestEnvironment ` - -DSCModuleName $script:DSCModuleName ` - -DSCResourceName $script:DSCResourceName ` - -ResourceType 'Mof' ` - -TestType Unit -#endregion HEADER +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Global -Force -function Invoke-TestSetup -{ - -} +$script:testEnvironment = Invoke-TestSetup -DSCModuleName $script:dscModuleName -DSCResourceName $script:dscResourceName function Invoke-TestCleanup { - Restore-TestEnvironment -TestEnvironment $TestEnvironment + Restore-TestEnvironment -TestEnvironment $script:testEnvironment } # Begin Testing try { - Invoke-TestSetup - InModuleScope $script:DSCResourceName { function Get-RemoteDomain { @@ -354,3 +332,4 @@ finally { Invoke-TestCleanup } + diff --git a/Tests/Unit/MSFT_xExchSendConnector.tests.ps1 b/tests/Unit/MSFT_xExchSendConnector.tests.ps1 similarity index 95% rename from Tests/Unit/MSFT_xExchSendConnector.tests.ps1 rename to tests/Unit/MSFT_xExchSendConnector.tests.ps1 index 710dd1be..d85c0459 100644 --- a/Tests/Unit/MSFT_xExchSendConnector.tests.ps1 +++ b/tests/Unit/MSFT_xExchSendConnector.tests.ps1 @@ -1,41 +1,19 @@ -#region HEADER $script:DSCModuleName = 'xExchange' $script:DSCResourceName = 'MSFT_xExchSendConnector' - -# Unit Test Template Version: 1.2.4 $script:moduleRoot = Split-Path -Parent (Split-Path -Parent $PSScriptRoot) -if ( (-not (Test-Path -Path (Join-Path -Path $script:moduleRoot -ChildPath 'DSCResource.Tests'))) -or ` - (-not (Test-Path -Path (Join-Path -Path $script:moduleRoot -ChildPath 'DSCResource.Tests\TestHelper.psm1'))) ) -{ - & git.exe @('clone', 'https://github.com/PowerShell/DscResource.Tests.git', (Join-Path -Path $script:moduleRoot -ChildPath 'DscResource.Tests')) -} - -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'DSCResource.Tests' -ChildPath 'TestHelper.psm1')) -Force -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'Tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Global -Force - -$TestEnvironment = Initialize-TestEnvironment ` - -DSCModuleName $script:DSCModuleName ` - -DSCResourceName $script:DSCResourceName ` - -ResourceType 'Mof' ` - -TestType Unit -#endregion HEADER +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Global -Force -function Invoke-TestSetup -{ - -} +$script:testEnvironment = Invoke-TestSetup -DSCModuleName $script:dscModuleName -DSCResourceName $script:dscResourceName function Invoke-TestCleanup { - Restore-TestEnvironment -TestEnvironment $TestEnvironment + Restore-TestEnvironment -TestEnvironment $script:testEnvironment } # Begin Testing try { - Invoke-TestSetup - InModuleScope $script:DSCResourceName { function Get-ADPermission { @@ -452,3 +430,4 @@ finally Invoke-TestCleanup } + diff --git a/tests/Unit/MSFT_xExchTransportService.tests.ps1 b/tests/Unit/MSFT_xExchTransportService.tests.ps1 new file mode 100644 index 00000000..6b1a44a6 --- /dev/null +++ b/tests/Unit/MSFT_xExchTransportService.tests.ps1 @@ -0,0 +1,249 @@ +$script:DSCModuleName = 'xExchange' +$script:DSCResourceName = 'MSFT_xExchTransportService' +$script:moduleRoot = Split-Path -Parent (Split-Path -Parent $PSScriptRoot) + +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Global -Force + +$script:testEnvironment = Invoke-TestSetup -DSCModuleName $script:dscModuleName -DSCResourceName $script:dscResourceName + +function Invoke-TestCleanup +{ + Restore-TestEnvironment -TestEnvironment $script:testEnvironment +} + +# Begin Testing +try +{ + InModuleScope $script:DSCResourceName { + + $commonTargetResourceParams = @{ + Identity = 'TransportService' + Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList 'fakeuser', (New-Object -TypeName System.Security.SecureString) + } + + $commonTransportServiceStandardOutput = @{ + ActiveUserStatisticsLogMaxAge = [System.String] '' + ActiveUserStatisticsLogMaxDirectorySize = [System.String] '' + ActiveUserStatisticsLogMaxFileSize = [System.String] '' + ActiveUserStatisticsLogPath = [System.String] '' + AgentLogEnabled = [System.Boolean] $false + AgentLogMaxAge = [System.String] '' + AgentLogMaxDirectorySize = [System.String] '' + AgentLogMaxFileSize = [System.String] '' + AgentLogPath = [System.String] '' + AntispamAgentsEnabled = [System.Boolean] $false + ConnectivityLogEnabled = [System.Boolean] $false + ConnectivityLogMaxAge = [System.String] '' + ConnectivityLogMaxDirectorySize = [System.String] '' + ConnectivityLogMaxFileSize = [System.String] '' + ConnectivityLogPath = [System.String] '' + ContentConversionTracingEnabled = [System.Boolean] $false + DelayNotificationTimeout = [System.String] '' + DnsLogEnabled = [System.Boolean] $false + DnsLogMaxAge = [System.String] '' + DnsLogMaxDirectorySize = [System.String] '' + DnsLogMaxFileSize = [System.String] '' + DnsLogPath = [System.String] '' + ExternalDNSAdapterEnabled = [System.Boolean] $false + ExternalDNSAdapterGuid = [System.String] '' + ExternalDNSProtocolOption = [System.String] '' + ExternalDNSServers = [System.String[]] @('externaldns.contoso.com') + ExternalIPAddress = [System.String] '1.2.3.4' + InternalDNSAdapterEnabled = [System.Boolean] $false + InternalDNSAdapterGuid = [System.String] '' + InternalDNSProtocolOption = [System.String] '' + InternalDNSServers = [System.String[]] @('internaldns.contoso.com') + IntraOrgConnectorProtocolLoggingLevel = [System.String] '' + IntraOrgConnectorSmtpMaxMessagesPerConnection = [System.Int32] 1 + IrmLogEnabled = [System.Boolean] $false + IrmLogMaxAge = [System.String] '' + IrmLogMaxDirectorySize = [System.String] '' + IrmLogMaxFileSize = [System.String] '' + IrmLogPath = [System.String] '' + MaxConcurrentMailboxDeliveries = [System.Int32] 1 + MaxConcurrentMailboxSubmissions = [System.Int32] 1 + MaxConnectionRatePerMinute = [System.Int32] 1 + MaxOutboundConnections = [System.String] '' + MaxPerDomainOutboundConnections = [System.String] '' + MessageExpirationTimeout = [System.String] '' + MessageRetryInterval = [System.String] '' + MessageTrackingLogEnabled = [System.Boolean] $false + MessageTrackingLogMaxAge = [System.String] '' + MessageTrackingLogMaxDirectorySize = [System.String] '' + MessageTrackingLogMaxFileSize = [System.String] '' + MessageTrackingLogPath = [System.String] '' + MessageTrackingLogSubjectLoggingEnabled = [System.Boolean] $false + OutboundConnectionFailureRetryInterval = [System.String] '' + PickupDirectoryMaxHeaderSize = [System.String] '' + PickupDirectoryMaxMessagesPerMinute = [System.Int32] 1 + PickupDirectoryMaxRecipientsPerMessage = [System.Int32] 1 + PickupDirectoryPath = [System.String] '' + PipelineTracingEnabled = [System.Boolean] $false + PipelineTracingPath = [System.String] '' + PipelineTracingSenderAddress = [System.String] 'pipeline@contoso.com' + PoisonMessageDetectionEnabled = [System.Boolean] $false + PoisonThreshold = [System.Int32] 1 + QueueLogMaxAge = [System.String] '' + QueueLogMaxDirectorySize = [System.String] '' + QueueLogMaxFileSize = [System.String] '' + QueueLogPath = [System.String] '' + QueueMaxIdleTime = [System.String] '' + ReceiveProtocolLogMaxAge = [System.String] '' + ReceiveProtocolLogMaxDirectorySize = [System.String] '' + ReceiveProtocolLogMaxFileSize = [System.String] '' + ReceiveProtocolLogPath = [System.String] '' + RecipientValidationCacheEnabled = [System.Boolean] $false + ReplayDirectoryPath = [System.String] '' + RootDropDirectoryPath = [System.String] '' + RoutingTableLogMaxAge = [System.String] '' + RoutingTableLogMaxDirectorySize = [System.String] '' + RoutingTableLogPath = [System.String] '' + SendProtocolLogMaxAge = [System.String] '' + SendProtocolLogMaxDirectorySize = [System.String] '' + SendProtocolLogMaxFileSize = [System.String] '' + SendProtocolLogPath = [System.String] '' + ServerStatisticsLogMaxAge = [System.String] '' + ServerStatisticsLogMaxDirectorySize = [System.String] '' + ServerStatisticsLogMaxFileSize = [System.String] '' + ServerStatisticsLogPath = [System.String] '' + TransientFailureRetryCount = [System.Int32] 1 + TransientFailureRetryInterval = [System.String] '' + UseDowngradedExchangeServerAuth = [System.Boolean] $false + } + + Mock -CommandName Write-FunctionEntry -Verifiable + + Describe 'MSFT_xExchTransportService\Get-TargetResource' -Tag 'Get' { + # Override Exchange cmdlets + function Get-TransportService + { + } + + Mock -CommandName Get-RemoteExchangeSession -Verifiable + Mock -CommandName Get-TransportService -Verifiable -MockWith { return $commonTransportServiceStandardOutput } + + AfterEach { + Assert-VerifiableMock + } + + Context 'When Get-TargetResource is called' { + Test-CommonGetTargetResourceFunctionality -GetTargetResourceParams $commonTargetResourceParams + } + } + Describe 'MSFT_xExchTransportService\Set-TargetResource' -Tag 'Set' { + # Override Exchange cmdlets + Mock -CommandName Get-RemoteExchangeSession -Verifiable + function Set-TransportService + { + } + + AfterEach { + Assert-VerifiableMock + } + + $setTargetResourceParams = @{ + Identity = 'TransportService' + Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList 'fakeuser', (New-Object -TypeName System.Security.SecureString) + AllowServiceRestart = $true + } + + Context 'When Set-TargetResource is called' { + It 'Should call expected functions when AllowServiceRestart is true' { + Mock -CommandName Set-TransportService -Verifiable + Mock -CommandName Restart-Service -Verifiable + + Set-TargetResource @setTargetResourceParams + } + + It 'Should call expected functions when PipelineTracingSenderAddress is null' { + $PipelineTracingSenderAddress = $setTargetResourceParams.PipelineTracingSenderAddress + $setTargetResourceParams.PipelineTracingSenderAddress = $null + Mock -CommandName Set-TransportService -Verifiable + + Set-TargetResource @setTargetResourceParams + + $setTargetResourceParams.PipelineTracingSenderAddress = $PipelineTracingSenderAddress + } + + It 'Should call expected functions when ExternalIPAddress is null' { + $ExternalIPAddress = $setTargetResourceParams.ExternalIPAddress + $setTargetResourceParams.ExternalIPAddress = $null + Mock -CommandName Set-TransportService -Verifiable + + Set-TargetResource @setTargetResourceParams + + $setTargetResourceParams.ExternalIPAddress = $ExternalIPAddress + } + + It 'Should call expected functions when InternalDNSServers is null' { + $InternalDNSServers = $setTargetResourceParams.InternalDNSServers + $setTargetResourceParams.InternalDNSServers = $null + Mock -CommandName Set-TransportService -Verifiable + + Set-TargetResource @setTargetResourceParams + + $setTargetResourceParams.InternalDNSServers = $InternalDNSServers + } + + It 'Should call expected functions when ExternalDNSServers is null' { + $ExternalDNSServers = $setTargetResourceParams.ExternalDNSServers + $setTargetResourceParams.ExternalDNSServers = $null + Mock -CommandName Set-TransportService -Verifiable + + Set-TargetResource @setTargetResourceParams + + $setTargetResourceParams.ExternalDNSServers = $ExternalDNSServers + } + + It 'Should warn that a MSExchangeTransport service restart is required' { + $AllowServiceRestart = $setTargetResourceParams.AllowServiceRestart + $setTargetResourceParams.AllowServiceRestart = $false + Mock -CommandName Set-TransportService -Verifiable + Mock -CommandName Write-Warning -Verifiable -ParameterFilter { $Message -eq 'The configuration will not take effect until the MSExchangeTransport service is manually restarted.' } + + Set-TargetResource @setTargetResourceParams + $setTargetResourceParams.AllowServiceRestart = $AllowServiceRestart + } + } + } + + Describe 'MSFT_xExchTransportService\Test-TargetResource' -Tag 'Test' { + # Override Exchange cmdlets + Mock -CommandName Get-RemoteExchangeSession -Verifiable + + function Get-TransportService + { + } + + AfterEach { + Assert-VerifiableMock + } + + Context 'When Test-TargetResource is called' { + It 'Should return False when Get-TransportService returns False' { + Mock -CommandName Get-TransportService -Verifiable + + Test-TargetResource @commonTargetResourceParams -ErrorAction SilentlyContinue | Should -Be $false + } + It 'Should return False when Test-ExchangeSetting returns False' { + Mock -CommandName Get-TransportService -Verifiable -MockWith { return $commonTransportServiceStandardOutput } + Mock -CommandName Test-ExchangeSetting -Verifiable -MockWith { return $false } + + Test-TargetResource @commonTargetResourceParams | Should -Be $false + } + + It 'Should return True when Test-ExchangeSetting returns True' { + Mock -CommandName Get-TransportService -Verifiable -MockWith { return $commonTransportServiceStandardOutput } + Mock -CommandName Test-ExchangeSetting -Verifiable -MockWith { return $true } + + Test-TargetResource @commonTargetResourceParams | Should -Be $true + } + } + } + } +} +finally +{ + Invoke-TestCleanup +} + diff --git a/Tests/Unit/MSFT_xExchUMCallRouterSettings.tests.ps1 b/tests/Unit/MSFT_xExchUMCallRouterSettings.tests.ps1 similarity index 81% rename from Tests/Unit/MSFT_xExchUMCallRouterSettings.tests.ps1 rename to tests/Unit/MSFT_xExchUMCallRouterSettings.tests.ps1 index ed16267e..bd14110a 100644 --- a/Tests/Unit/MSFT_xExchUMCallRouterSettings.tests.ps1 +++ b/tests/Unit/MSFT_xExchUMCallRouterSettings.tests.ps1 @@ -1,44 +1,22 @@ [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseSingularNouns', '')] param() -#region HEADER $script:DSCModuleName = 'xExchange' $script:DSCResourceName = 'MSFT_xExchUMCallRouterSettings' - -# Unit Test Template Version: 1.2.4 $script:moduleRoot = Split-Path -Parent (Split-Path -Parent $PSScriptRoot) -if ( (-not (Test-Path -Path (Join-Path -Path $script:moduleRoot -ChildPath 'DSCResource.Tests'))) -or ` - (-not (Test-Path -Path (Join-Path -Path $script:moduleRoot -ChildPath 'DSCResource.Tests\TestHelper.psm1'))) ) -{ - & git @('clone', 'https://github.com/PowerShell/DscResource.Tests.git', (Join-Path -Path $script:moduleRoot -ChildPath 'DscResource.Tests')) -} - -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'DSCResource.Tests' -ChildPath 'TestHelper.psm1')) -Force -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'Tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Global -Force -$TestEnvironment = Initialize-TestEnvironment ` - -DSCModuleName $script:DSCModuleName ` - -DSCResourceName $script:DSCResourceName ` - -ResourceType 'Mof' ` - -TestType Unit +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Global -Force -#endregion HEADER - -function Invoke-TestSetup -{ - -} +$script:testEnvironment = Invoke-TestSetup -DSCModuleName $script:dscModuleName -DSCResourceName $script:dscResourceName function Invoke-TestCleanup { - Restore-TestEnvironment -TestEnvironment $TestEnvironment + Restore-TestEnvironment -TestEnvironment $script:testEnvironment } # Begin Testing try { - Invoke-TestSetup - InModuleScope $script:DSCResourceName { $commonTargetResourceParams = @{ @@ -60,7 +38,9 @@ try Describe 'MSFT_xExchUMCallRouterSettings\Get-TargetResource' -Tag 'Get' { # Override Exchange cmdlets - function Get-UMCallRouterSettings {} + function Get-UMCallRouterSettings + { + } AfterEach { Assert-VerifiableMock @@ -78,7 +58,9 @@ try Describe 'MSFT_xExchUMCallRouterSettings\Set-TargetResource' -Tag 'Set' { # Override Exchange cmdlets - function Set-UMCallRouterSettings {} + function Set-UMCallRouterSettings + { + } AfterEach { Assert-VerifiableMock @@ -98,8 +80,12 @@ try Describe 'MSFT_xExchUMCallRouterSettings\Test-TargetResource' -Tag 'Test' { # Override Exchange cmdlets - function Get-UMCallRouterSettings {} - function Test-ExchangeSetting{} + function Get-UMCallRouterSettings + { + } + function Test-ExchangeSetting + { + } AfterEach { Assert-VerifiableMock diff --git a/Tests/Unit/MSFT_xExchUMService.tests.ps1 b/tests/Unit/MSFT_xExchUMService.tests.ps1 similarity index 72% rename from Tests/Unit/MSFT_xExchUMService.tests.ps1 rename to tests/Unit/MSFT_xExchUMService.tests.ps1 index 5982f5ca..a27f32da 100644 --- a/Tests/Unit/MSFT_xExchUMService.tests.ps1 +++ b/tests/Unit/MSFT_xExchUMService.tests.ps1 @@ -1,41 +1,19 @@ -#region HEADER $script:DSCModuleName = 'xExchange' $script:DSCResourceName = 'MSFT_xExchUMService' - -# Unit Test Template Version: 1.2.4 $script:moduleRoot = Split-Path -Parent (Split-Path -Parent $PSScriptRoot) -if ( (-not (Test-Path -Path (Join-Path -Path $script:moduleRoot -ChildPath 'DSCResource.Tests'))) -or ` - (-not (Test-Path -Path (Join-Path -Path $script:moduleRoot -ChildPath 'DSCResource.Tests\TestHelper.psm1'))) ) -{ - & git @('clone', 'https://github.com/PowerShell/DscResource.Tests.git', (Join-Path -Path $script:moduleRoot -ChildPath 'DscResource.Tests')) -} - -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'DSCResource.Tests' -ChildPath 'TestHelper.psm1')) -Force -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'Tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Global -Force - -$TestEnvironment = Initialize-TestEnvironment ` - -DSCModuleName $script:DSCModuleName ` - -DSCResourceName $script:DSCResourceName ` - -ResourceType 'Mof' ` - -TestType Unit -#endregion HEADER +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Global -Force -function Invoke-TestSetup -{ - -} +$script:testEnvironment = Invoke-TestSetup -DSCModuleName $script:dscModuleName -DSCResourceName $script:dscResourceName function Invoke-TestCleanup { - Restore-TestEnvironment -TestEnvironment $TestEnvironment + Restore-TestEnvironment -TestEnvironment $script:testEnvironment } # Begin Testing try { - Invoke-TestSetup - InModuleScope $script:DSCResourceName { Describe 'MSFT_xExchUMService\Get-TargetResource' -Tag 'Get' { # Override Exchange cmdlets @@ -82,3 +60,4 @@ finally { Invoke-TestCleanup } + diff --git a/Tests/Unit/MSFT_xExchWaitForADPrep.tests.ps1 b/tests/Unit/MSFT_xExchWaitForADPrep.tests.ps1 similarity index 94% rename from Tests/Unit/MSFT_xExchWaitForADPrep.tests.ps1 rename to tests/Unit/MSFT_xExchWaitForADPrep.tests.ps1 index 9fa42410..dff4570c 100644 --- a/Tests/Unit/MSFT_xExchWaitForADPrep.tests.ps1 +++ b/tests/Unit/MSFT_xExchWaitForADPrep.tests.ps1 @@ -1,41 +1,19 @@ -#region HEADER $script:DSCModuleName = 'xExchange' $script:DSCResourceName = 'MSFT_xExchWaitForADPrep' - -# Unit Test Template Version: 1.2.4 $script:moduleRoot = Split-Path -Parent (Split-Path -Parent $PSScriptRoot) -if ( (-not (Test-Path -Path (Join-Path -Path $script:moduleRoot -ChildPath 'DSCResource.Tests'))) -or ` - (-not (Test-Path -Path (Join-Path -Path $script:moduleRoot -ChildPath 'DSCResource.Tests\TestHelper.psm1'))) ) -{ - & git @('clone', 'https://github.com/PowerShell/DscResource.Tests.git', (Join-Path -Path $script:moduleRoot -ChildPath 'DscResource.Tests')) -} - -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'DSCResource.Tests' -ChildPath 'TestHelper.psm1')) -Force -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'Tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Global -Force - -$TestEnvironment = Initialize-TestEnvironment ` - -DSCModuleName $script:DSCModuleName ` - -DSCResourceName $script:DSCResourceName ` - -ResourceType 'Mof' ` - -TestType Unit -#endregion HEADER +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Global -Force -function Invoke-TestSetup -{ - -} +$script:testEnvironment = Invoke-TestSetup -DSCModuleName $script:dscModuleName -DSCResourceName $script:dscResourceName function Invoke-TestCleanup { - Restore-TestEnvironment -TestEnvironment $TestEnvironment + Restore-TestEnvironment -TestEnvironment $script:testEnvironment } # Begin Testing try { - Invoke-TestSetup - InModuleScope $script:DSCResourceName { Describe 'MSFT_xExchWaitForADPrep\Get-TargetResource' -Tag 'Get' { # Override Active Directory cmdlets @@ -460,3 +438,4 @@ finally { Invoke-TestCleanup } + diff --git a/Tests/Unit/MSFT_xExchWaitForDAG.tests.ps1 b/tests/Unit/MSFT_xExchWaitForDAG.tests.ps1 similarity index 91% rename from Tests/Unit/MSFT_xExchWaitForDAG.tests.ps1 rename to tests/Unit/MSFT_xExchWaitForDAG.tests.ps1 index 158f79b4..ab1b98a9 100644 --- a/Tests/Unit/MSFT_xExchWaitForDAG.tests.ps1 +++ b/tests/Unit/MSFT_xExchWaitForDAG.tests.ps1 @@ -1,41 +1,19 @@ -#region HEADER $script:DSCModuleName = 'xExchange' $script:DSCResourceName = 'MSFT_xExchWaitForDAG' - -# Unit Test Template Version: 1.2.4 $script:moduleRoot = Split-Path -Parent (Split-Path -Parent $PSScriptRoot) -if ( (-not (Test-Path -Path (Join-Path -Path $script:moduleRoot -ChildPath 'DSCResource.Tests'))) -or ` - (-not (Test-Path -Path (Join-Path -Path $script:moduleRoot -ChildPath 'DSCResource.Tests\TestHelper.psm1'))) ) -{ - & git @('clone', 'https://github.com/PowerShell/DscResource.Tests.git', (Join-Path -Path $script:moduleRoot -ChildPath 'DscResource.Tests')) -} - -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'DSCResource.Tests' -ChildPath 'TestHelper.psm1')) -Force -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'Tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Global -Force - -$TestEnvironment = Initialize-TestEnvironment ` - -DSCModuleName $script:DSCModuleName ` - -DSCResourceName $script:DSCResourceName ` - -ResourceType 'Mof' ` - -TestType Unit -#endregion HEADER +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Global -Force -function Invoke-TestSetup -{ - -} +$script:testEnvironment = Invoke-TestSetup -DSCModuleName $script:dscModuleName -DSCResourceName $script:dscResourceName function Invoke-TestCleanup { - Restore-TestEnvironment -TestEnvironment $TestEnvironment + Restore-TestEnvironment -TestEnvironment $script:testEnvironment } # Begin Testing try { - Invoke-TestSetup - InModuleScope $script:DSCResourceName { $basicTargetResourceParams = @{ Identity = 'DAGName' @@ -254,3 +232,4 @@ finally { Invoke-TestCleanup } + diff --git a/Tests/Unit/MSFT_xExchWaitForMailboxDatabase.tests.ps1 b/tests/Unit/MSFT_xExchWaitForMailboxDatabase.tests.ps1 similarity index 62% rename from Tests/Unit/MSFT_xExchWaitForMailboxDatabase.tests.ps1 rename to tests/Unit/MSFT_xExchWaitForMailboxDatabase.tests.ps1 index 9a2dcc07..d89938d4 100644 --- a/Tests/Unit/MSFT_xExchWaitForMailboxDatabase.tests.ps1 +++ b/tests/Unit/MSFT_xExchWaitForMailboxDatabase.tests.ps1 @@ -1,48 +1,28 @@ [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseSingularNouns', '')] param() -#region HEADER $script:DSCModuleName = 'xExchange' $script:DSCResourceName = 'MSFT_xExchWaitForMailboxDatabase' - -# Unit Test Template Version: 1.2.4 $script:moduleRoot = Split-Path -Parent (Split-Path -Parent $PSScriptRoot) -if ( (-not (Test-Path -Path (Join-Path -Path $script:moduleRoot -ChildPath 'DSCResource.Tests'))) -or ` - (-not (Test-Path -Path (Join-Path -Path $script:moduleRoot -ChildPath 'DSCResource.Tests\TestHelper.psm1'))) ) -{ - & git @('clone', 'https://github.com/PowerShell/DscResource.Tests.git', (Join-Path -Path $script:moduleRoot -ChildPath 'DscResource.Tests')) -} - -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'DSCResource.Tests' -ChildPath 'TestHelper.psm1')) -Force -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'Tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Global -Force - -$TestEnvironment = Initialize-TestEnvironment ` - -DSCModuleName $script:DSCModuleName ` - -DSCResourceName $script:DSCResourceName ` - -ResourceType 'Mof' ` - -TestType Unit -#endregion HEADER +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Global -Force -function Invoke-TestSetup -{ - -} +$script:testEnvironment = Invoke-TestSetup -DSCModuleName $script:dscModuleName -DSCResourceName $script:dscResourceName function Invoke-TestCleanup { - Restore-TestEnvironment -TestEnvironment $TestEnvironment + Restore-TestEnvironment -TestEnvironment $script:testEnvironment } # Begin Testing try { - Invoke-TestSetup - InModuleScope $script:DSCResourceName { Describe 'MSFT_xExchWaitForMailboxDatabase\Get-TargetResource' -Tag 'Get' { # Override Exchange cmdlets - function Set-ADServerSettings {} + function Set-ADServerSettings + { + } AfterEach { Assert-VerifiableMock diff --git a/Tests/Unit/MSFT_xExchWebServicesVirtualDirectory.tests.ps1 b/tests/Unit/MSFT_xExchWebServicesVirtualDirectory.tests.ps1 similarity index 73% rename from Tests/Unit/MSFT_xExchWebServicesVirtualDirectory.tests.ps1 rename to tests/Unit/MSFT_xExchWebServicesVirtualDirectory.tests.ps1 index 96fa1c98..50985f7c 100644 --- a/Tests/Unit/MSFT_xExchWebServicesVirtualDirectory.tests.ps1 +++ b/tests/Unit/MSFT_xExchWebServicesVirtualDirectory.tests.ps1 @@ -1,41 +1,19 @@ -#region HEADER $script:DSCModuleName = 'xExchange' $script:DSCResourceName = 'MSFT_xExchWebServicesVirtualDirectory' - -# Unit Test Template Version: 1.2.4 $script:moduleRoot = Split-Path -Parent (Split-Path -Parent $PSScriptRoot) -if ( (-not (Test-Path -Path (Join-Path -Path $script:moduleRoot -ChildPath 'DSCResource.Tests'))) -or ` - (-not (Test-Path -Path (Join-Path -Path $script:moduleRoot -ChildPath 'DSCResource.Tests\TestHelper.psm1'))) ) -{ - & git @('clone', 'https://github.com/PowerShell/DscResource.Tests.git', (Join-Path -Path $script:moduleRoot -ChildPath 'DscResource.Tests')) -} - -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'DSCResource.Tests' -ChildPath 'TestHelper.psm1')) -Force -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'Tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Global -Force - -$TestEnvironment = Initialize-TestEnvironment ` - -DSCModuleName $script:DSCModuleName ` - -DSCResourceName $script:DSCResourceName ` - -ResourceType 'Mof' ` - -TestType Unit -#endregion HEADER +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Global -Force -function Invoke-TestSetup -{ - -} +$script:testEnvironment = Invoke-TestSetup -DSCModuleName $script:dscModuleName -DSCResourceName $script:dscResourceName function Invoke-TestCleanup { - Restore-TestEnvironment -TestEnvironment $TestEnvironment + Restore-TestEnvironment -TestEnvironment $script:testEnvironment } # Begin Testing try { - Invoke-TestSetup - InModuleScope $script:DSCResourceName { Describe 'MSFT_xExchWebServicesVirtualDirectory\Get-TargetResource' -Tag 'Get' { # Override Exchange cmdlets @@ -81,3 +59,4 @@ finally { Invoke-TestCleanup } + diff --git a/Tests/Unit/xExchangeCalculatorHelper.tests.ps1 b/tests/Unit/xExchangeCalculatorHelper.tests.ps1 similarity index 87% rename from Tests/Unit/xExchangeCalculatorHelper.tests.ps1 rename to tests/Unit/xExchangeCalculatorHelper.tests.ps1 index 03d69cf2..e6a3f0d6 100644 --- a/Tests/Unit/xExchangeCalculatorHelper.tests.ps1 +++ b/tests/Unit/xExchangeCalculatorHelper.tests.ps1 @@ -1,30 +1,29 @@ #region HEADER -$script:DSCModuleName = 'xExchange' -$script:DSCHelperName = "xExchangeCalculatorHelper" +$script:projectPath = "$PSScriptRoot\..\.." | Convert-Path +$script:projectName = (Get-ChildItem -Path "$script:projectPath\*\*.psd1" | Where-Object -FilterScript { + ($_.Directory.Name -match 'source|src' -or $_.Directory.Name -eq $_.BaseName) -and + $(try + { Test-ModuleManifest -Path $_.FullName -ErrorAction Stop + } + catch + { $false + }) + }).BaseName -# Unit Test Template Version: 1.2.2 -$script:moduleRoot = Split-Path -Parent (Split-Path -Parent $PSScriptRoot) +$script:parentModule = Get-Module -Name $script:projectName -ListAvailable | Select-Object -First 1 +$script:subModulesFolder = Join-Path -Path $script:parentModule.ModuleBase -ChildPath 'Modules' +Remove-Module -Name $script:parentModule -Force -ErrorAction 'SilentlyContinue' -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'Modules' -ChildPath 'xExchangeCalculatorHelper.psm1')) -Force +$script:subModuleName = (Split-Path -Path $PSCommandPath -Leaf) -replace '\.Tests.ps1' +$script:subModuleFile = Join-Path -Path $script:subModulesFolder -ChildPath "$($script:subModuleName)" +Import-Module $script:subModuleFile -Force -ErrorAction Stop +Import-Module -Name (Join-Path -Path $script:projectPath -ChildPath (Join-Path -Path 'tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Global -Force #endregion HEADER - -function Invoke-TestSetup -{ - -} - -function Invoke-TestCleanup -{ - -} - # Begin Testing try { - Invoke-TestSetup - - InModuleScope $script:DSCHelperName { + InModuleScope $script:subModuleName { $validServerName = 'srv-nn-01' $invalidServerName = 'srv-nn-05' @@ -82,9 +81,9 @@ try Mock -CommandName Test-Path -Verifiable -MockWith { return $true } Mock -CommandName Import-Csv -Verifiable -MockWith { return (New-Object -TypeName PSObject -Property @{ - ServerName = 'srv-nn-01' - DbPerVolume = 0 - }) + ServerName = 'srv-nn-01' + DbPerVolume = 0 + }) } { Get-DBMapFromServersCsv -ServersCsvPath $serversLatestCsvPath -ServerNameInCsv $validServerName } | ` @@ -97,10 +96,10 @@ try Mock -CommandName Test-Path -Verifiable -MockWith { return $true } Mock -CommandName Import-Csv -Verifiable -MockWith { return (New-Object -TypeName PSObject -Property @{ - ServerName = $validServerName - DbPerVolume = 4 - DbMap = '' - }) + ServerName = $validServerName + DbPerVolume = 4 + DbMap = '' + }) } { Get-DBMapFromServersCsv -ServersCsvPath $serversLatestCsvPath -ServerNameInCsv $validServerName } | ` @@ -226,9 +225,9 @@ try } $noModificationStrings = @( - @{StringIn = 'aBc'}, - @{StringIn = ''}, - @{StringIn = 'a b c'} + @{StringIn = 'aBc' }, + @{StringIn = '' }, + @{StringIn = 'a b c' } ) Context 'When Replacements is either not specified or is empty' { @@ -284,5 +283,5 @@ try } finally { - Invoke-TestCleanup } + diff --git a/Tests/Unit/xExchangeHelper.tests.ps1 b/tests/Unit/xExchangeHelper.tests.ps1 similarity index 99% rename from Tests/Unit/xExchangeHelper.tests.ps1 rename to tests/Unit/xExchangeHelper.tests.ps1 index caeb9332..47069b19 100644 --- a/Tests/Unit/xExchangeHelper.tests.ps1 +++ b/tests/Unit/xExchangeHelper.tests.ps1 @@ -2,32 +2,26 @@ param() #region HEADER -$script:DSCModuleName = 'xExchange' -$script:DSCHelperName = "xExchangeHelper" +$script:projectPath = "$PSScriptRoot\..\.." | Convert-Path +$script:projectName = (Get-ChildItem -Path "$script:projectPath\*\*.psd1" | Where-Object -FilterScript { + ($_.Directory.Name -match 'source|src' -or $_.Directory.Name -eq $_.BaseName) -and + $(try { Test-ModuleManifest -Path $_.FullName -ErrorAction Stop } catch { $false }) + }).BaseName -# Unit Test Template Version: 1.2.2 -$script:moduleRoot = Split-Path -Parent (Split-Path -Parent $PSScriptRoot) +$script:parentModule = Get-Module -Name $script:projectName -ListAvailable | Select-Object -First 1 +$script:subModulesFolder = Join-Path -Path $script:parentModule.ModuleBase -ChildPath 'Modules' +Remove-Module -Name $script:parentModule -Force -ErrorAction 'SilentlyContinue' -Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'Modules' -ChildPath 'xExchangeHelper.psm1')) -Force +$script:subModuleName = (Split-Path -Path $PSCommandPath -Leaf) -replace '\.Tests.ps1' +$script:subModuleFile = Join-Path -Path $script:subModulesFolder -ChildPath "$($script:subModuleName)" +Import-Module $script:subModuleFile -Force -ErrorAction Stop +Import-Module -Name (Join-Path -Path $script:projectPath -ChildPath (Join-Path -Path 'tests' -ChildPath (Join-Path -Path 'TestHelpers' -ChildPath 'xExchangeTestHelper.psm1'))) -Global -Force #endregion HEADER - -function Invoke-TestSetup -{ - -} - -function Invoke-TestCleanup -{ - -} - # Begin Testing try { - Invoke-TestSetup - - InModuleScope $script:DSCHelperName { + InModuleScope $script:subModuleName { # Get a unique Guid that doesn't resolve to a local path # Use System.Guid, as New-Guid isn't available in PS4 and below do @@ -3091,7 +3085,7 @@ try # Store the previous $global:DSCMachineStatus value $prevDSCMachineStatus = $global:DSCMachineStatus - + # Set and test for the new value Set-DSCMachineStatus -NewDSCMachineStatus $newValue $global:DSCMachineStatus | Should -Be $newValue @@ -3105,5 +3099,5 @@ try } finally { - Invoke-TestCleanup } + diff --git a/xExchange.psd1 b/xExchange.psd1 deleted file mode 100644 index fa50e7c3..00000000 --- a/xExchange.psd1 +++ /dev/null @@ -1,71 +0,0 @@ -@{ - # Version number of this module. - moduleVersion = '1.30.0.0' - - # ID used to uniquely identify this module - GUID = '9a908ca3-8a67-485c-a014-66ba37fcc2a4' - - # Author of this module - Author = 'Microsoft Corporation' - - # Company or vendor of this module - CompanyName = 'Microsoft Corporation' - - # Copyright statement for this module - Copyright = '(c) 2018 Microsoft Corporation. All rights reserved.' - - # Description of the functionality provided by this module - Description = 'Module with DSC Resources for deployment and configuration of Microsoft Exchange Server.' - - # Minimum version of the Windows PowerShell engine required by this module - PowerShellVersion = '4.0' - - # Modules to import as nested modules of the module specified in RootModule/ModuleToProcess - NestedModules = @("Modules\xExchangeHelper.psm1") - - # Functions to export from this module - FunctionsToExport = '*' - - # Cmdlets to export from this module - CmdletsToExport = '*' - - # Private data to pass to the module specified in RootModule/ModuleToProcess. - # This may also contain a PSData hashtable with additional module metadata used by PowerShell. - PrivateData = @{ - - PSData = @{ - - # Tags applied to this module. These help with module discovery in online galleries. - Tags = @('DesiredStateConfiguration', 'DSC', 'DSCResourceKit', 'DSCResource') - - # A URL to the license for this module. - LicenseUri = 'https://github.com/PowerShell/xExchange/blob/master/LICENSE' - - # A URL to the main website for this project. - ProjectUri = 'https://github.com/PowerShell/xExchange' - - # A URL to an icon representing this module. - # IconUri = '' - - # ReleaseNotes of this module - ReleaseNotes = '- Resolved custom Script Analyzer rules that was added to the test framework. -- Added xExchAcceptedDomain resource -- Resolved hashtable styling issues -- Added xExchRemoteDomain resource - -' - - } # End of PSData hashtable - - } # End of PrivateData hashtable -} - - - - - - - - - -