Skip to content

Tomcanter/unit test scaffold - #2

Open
tcanter wants to merge 4 commits into
mainfrom
tomcanter/unit-test-scaffold
Open

Tomcanter/unit test scaffold#2
tcanter wants to merge 4 commits into
mainfrom
tomcanter/unit-test-scaffold

Conversation

@tcanter

@tcanter tcanter commented Apr 24, 2026

Copy link
Copy Markdown
Member

Summary

Finalize Stage 1 unit testing scaffold for BizTalk WinSCP installer code.

What this PR adds

  • Extracted core testable function module:
    • Resolve-WinSCPPackageLayout in src/InstallWinSCPForBizTalk.Core.psm1
  • Added first unit test suite:
    • tests/Unit/Resolve-WinSCPPackageLayout.Tests.ps1
  • Added/updated test documentation and test inventory:
    • tests/README.md
  • Added repository ignore rules:
    • .gitignore

Test hardening and compatibility updates

  • Added parameter validation attributes to core function inputs:
    • Mandatory + ValidateNotNullOrEmpty
  • Updated assertions to Pester 5 syntax (Should -Be, Should -Match, etc.)
  • Added a clear Pester 5+ guard in the test file with actionable install guidance
  • Kept and documented historical WinSCP NuGet DLL path compatibility:
    • lib/netstandard2.0, lib/netstandard, lib/net, lib

Validation

  • Pester 5 test run passes:
    • Passed: 4
    • Failed: 0

Notes for reviewers

  • This PR is intentionally scoped to Stage 1 scaffolding only.
  • No functional installer flow changes are introduced here beyond testability and compatibility comments in extracted core logic.

tcanter added 4 commits April 23, 2026 16:29
Refactor and harden the installer behavior introduced in the CU6 rewrite, with focus on PowerShell-native safety patterns, clearer UX, and reliable failure handling.

- Simplify script help metadata by condensing SYNOPSIS/DESCRIPTION into concise, user-facing guidance.

- Align execution semantics with standard PowerShell behavior via CmdletBinding(SupportsShouldProcess) and proper WhatIf/Confirm handling.

- Correct ForceInstall behavior so prerequisite work (including folder setup) still runs when ForceInstall is specified.

- Add early elevation guardrails to fail fast on non-admin ForceInstall before download/copy work begins.

- Fix output signaling so error messages render in red and improve ForceInstall-specific messaging.

- Improve reliability of install operations by replacing Invoke-Expression with the native call operator and wrapping copy operations in try/catch with -ErrorAction Stop.

- Improve terminal outcome reporting by distinguishing prerequisite failures from runtime installation failures.

- Harden CU detection against uninstall DisplayName variation by using normalized regex matching for BizTalk version and KB/CU markers, while preserving KB-first certainty for mapping.
Extract Resolve-WinSCPPackageLayout into testable core module. Add basic Pester test suite demonstrating mocking patterns for file system operations. Include testing guide for running and extending test suite.
Add Test Suite section listing current tests (Resolve-WinSCPPackageLayout) and planned tests (CU detection, admin checks, install flow). Provides quick reference for test coverage and development roadmap.
Finalize Stage 1 unit testing scaffold by hardening the extracted core function and test suite. Add parameter validation for required inputs, adopt Pester 5 assertion syntax, add a clear Pester 5+ version gate, and document intentional compatibility paths for historical WinSCP package layouts.

Also include repository .gitignore updates and test-suite documentation updates for ongoing test inventory and roadmap.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants