Added Unit Tests

This commit is contained in:
GraceSolutions
2025-04-10 16:13:59 -04:00
parent 2a80e82288
commit 992e8b8695
15 changed files with 1109 additions and 36 deletions
+10 -19
View File
@@ -3,42 +3,33 @@
# Set the configuration
$Configuration = "Release"
# Find MSBuild
$msbuildPath = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\MSBuild.exe"
if (-not (Test-Path $msbuildPath)) {
$msbuildPath = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe"
}
if (-not (Test-Path $msbuildPath)) {
$msbuildPath = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin\MSBuild.exe"
}
if (-not (Test-Path $msbuildPath)) {
$msbuildPath = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\MSBuild.exe"
}
if (-not (Test-Path $msbuildPath)) {
# Try to find MSBuild in the PATH
$msbuildPath = "MSBuild.exe"
# Check if dotnet CLI is available
$dotnetPath = Get-Command dotnet -ErrorAction SilentlyContinue | Select-Object -ExpandProperty Source
if (-not $dotnetPath) {
Write-Host "The .NET SDK is not installed or not in the PATH. Please install the .NET SDK." -ForegroundColor Red
exit 1
}
# Clean the solution
Write-Host "Cleaning solution..." -ForegroundColor Cyan
& $msbuildPath WindowsNotifications.sln /t:Clean /p:Configuration=$Configuration
dotnet clean WindowsNotifications.sln --configuration $Configuration
# Restore NuGet packages
Write-Host "Restoring NuGet packages..." -ForegroundColor Cyan
& $msbuildPath WindowsNotifications.sln /t:Restore /p:Configuration=$Configuration
dotnet restore WindowsNotifications.sln
# Build the solution
Write-Host "Building solution..." -ForegroundColor Cyan
& $msbuildPath WindowsNotifications.sln /t:Build /p:Configuration=$Configuration
dotnet build WindowsNotifications.sln --configuration $Configuration --no-restore
# Check if the build was successful
if ($LASTEXITCODE -eq 0) {
Write-Host "Build completed successfully!" -ForegroundColor Green
# Show the output directory
$outputDir = Join-Path -Path $PSScriptRoot -ChildPath "WindowsNotifications\bin\$Configuration"
Write-Host "Output directory: $outputDir" -ForegroundColor Yellow
# List the files in the output directory
Get-ChildItem -Path $outputDir | Format-Table Name, Length
} else {