Skip to main content

Migrating from 1.0 to 1.1

Moving a 1.0 suite to 1.1 takes three steps: fix what no longer compiles, replace what now warns, and check what changed behavior. Most suites need only the first step.

ActionWhatCount
MUSTremoved members that no longer compile10
SHOULDdeprecated shims that keep compiling with a warning4 groups
NOTHINGrenamed surface with a fallback, and behavior changes to verify3 renames, 5 behavior changes

The changelog's Breaking section lists the calls that must change. The rest of a 1.0 suite runs as it is. This page covers the removed members, the renames and the deprecated surface. The changelog is the complete record, including the changes this page does not repeat.

Removed in 1.1​

These members existed in 1.0.1 and no longer exist. Your suite does not compile until you replace them. The changelog's Breaking section has the same list.

Removed memberReplacementDocs
ProtoExecutionContext.RegisterClient<T>(client, name, bool)the third argument is now ProtoClientOwnership (Context or Caller), so a true becomes ProtoClientOwnership.ContextClients
ProtoDocumentSource.LoadText(source, baseUrl, httpClient)one LoadText method with optional parameters replaces the overloadExtending
ProtoHttpAuthLifecycleHook constructorsealed, and takes a ProtoProtocol instead of a stringHooks
ProtoHttpClientResolution membersa positional record with ClientEntityName. SourceName, SourceClientName and Deconstruct are gone, and ProtoHttpClientResolver.Resolve takes the client name as an optional third argumentExtending
the backend operation's Result on WebOperationContextgone
Playwright options Contextconfigure the browser context in code with ConfigureContextWeb
RequiresPlaywrightBrowser.Sessionthe condition probes the configured browser or channelSkip conditions
GrpcAttachmentOptions HTTP membersno longer derives from the HTTP attachment options, so SensitiveHeaders and SensitiveQueryParameters are gone. gRPC metadata redaction uses the gRPC client's SensitiveMetadataKeysgRPC
Raw ServerStreaming and DuplexStreaming helpersmoved from the gRPC client to the blocking facade: client.Blocking.ServerStreaming(...)gRPC
the PollInterval on RabbitMqOptionsawaits are event-driven and MessagingOptions.DefaultTimeout bounds themMessaging

Deprecated in 1.1​

Each item below still compiles, still records its data, and stays available for all of 1.x. It produces a warning. Use the replacement in new tests.

Assertions​

1.0 spellingReplacement
response.ShouldHaveNoErrors(), ShouldHaveErrors(), ShouldHaveError(code)response.Should.HaveNoErrors(), Should.HaveErrors(), Should.HaveError(code)
ProtoGrpcAssertions.ShouldHaveStatus(...), ShouldNotHaveStatus(...)ProtoGrpcAssertions.For(exception).Should.HaveStatus(...), .ShouldNot.HaveStatus(...)
model.Verify()model.Should.MatchModel()
column.ShouldAll(predicate)column.Should.All(predicate)

The facade and the polarity rules are on Assertions.

Shape​

The old ShouldMatchShape methods are obsolete on REST and GraphQL responses, consumed messages and gRPC replies. Use the Should form instead. It chains after another assertion:

response.Should.HaveHttpStatus(HttpStatusCode.OK).Should.MatchShape(shape);

Should.MatchShape(shape, exact: true) is the strict form on every shape surface. A field in the response that the shape does not mention counts as a mismatch, and the failure names its path.

A Sheets model row keeps row.ShouldMatchShape(shape). A model row is your own type, and C# cannot give it a Should property. A table row uses row.Should.MatchShape(shape). See Shape matching.

Skip-key infrastructure​

AddInfrastructure(piece, keys) is obsolete. It keeps its rule for all of 1.x: the host skips a piece when every key it declares is configured. AddInfrastructureAlways still lets you opt out of that skip. The replacement is a provider chain:

builder.AddInfrastructure(
"MessagingBroker",
chain => chain
.UseConfigured()
.UseContainer(RabbitMqBroker.Container()),
RabbitMqOptions.ConnectionStringSetting);

UseConfigured() is the provider that uses the configured environment. Use(provider) accepts any IProtoTargetProvider. See Infrastructure.

The gRPC options constant​

GrpcAttachmentOptions.ConfigurationSection is an obsolete alias. Use the inherited ConfigurationSectionName property, or the SectionName constant where a name is needed without an instance.

Renamed or replaced​

The MassTransit package​

ProtoTest.MassTransit is now ProtoTest.Messaging.MassTransit, to match the other messaging packages (ProtoTest.Messaging, ProtoTest.Messaging.RabbitMq). The old package was never released, so nothing you installed changes. If you use it from a branch build, update the PackageReference. The public type names (MassTransitEnvelope, UseMassTransit) are the same.

The gRPC options section​

gRPC client options now bind from ProtoTest:Grpc:Client. The 1.0 section ProtoTest:Grpc still binds as a deprecated fallback, so an existing appsettings.json keeps working. A value under the new section wins. For options that hold a list, the entries from both sections are added together. See Options and keys.

The OpenTelemetry bridge​

The ProtoTest.OpenTelemetry package is retired. The ProtoTest ActivitySource always exists, so you subscribe with one line in your own OpenTelemetry setup:

.AddSource("ProtoTest")

No package replaces the bridge, because the source was always there. See OpenTelemetry.

Also changed​

These 1.1 changes are not deprecations. They can affect a suite that asserts or filters on the old behavior.

  • Shape failures throw the protocol's own exception. Each exception names its subject:

    • REST throws RestAssertionException.
    • GraphQL throws GraphQLAssertionException.
    • gRPC throws GrpcAssertionException.
    • Messaging throws MessagingAssertionException.
    • A Sheets row throws SpreadsheetAssertionException.

    JsonShapeMismatchException, with the list of mismatches, is still available as the InnerException. Code that caught it directly must catch the protocol exception or ProtoAssertionException instead.

  • REST object request bodies serialize camelCase by default, matching GraphQL variables. Pass explicit JsonSerializerOptions to keep another naming policy.

  • gRPC client options are per named client. Each AddClient callback applies to that client only, and the shared ProtoTest:Grpc:Client section binds over every client.

  • A per-run WireMock fake keeps its stubs and request log for the whole run. Call Reset() when a test must start from a clean fake.

  • The publish observation is messaging.published. The operation is still messaging.publish. A collector that filtered on the old observation kind must be updated.

Next​