Table of Contents

Class TestHelper

Namespace
SunamoTest
Assembly
SunamoTest.dll

Provides helper methods for initializing and managing test environments.

public class TestHelper
Inheritance
TestHelper
Inherited Members
Extension Methods

Methods

DefaultFolderPath()

Returns the default folder path for test files based on the current application name and project.

public static string DefaultFolderPath()

Returns

string

The default folder path.

FolderForTestFiles(object)

Returns the backslash-terminated folder path for test files of the specified feature.

public static string FolderForTestFiles(object featureOrType)

Parameters

featureOrType object

A Type, string, or object whose class name identifies the feature.

Returns

string

The folder path for test files.

GetFileInProjectsFolder(string, string)

Returns the full path to a file relative to the project folder within the specified base directory. The path is combined with ThisApp.Name and ThisApp.Project.

public static string GetFileInProjectsFolder(string projectsBasePath, string fileRelativeToProjectPath)

Parameters

projectsBasePath string

The base directory containing the projects.

fileRelativeToProjectPath string

The file path relative to the project folder.

Returns

string

The full path to the file.

Init()

Initializes the test environment with default application name "sunamo".

public static void Init()

Init(string)

Initializes the test environment with the specified application name.

public static void Init(string appName)

Parameters

appName string

The name of the application to initialize for testing.

RefreshOriginalFiles(string, object, string, bool, bool)

Refreshes the original test files by copying them from the original folder to the working folder. Optionally replaces occurrences of "_Original" in file names and content.

public static Task<List<string>> RefreshOriginalFiles(string baseFolder, object featureOrType, string modeOfFeature, bool isCopyingFilesRecursively, bool isReplacingOriginal)

Parameters

baseFolder string

The base folder path. If null, uses the default folder path.

featureOrType object

A Type, string, or object whose class name identifies the feature.

modeOfFeature string

An optional subfolder mode within the feature folder. Can be null or empty.

isCopyingFilesRecursively bool

Whether to copy files from subfolders recursively.

isReplacingOriginal bool

Whether to replace "_Original" in file names and content.

Returns

Task<List<string>>

A list of file paths in the working folder after refresh.

TestFile(object, string)

Returns the full path to a test file within the feature's test folder.

public static string TestFile(object featureOrType, string fileName)

Parameters

featureOrType object

A Type, string, or object whose class name identifies the feature.

fileName string

The name of the test file.

Returns

string

The full path to the test file.