Skip to content

Initial commit! 🎉#1

Merged
codito merged 6 commits into
masterfrom
dev
Aug 26, 2016
Merged

Initial commit! 🎉#1
codito merged 6 commits into
masterfrom
dev

Conversation

@codito

@codito codito commented Aug 26, 2016

Copy link
Copy Markdown
Contributor

No description provided.

@codito codito merged commit 73f7ced into master Aug 26, 2016
@codito codito deleted the dev branch August 26, 2016 06:16
Haplois added a commit to Haplois/testfx that referenced this pull request Nov 24, 2020
Evangelink added a commit that referenced this pull request Mar 20, 2026
- Fix #1: Replace hardcoded 'Expected all elements...' with AllMatchPredicateFailNew resource
- Fix #2: Remove 11 dead resource strings (ContainsFail, StartsWithFail, EndsWithFail,
  IsMatchFail, IsNotMatchFail, DoesNotEndWithFail, DoesNotStartWithFail,
  AssertThatFailedFormat, AssertThatMessageFormat, AssertThatDetailsPrefix, CollectionEqualReason)
- Fix #3: Replace bare catch with catch (Exception) in TryEvaluateFormatted
- Fix #5: Type-check StartsWith/EndsWith/Contains to only match string methods
- Fix #6: Add explicit ellipsis sentinel handling in FormatCallSite
- Fix #7: Fix grammar 'Both collection contain same elements' -> 'Both collections contain the same elements'
Evangelink pushed a commit that referenced this pull request May 14, 2026
The PR's recent introduction of `MockableReflectionOperations` (which
implements the new generic interface methods by filtering results from
`mock.Object.GetCustomAttributes(Assembly, typeof(Attribute))`) plus a
couple of test-only mistakes left the Windows CI runs red on .NET FX 4.8,
net8.0 and net9.0. This commit addresses both the failures and the two
remaining unresolved Copilot review comments.

Test fixes:

- `TestAssemblySettingsProviderTests` (4 tests): the existing setups use
  `Setup(ro => ro.GetCustomAttributes(It.IsAny<Assembly>(), typeof(ParallelizeAttribute)))`
  but `MockableReflectionOperations` always passes `typeof(Attribute)`
  (matching production's `NotCachedReflectionAccessor` for assemblies),
  so those setups never matched and the tests saw a default
  `Workers = -1`. Switch the setups to `typeof(Attribute)`.

- `ReflectionOperationsTests` (4 `GetTestPropertiesAsTraits*` tests):
  switched from `Should().Equal(new[] { new Trait(...) })` to
  `Should().BeEquivalentTo(new[] { new Trait(...) }, options => options.WithStrictOrdering())`.
  `Trait` does not override `Equals`, so the previous `Equal()` call
  performed reference comparison and always failed even when values
  matched.

Review comment #2 (`TestableExtendedTestMethod` declared public in the
global namespace): the type is already in the file-scoped
`MSTestAdapter.PlatformServices.UnitTests.Services` namespace (the
reviewer's claim about the global namespace is not accurate with the
file-scoped namespace declaration), but it does not need to be public —
made it `internal`.

Review comment #1 (`AttributeMockingHelper` treating class providers as
`TypeInfo` rather than `Type`): investigated and confirmed the premise
is incorrect. On all supported runtimes (.NET Framework 4.5+ and
.NET Core 1.0+), `RuntimeType` derives from `TypeInfo`, so
`typeof(Foo) is TypeInfo` is `true` and the class-level branch in
`AttributeMockingHelper.GetCustomAttributesNotCached` is reachable.
Verified locally with a small repro on net8.0. No change needed.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Evangelink added a commit that referenced this pull request Jun 29, 2026
…t globs

Root cause of the broken main build: the acceptance source-gen build harness
let a multi-project asset's leftover reflection outputs pollute the later
source-gen build.

TestAssetFixtureBase builds each asset twice in the same directory: first the
reflection build (default bin/Release), then the source-gen build (bin/obj
redirected to a *SourceGen sub-folder). For a multi-project asset (e.g.
AssemblyFixtureProviderAcceptance, whose test project references ProviderLibrary),
the reflection build leaves ProviderLibrary/bin/Release/<tfm>/*.dll on disk. When
the source-gen build then evaluates the host project, the SDK's default item globs
pulled those stray DLLs in as None items, and RAR treated a wrong-TFM copy (a
net10.0 MSTest.TestFramework.Extensions.dll, assembly version 9.0.0.0) as a
candidate for the net8.0 leg -> MSB3277, which MSBuildTreatWarningsAsErrors
promotes to an error, failing the fixture's ClassInitialize.

The injected props already re-excluded bin/obj, but only at the asset root
(bin/**;obj/**), which does not match the nested ProviderLibrary/bin/**. Broaden
the re-exclusion to **/obj/**;**/bin/** so a referenced project's leftover
reflection outputs stay out of the source-gen build's globs.

The reflection build (#1) is unaffected because at its evaluation time the
referenced project's bin is still empty; only the later source-gen build (#2)
runs in a directory polluted by #1.

This is the proper harness fix; the AssemblyFixtureProvider opt-out is no longer
needed, so the asset is restored to source-gen coverage. Verified by running the
AssemblyFixtureProvider acceptance tests (reflection + source-gen builds) green
across net462/net8.0/net10.0.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant