Skip to content

ThrowIfNotTestAssembly rejects kebab *-tests assembly names #607

Description

@StevenTCramer

Summary

State<T>.ThrowIfNotTestAssembly in TimeWarp.State 12.0.0-beta.3 and 12.0.0-beta.4 throws FieldAccessException unless assembly.FullName.Contains("Test") (ordinal, case-sensitive).

Kebab-case test assemblies such as web-spa-integration-tests contain tests but not Test. A test that calls ThrowIfNotTestAssembly(Assembly.GetCallingAssembly()) fails even though it is a test assembly.

State.Initialize() itself no longer calls this guard. The failure is on the protected helper that template debug seeders use.

Expected

Treat the assembly name as a test assembly when it contains test using StringComparison.OrdinalIgnoreCase (or an equivalent check that accepts both Test and tests).

Actual

if (!assembly.FullName.Contains("Test"))
{
  throw new FieldAccessException("Do not use this in production. This method is intended for Test access only!");
}

Repro

From a project whose assembly name is web-spa-integration-tests:

ThrowIfNotTestAssembly(Assembly.GetCallingAssembly());

Filed from timewarp-architecture task 058-001. That repo no longer renames the test assembly to web-spa-integration-Tests to satisfy the guard.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions