Option Explicit

Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")

Dim testsRoot
testsRoot = fso.GetParentFolderName(WScript.ScriptFullName)

Dim sourceFile
sourceFile = fso.BuildPath(testsRoot, "web.config")

If Not fso.FileExists(sourceFile) Then
    WScript.Echo "Source config not found: " & sourceFile
    WScript.Quit 1
End If

Call CopyConfig(sourceFile, fso.BuildPath(fso.BuildPath(testsRoot, "unit"), "web.config"))
Call CopyConfig(sourceFile, fso.BuildPath(fso.BuildPath(testsRoot, "component"), "web.config"))
Call CopyConfig(sourceFile, fso.BuildPath(fso.BuildPath(testsRoot, "integration"), "web.config"))

WScript.Echo "Mirrored test web.config files updated."

Sub CopyConfig(sourcePath, targetPath)
    Call fso.CopyFile(sourcePath, targetPath, True)
End Sub
