Class VirtualizationEngineTests
EditMode tests for Rewrite(string, IReadOnlyList<MemberPatch>) (pure text, no IO/AssetDatabase) and CollectPatchableMembers(Type) (pure reflection over a fixture type declared below — member enumeration never goes through discovery, so a Tests-assembly fixture is a faithful subject). The engine's contract under test: anchor precisely, skip already-virtual/override/static declarations, and refuse the WHOLE rewrite on any mismatch — never partial output.
Inherited Members
Namespace: Serenity.ServiceExtensionCreator.Tests.Editor
Assembly: Serenity.ServiceExtensionCreator.Tests.Editor.dll
Syntax
public class VirtualizationEngineTests
Constructors
VirtualizationEngineTests()
Declaration
public VirtualizationEngineTests()
Methods
CollectPatchableMembers_EnumeratesPlainMethodsGroupedByOverloadCount()
Declaration
public void CollectPatchableMembers_EnumeratesPlainMethodsGroupedByOverloadCount()
CollectPatchableMembers_EnumeratesPlainPropertiesOnly()
Declaration
public void CollectPatchableMembers_EnumeratesPlainPropertiesOnly()
CollectPatchableMembers_EnumeratesProtectedMethodsAndPropertiesWithTheProtectedAccessibility()
Declaration
public void CollectPatchableMembers_EnumeratesProtectedMethodsAndPropertiesWithTheProtectedAccessibility()
CollectPatchableMembers_ExcludesProtectedInternalAndPrivateProtectedMembers()
protected internal and private protected members belong to the tool's
access-level cuts — never enumerated, never patched.
Declaration
public void CollectPatchableMembers_ExcludesProtectedInternalAndPrivateProtectedMembers()
CollectPatchableMembers_MixedAccessorProperty_DeclaresAsPublic()
A mixed-accessor property (public get; protected set;) declares with its most
visible accessor — the patch must anchor on the public token.
Declaration
public void CollectPatchableMembers_MixedAccessorProperty_DeclaresAsPublic()
CollectPatchableMembers_SkipsVirtualStaticIndexerAndEventMembers()
Declaration
public void CollectPatchableMembers_SkipsVirtualStaticIndexerAndEventMembers()
Rewrite_AlreadyVirtualAndStaticDeclarations_AreSkippedWithoutDoubleInsert()
An already-virtual same-name declaration is disqualified (never double-patched) and does not count toward the expected overload count; a static one is disqualified the same way.
Declaration
public void Rewrite_AlreadyVirtualAndStaticDeclarations_AreSkippedWithoutDoubleInsert()
Rewrite_AutoProperty_InsertsVirtualAfterPublic()
Declaration
public void Rewrite_AutoProperty_InsertsVirtualAfterPublic()
Rewrite_ExplicitInterfaceImplementation_IsNeverMatched()
Declaration
public void Rewrite_ExplicitInterfaceImplementation_IsNeverMatched()
Rewrite_ExpressionBodiedMethod_InsertsVirtualAfterPublic()
Declaration
public void Rewrite_ExpressionBodiedMethod_InsertsVirtualAfterPublic()
Rewrite_ExpressionBodiedProperty_InsertsVirtualAfterPublic()
Declaration
public void Rewrite_ExpressionBodiedProperty_InsertsVirtualAfterPublic()
Rewrite_FileWithConditionalCompilation_RefusesWholeFile()
Declaration
public void Rewrite_FileWithConditionalCompilation_RefusesWholeFile()
Rewrite_GenericMethod_InsertsVirtualAfterPublic()
Declaration
public void Rewrite_GenericMethod_InsertsVirtualAfterPublic()
Rewrite_MethodWithAttributeOnPrecedingLine_PatchesTheDeclarationNotTheAttribute()
Declaration
public void Rewrite_MethodWithAttributeOnPrecedingLine_PatchesTheDeclarationNotTheAttribute()
Rewrite_MixedAccessorProperty_AnchorsOnThePublicDeclarationToken()
A mixed-accessor property (public int X { get; protected set; }) declares with the
most visible token — the patch anchors on public, and the protected accessor stays untouched.
Declaration
public void Rewrite_MixedAccessorProperty_AnchorsOnThePublicDeclarationToken()
Rewrite_OverloadCountMismatch_RefusesWithNoPartialOutput()
Declaration
public void Rewrite_OverloadCountMismatch_RefusesWithNoPartialOutput()
Rewrite_PrivateProtectedDeclaration_IsNeverMatchedByTheProtectedAnchor()
Same rule for private protected — the other compound access level the tool cuts.
Declaration
public void Rewrite_PrivateProtectedDeclaration_IsNeverMatchedByTheProtectedAnchor()
Rewrite_PropertyAnchor_NeverMatchesASameNameMethod()
Declaration
public void Rewrite_PropertyAnchor_NeverMatchesASameNameMethod()
Rewrite_ProtectedInternalDeclaration_IsNeverMatchedByTheProtectedAnchor()
A textual protected internal declaration belongs to an excluded access level — the
protected anchor must neither patch it nor let it pollute the exact-count check of a same-named
plain-protected member.
Declaration
public void Rewrite_ProtectedInternalDeclaration_IsNeverMatchedByTheProtectedAnchor()
Rewrite_ProtectedMethod_InsertsVirtualAfterProtected()
Declaration
public void Rewrite_ProtectedMethod_InsertsVirtualAfterProtected()
Rewrite_SimpleMethod_InsertsVirtualAfterPublic()
Declaration
public void Rewrite_SimpleMethod_InsertsVirtualAfterPublic()
Rewrite_TwoSameNameOverloads_PatchesBoth()
Declaration
public void Rewrite_TwoSameNameOverloads_PatchesBoth()
TryMakeSubclassFriendly_ClassWhoseOnlyVirtualMethodIsProtected_ReportsAlreadySubclassFriendly()
Eligibility now counts protected virtuals: a class whose ONLY virtual method is protected is
already subclass-friendly — pinned through the public gate (its no-patchable-methods branch calls
the same HasVirtualMembers rule discovery uses; before this feature the call returned the
"no instance methods" refusal instead).
Declaration
public void TryMakeSubclassFriendly_ClassWhoseOnlyVirtualMethodIsProtected_ReportsAlreadySubclassFriendly()
TryMakeSubclassFriendly_ClassWithOnlyVirtualMethods_ReportsAlreadySubclassFriendlyWithoutWriting()
A class whose public methods are all virtual already IS subclass-friendly — the helper reports that and writes nothing, even when a patchable property remains (property-only patches are pointless for eligibility).
Declaration
public void TryMakeSubclassFriendly_ClassWithOnlyVirtualMethods_ReportsAlreadySubclassFriendlyWithoutWriting()
TryMakeSubclassFriendly_FullListAndExplicitSelection_ReachTheSameScriptLocationRefusal()
The full-list overload delegates to the selection overload — both must clear selection validation and fail at the exact same downstream point for this fixture: script location (the fixture lives in a file named after the TEST class, so no MonoScript resolves to it — nothing is ever written).
Declaration
public void TryMakeSubclassFriendly_FullListAndExplicitSelection_ReachTheSameScriptLocationRefusal()
TryMakeSubclassFriendly_PropertiesOnlyClass_RefusesBecauseEligibilityNeedsMethods()
Subclass eligibility keys on overridable METHODS (public or protected) — a properties-only class can never become eligible, so the helper must refuse instead of claiming success and leaving the "Subclass is unavailable" warning up forever.
Declaration
public void TryMakeSubclassFriendly_PropertiesOnlyClass_RefusesBecauseEligibilityNeedsMethods()
TryMakeSubclassFriendly_PropertiesOnlySelection_IsRejected()
A properties-only SELECTION keeps the class ineligible exactly like a properties-only class does — the ≥1-method rule applies to the selection, not just the type.
Declaration
public void TryMakeSubclassFriendly_PropertiesOnlySelection_IsRejected()
TryMakeSubclassFriendly_SelectionOutsideThePatchableSet_IsRejected()
A selection naming anything outside the compiled type's patchable set must reject the whole call — a stale or hand-built patch can never smuggle a rewrite in.
Declaration
public void TryMakeSubclassFriendly_SelectionOutsideThePatchableSet_IsRejected()