TestsHandlingType Enumeration

Assembly: CodeEffects.Rule.Repository.dll
Namespace: CodeEffects.Rule.Repository.Common

Summary

Specifies what happens to the existing tests of a source object when Context.SyncSources(..) creates a new version of it: copied or moved from the production version or from the latest version, or not carried over at all.

Syntax

public enum TestsHandlingType
{
	// Copies the tests of the production version to the new version. The default
	CopyTestsFromProductionVersion = 0,

	// Moves the tests of the production version to the new version
	MoveTestsFromProductionVersion = 1,

	// Copies the tests of the most recently stored version to the new version
	CopyTestsFromLastVersion = 2,

	// Moves the tests of the most recently stored version to the new version
	MoveTestsFromLastVersion = 3,

	// The new version starts without tests
	NoTests = 4
}

Remarks

Set the value through SourceSettings.TestsHandling, which defaults to CopyTestsFromProductionVersion. It matters only for a definition whose outcome is SourceOutcome.VersionCreated. A new source object has no tests to carry over.

A copy leaves the original tests in place, so both versions have them. A move takes the tests away from the version they were on. CopyTestsFromProductionVersion and MoveTestsFromProductionVersion use the version that is in production, or the most recently stored version when the source object has no production version yet. The two FromLastVersion members always use the most recently stored version.

Tests that are copied or moved are reset to Not Run: their result, output, last run time, and last runner are cleared, because they describe a run against the version the test came from, not against the new one. A copy is recorded as created by the system. A moved test keeps its creator and is recorded as modified by the system.

SourceResult.TestsSourceVersionId names the version the tests came from, and SourceResult.TestCount the number of tests copied or moved.

Example

using CodeEffects.Rule.Repository;
using CodeEffects.Rule.Repository.Common;

var settings = new SourceSettings
{
	TestsHandling = TestsHandlingType.MoveTestsFromProductionVersion
};

settings.SourceTypes.Add(typeof(Order));

Context.SyncSources(dbProvider, settings);

Ask on Stack Overflow - Yes, it's still active
Ask in GitHub Discussions

p102

l097 --

l102

p101

×