Closed lacajenne closed 3 weeks ago
Please could you attach the full verifier output log?
Generally speaking using object types is going to cause problems because the serialisation round trip might not have the appropriate type information to know how to deserialise the JSON in the pact file properly when verifying. Seeing the full logs will probably cast some light on that though.
Thanks. This is all I seem to find:
MessageContract.Tests.GainEventProcessorTests.ReceiveSomeStockEvents Source: GainEventProcessorTests.cs line 34 Duration: 2,7 sec
Message: PactNet.Exceptions.PactMessageConsumerVerificationException : The message could not be verified by the consumer handler ---- Expected property events[0].Data to be a dictionary or collection of key-value pairs that is keyed to type System.String. It implements .
With configuration:
Without automatic conversion.
Stack Trace:
ConfiguredMessageVerifier.Verify[T](Action1 handler) GainEventProcessorTests.ReceiveSomeStockEvents() line 120 RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor) MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr) ----- Inner Stack Trace ----- XUnit2TestFramework.Throw(String message) TestFrameworkProvider.Throw(String message) CollectingAssertionStrategy.ThrowIfAny(IDictionary
2 context)
AssertionScope.Dispose()
EquivalencyValidator.AssertEquality(Comparands comparands, EquivalencyValidationContext context)
GenericCollectionAssertions3.BeEquivalentTo[TExpectation](IEnumerable
1 expectation, Func2 config, String because, Object[] becauseArgs) GenericCollectionAssertions
3.BeEquivalentTo[TExpectation](IEnumerable1 expectation, String because, Object[] becauseArgs) <>c__DisplayClass2_0.<ReceiveSomeStockEvents>b__5(ICollection
1 events) line 127
ConfiguredMessageVerifier.Verify[T](Action`1 handler)
@lacajenne You may need to enable the xUnit output in the PactConfig
so get the full verifier output. It contains the logs from the Rust library, which is probably what's needed to investigate this. Also please turn the log level up to at least Debug.
Closed due to inactivity
Version information:
Describe the bug We are writing consumer tests for an event-driven system. The Match.Type method, when working on an attribute of type Object, throws an exception with this error message: ---- Expected property events[0].Data to be a dictionary or collection of key-value pairs that is keyed to type System.String. It implements .
Steps To Reproduce Write a consumer test validating an object belonging to a class like the following
public sealed class TestDataClass { public WorkflowReference WorkflowReference { get; set; } public string Title { get; set; } public object Data { get; set; }
}
Expected behavior It is possible to invoke Match.Type on the Data attribute.
Log Output Stack Trace: ConfiguredMessageVerifier.Verify[T](Action
1 handler) GainEventProcessorTests.ReceiveSomeStockEvents() line 120 RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor) MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr) ----- Inner Stack Trace ----- XUnit2TestFramework.Throw(String message) TestFrameworkProvider.Throw(String message) CollectingAssertionStrategy.ThrowIfAny(IDictionary
2 context) AssertionScope.Dispose() EquivalencyValidator.AssertEquality(Comparands comparands, EquivalencyValidationContext context) GenericCollectionAssertions3.BeEquivalentTo[TExpectation](IEnumerable
1 expectation, Func2 config, String because, Object[] becauseArgs) GenericCollectionAssertions
3.BeEquivalentTo[TExpectation](IEnumerable1 expectation, String because, Object[] becauseArgs) <>c__DisplayClass2_0.<ReceiveSomeStockEvents>b__5(ICollection
1 events) line 127 ConfiguredMessageVerifier.Verify[T](Action`1 handler)