TestVelopackLocator class
Namespace: Velopack.Locators
Provides a mock / test implementation of VelopackLocator. This can be used to verify that
your application is able to find and prepare updates from your chosen update source without actually
having an installed application. This could be used in a CI/CD pipeline, or unit tests etc.
[ExcludeFromCodeCoverage]
public class TestVelopackLocator : VelopackLocator, IVelopackLocator, IProcessImpl
Inherits: VelopackLocator
Implements: IVelopackLocator, IProcessImpl
Constructors
| Constructor | Summary |
|---|---|
TestVelopackLocator | Provides a mock / test implementation of VelopackLocator. This can be used to verify that |
TestVelopackLocator | Provides a mock / test implementation of VelopackLocator. This can be used to verify that |
TestVelopackLocator(appId, version, packagesDir, logger)
public TestVelopackLocator(string appId, string version, string packagesDir, IVelopackLogger? logger = null)
Provides a mock / test implementation of VelopackLocator. This can be used to verify that
your application is able to find and prepare updates from your chosen update source without actually
having an installed application. This could be used in a CI/CD pipeline, or unit tests etc.
Parameters
| Name | Type | Description |
|---|---|---|
appId | string | |
version | string | |
packagesDir | string | |
logger | IVelopackLogger |
TestVelopackLocator(appId, version, packagesDir, appDir, rootDir, updateExe, channel, logger, localPackage, processPath)
public TestVelopackLocator(string appId, string version, string packagesDir, string? appDir, string? rootDir, string? updateExe, string? channel = null, IVelopackLogger? logger = null, VelopackAsset? localPackage = null, string processPath = null)
Provides a mock / test implementation of VelopackLocator. This can be used to verify that
your application is able to find and prepare updates from your chosen update source without actually
having an installed application. This could be used in a CI/CD pipeline, or unit tests etc.
Parameters
| Name | Type | Description |
|---|---|---|
appId | string | |
version | string | |
packagesDir | string | |
appDir | string | |
rootDir | string | |
updateExe | string | |
channel | string | |
logger | IVelopackLogger | |
localPackage | VelopackAsset | |
processPath | string |
Properties
| Property | Summary |
|---|---|
AppId | The unique application Id. This is used in various app paths. |
RootAppDir | The root directory of the application. On Windows, this folder contains all |
PackagesDir | The directory in which nupkg files are stored for this application. |
UpdateExePath | The path to the current Update.exe or similar on other operating systems. |
CurrentlyInstalledVersion | The currently installed version of the application, or null if the app is not installed. |
AppContentDir | The directory in which versioned application files are stored. |
Channel | The release channel this package was built for. |
Log | The logging interface to use for Velopack diagnostic messages. |
Process | Provides an abstraction for dealing with the dotnet Process API. This is used to start processes and |
ExitCode |
AppId
public override string? AppId { get; }
The unique application Id. This is used in various app paths.
RootAppDir
public override string? RootAppDir { get; }
The root directory of the application. On Windows, this folder contains all the application files, but that may not be the case on other operating systems.
PackagesDir
public override string? PackagesDir { get; }
The directory in which nupkg files are stored for this application.
UpdateExePath
public override string? UpdateExePath { get; }
The path to the current Update.exe or similar on other operating systems.
CurrentlyInstalledVersion
public override SemanticVersion? CurrentlyInstalledVersion { get; }
The currently installed version of the application, or null if the app is not installed.
AppContentDir
public override string? AppContentDir { get; }
The directory in which versioned application files are stored.
Channel
public override string? Channel { get; }
The release channel this package was built for.
Log
public override IVelopackLogger Log { get; }
The logging interface to use for Velopack diagnostic messages.
Process
public override IProcessImpl Process { get; }
Provides an abstraction for dealing with the dotnet Process API. This is used to start processes and get information about the current process.
ExitCode
public int? ExitCode { get; }
Methods
| Method | Summary |
|---|---|
GetLatestLocalFullPackage | Finds latest .nupkg file in the PackagesDir or null if not found. |
GetCurrentProcessPath | Gets the full path to the current process executable. |
GetCurrentProcessId | Gets the process ID of the current process. |
StartProcess | Starts a new process with the specified executable path, arguments, and options. |
Exit | Exit the current process with the given exit code. |
GetLatestLocalFullPackage()
public override VelopackAsset? GetLatestLocalFullPackage()
Finds latest .nupkg file in the PackagesDir or null if not found.
Returns VelopackAsset
GetCurrentProcessPath()
public string GetCurrentProcessPath()
Gets the full path to the current process executable.
Returns string — The full path to the current process executable.
GetCurrentProcessId()
public uint GetCurrentProcessId()
Gets the process ID of the current process.
Returns uint — The process ID of the current process.
StartProcess(exePath, args, workDir, showWindow)
public void StartProcess(string exePath, IEnumerable<string> args, string workDir, bool showWindow)
Starts a new process with the specified executable path, arguments, and options.
Parameters
| Name | Type | Description |
|---|---|---|
exePath | string | The path to the executable to start. |
args | IEnumerable<string> | The command-line arguments to pass to the process. |
workDir | string | The working directory for the new process. |
showWindow | bool | Whether to show a window for the new process. |
Exit(exitCode)
public void Exit(int exitCode)
Exit the current process with the given exit code.
Parameters
| Name | Type | Description |
|---|---|---|
exitCode | int | The exit code |
Generated from Velopack 1.1.1