https://pact.io logo
Join Slack
Powered by
# pact-net
  • g

    GitHub

    02/12/2023, 3:17 PM
    #421 Why is teardown flag not supported for WithProviderStateUrl? Issue created by sprengo Why not just add the teardown flag to
    WithProviderStateUrl
    method of the
    IPactVerifierSource
    interface and pass it to the
    SetProviderState
    of the
    IVerifierProvider
    in the corresponding implementation? pact-foundation/pact-net
    • 1
    • 1
  • g

    GitHub

    02/12/2023, 3:18 PM
    #422 Support provider state teardown Pull request opened by sprengo pact-foundation/pact-net ✅ All checks have passed 1/1 successful checks
    • 1
    • 1
  • m

    Matt (pactflow.io / pact-js / pact-go)

    02/12/2023, 8:34 PM
    🎉
  • c

    Cyrus Devnomad

    02/14/2023, 9:59 AM
    Hello, I'm trying to implement multiple test cases for a pact.net consumer unit test. Whenever I increase the number of test cases, for example from one test case to two test cases or from two to three the pact.VerfiyAsync() method of one of the test cases throws the following exception: System.InvalidOperationException : Unable to start mock server If I reduce again the number of test case, for example by commenting out one of the test case methods, everything works again. I have created an example project based on the pact.net basic .net example with some files from my project added to that and was able to reproduce the behavior: https://github.com/cyrusdevnomad/test-project-for-error-reproducing You can try it for yourself. But make sure to change the number of unit test cases (the exception is thrown if the number of unit test cases is increased) by uncommenting/commenting out unit test case methods to see the exception mentioned above.
    y
    m
    • 3
    • 9
  • d

    David Hvilava

    02/14/2023, 2:45 PM
    Hi guys, I noticed that when Pact mock service sends a request to Provider from a given contract it doesn't preserve Http Headers case. For instance, in a contract I have the following request headers:
    Copy code
    "interactions": [
        {
          "description": "A GET request with custom headers",
          "request": {
            "method": "GET",
            "path": "/api/provider",
            "headers": {
              "Content-Type": "application/json",
              "TestHeaderKey": "TestHeaderValue"
            }
          },
    ...
    But my Provider receives them in lowercase. Is is possible to somehow make it case preserving?
    u
    • 2
    • 2
  • a

    Arika Goyal

    02/14/2023, 9:13 PM
    Hi, I am trying out sample code here https://github.com/DiUS/pact-workshop-dotnet-core-v3 with PactNet - 4.3.0. The only change I have made to the sample code is that i am not working with provider states in the test and instead have the required state set as part of controller only. While it works on OSX when i try it on windows I get the following error -
    Copy code
    PactNet.Exceptions.PactFailureException: Pact verification failed
    
    PactNet.Exceptions.PactFailureException
    Pact verification failed
       at PactNet.Verifier.InteropVerifierProvider.Execute()
       at PactNet.Verifier.PactVerifierSource.Verify()
       at tests.ProductApiTestsWithoutBroker.EnsureProviderApiHonoursPactWithConsumer() in C:\repos\ProofOfConcepts\Pact-Product-api\ProviderTests\ProductApiTestsWithoutBroker.cs:line 47
       at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
       at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)
    
    
    
    Getting to pact verification
    Starting verification...
    Pact verification failed
    
    Verifier Output
    ---------------
    
    Verifying a pact between ApiClient and ProductService
    
      A valid request for all products
        returns a response which
          has status code 200 (FAILED)
          includes headers
            "Content-Type" with value "application/json; charset=utf-8" (FAILED)
          has a matching body (FAILED)
    
    
    Failures:
    
    1) Verifying a pact between ApiClient and ProductService - A valid request for all products
        1.1) has a matching body
               expected 'application/json;charset=utf-8' body but was 'text/html'
        1.2) has status code 200
               expected 200 but was 400
        1.3) includes header 'Content-Type' with value 'application/json; charset=utf-8'
               Expected header 'Content-Type' to have value 'application/json; charset=utf-8' but was 'text/html'
    
    There were 1 pact failures
    
    Verifier Logs
    -------------
    2023-02-14T20:36:14.433512Z  INFO ThreadId(33) pact_verifier: Running provider verification for 'A valid request for all products'
    2023-02-14T20:36:14.433752Z  INFO ThreadId(33) pact_verifier::provider_client: Sending request to provider at <http://localhost:9001/>
    2023-02-14T20:36:14.433771Z  INFO ThreadId(33) pact_verifier::provider_client: Sending request HTTP Request ( method: GET, path: /api/products, query: None, headers: None, body: Missing )
    2023-02-14T20:36:14.456312Z  INFO ThreadId(33) pact_verifier::provider_client: Received response: HTTP Response ( status: 400, headers: Some({"cache-control": ["no-store"], "via": ["1.1 ForcepointCGCluster"], "date": ["Tue", "14 Feb 2023 20:36:32 GMT"], "content-type": ["text/html"], "connection": ["close"], "content-language": ["en"], "content-length": ["666"]}), body: Present(666 bytes, text/html) )
    2023-02-14T20:36:14.456421Z  INFO ThreadId(33) pact_matching: comparing to expected response: HTTP Response ( status: 200, headers: Some({"Content-Type": ["application/json; charset=utf-8"]}), body: Present(130 bytes) )
    2023-02-14T20:36:14.457552Z  WARN ThreadId(33) pact_matching::metrics: 
    
    Please note:
    We are tracking events anonymously to gather important usage statistics like Pact version and operating system. To disable tracking, set the 'PACT_DO_NOT_TRACK' environment variable to 'true'.
    
    
    2023-02-14T20:36:14.495312Z  WARN ThreadId(33) rustls::conn: Sending fatal alert DecodeError
    P.S - I am using .NET 7 and i tried including PactNet.Windows nuget package but it did not help. Any pointers would be very helpful here. Thanks.
  • c

    Carlos López Sánchez

    02/14/2023, 9:16 PM
    @Carlos López Sánchez has left the channel
  • t

    Tomer Ghelber

    02/15/2023, 12:45 PM
    @Tomer Ghelber has left the channel
  • g

    GitHub

    02/27/2023, 2:51 AM
    1 new commit pushed to
    <https://github.com/pact-foundation/pact-net/tree/master|master>
    by mefellows
    <https://github.com/pact-foundation/pact-net/commit/e7de8d4e7a2f0883644ea8d86a79e927a339603a|e7de8d4e>
    - chore: add smartbear supported jira integration pact-foundation/pact-net
  • g

    GitHub

    03/02/2023, 12:03 PM
    #443 Initialising server PactVerifierProvider net6 Issue created by aleroca96 Hi How can I initialised the server fixture when there is no StartUp file? I can see from the docs that we cannot use WebApplicationFactory. Thanks! pact-foundation/pact-net
    • 1
    • 1
  • g

    GitHub

    03/02/2023, 12:03 PM
    #444 Provider tests - .NET6 Minimal API support Issue created by arnoldsi-payo Hi, As you probably know that from .NET 6, all the configurations are at the top level. I've tried to find a clean solution to run the app for provider testing. One of the options is to move the new code to the static main class and run it or revert it to the old way. I would like to know if can suggest ideas to overcome this issue Thank you pact-foundation/pact-net
    • 1
    • 1
  • c

    Cyrus Devnomad

    03/07/2023, 10:31 AM
    How can I set the pact file write mode to "merge" in Pact.NET? This option was mentioned in the following conversation: https://pact-foundation.slack.com/archives/C9UTHV2AD/p1676368784117769
  • f

    Facu Conejero

    03/08/2023, 9:31 AM
    @Facu Conejero has left the channel
  • j

    Jacob Waller

    03/09/2023, 5:41 PM
    Hey y'all. I'm trying to set up a provider. Does anyone have an example of using Wiremock .NET or something similar to set up the mock server? Or does anyone have recommendations for what tools to use for that?
    m
    s
    • 3
    • 7
  • g

    GitHub

    03/11/2023, 12:06 AM
    #445 Multiple tests for a consumer Issue created by marlonjimenezGL [edited] I posted an issue, but I figured out the root cause: it was by a subtle wrong configuration, so never mind and thanks. pact-foundation/pact-net
    • 1
    • 1
  • o

    Ondřej Hájek

    03/13/2023, 4:14 PM
    Hi, I wonder, how do you publish pacts generated by consumer tests in .net ecosystem? E.g. in Java we have maven goal to do execute the tests and publish to the pact broker for us. I am looking for something similar but for .net, but I wasn’t able to google anything. gratitude thank you
    y
    • 2
    • 3
  • s

    Santiago Rendón

    03/15/2023, 11:30 PM
    Hi, I've been stuck for a while with a weird bug on the provider side, where my provider state fails:
    Request Failed - One or more of the setup state change handlers has failed
    It only fails in the CI or the first time the test is run locally, but consequent calls to
    dotnet test
    do not fail... I can't currently share a minimal reproduction, but may try to recreate it this week. Hopefully this weird behavior of only failing the first time gives enough info to someone that can put me in the right track to investigate the issue. Thanks in advance
    m
    • 2
    • 1
  • c

    Cyrus Devnomad

    03/16/2023, 3:39 PM
    I'm trying to write a consumer test for an API method that can receive a post request with email message data and send a corresponding email. The API method returns status code ok if everything is ok but does not return a proper status code in some invalid cases currently. Its not clear to me what to do with the .WithStatus() method: pact.UponReceiving("a request to post an email message with an invalid email address") .WithRequest(HttpMethod.Post, "/v1/Mail") .WithBody(requestBody, "application/json") .WillRespond() .WithStatus(?); I would like to do something like .WithStatus(Match.Type("integer")) but I can see that this is not possible. Is there a way to create a pact that does not care what status code is returned for some invalid cases?
    t
    • 2
    • 6
  • k

    Kripa Kurian

    03/16/2023, 7:31 PM
    @Kripa Kurian has left the channel
  • j

    Jacob Waller

    03/20/2023, 9:26 PM
    Why was publishing a pact removed from PactNet and now only accessible through the CLI, but verifying a pact with a pact broker source is still there? Wouldn't publishing a pact be extremely useful?
    m
    d
    +2
    • 5
    • 19
  • g

    GitHub

    03/22/2023, 10:56 AM
    #446 feat: xunit output adapter package Pull request opened by riezebosch I've moved the xunit adapter into a separate project in order to have you publish it as a separate package, since we'll all be using it all over again pact-foundation/pact-net ✅ All checks have passed 1/1 successful checks
    • 1
    • 1
  • y

    Yousaf Nabi (pactflow.io)

    03/22/2023, 3:13 PM
    Are you a Pact-NET wizard? @riezebosch has just dropped a PR to update the Pact-NET workshop to .NET 6.0 You can read the comments and thread here - We would love your eyes across it if you could spare the time, maybe you've run through the workshop before in the past, or you never have, but you've been using Pact in the wild. We'd love your help and support, in making this useful for yourself, Pact-NET newbies and anyone you are trying to bring on board in your teams/organisations.
    🙌 1
  • u

    Ulises Cervino

    03/22/2023, 9:01 PM
    @Ulises Cervino has left the channel
  • g

    GitHub

    03/23/2023, 10:50 PM
    #447 Feat multipart file upload support Pull request opened by Inksprout This PR aims to add partial support for Multipart/form-data requests to be added to the Pact File. It introduces a WithMultipartSingleFileUpload() method that allows the user to to specify a request of multipart/form-data in which a single part is uploaded, which is a file. This functionality is a common use case and uses the underlying Rust FFI method designed for this express purpose. Note this update does not enable Pact-Net to fully support all types of multipart/form-data requests as it does not support requests with multiple parts included. see issue: #410 TODO ☑︎ Add documentation for the new method pact-foundation/pact-net GitHub Actions: release ✅ 4 other checks have passed 4/5 successful checks
    • 1
    • 1
  • p

    Pallavi Anirban Bose

    03/27/2023, 6:03 AM
    Is there any pactnet sample available for .netcore 6 / 7 for minimal API or w/o startup classes?
    e
    • 2
    • 1
  • r

    Ryan Child

    03/27/2023, 6:56 PM
    Hey everyone! I'm trying to update a provider pact test to add a fresh authorization token to all pact requests before they are replayed against the API. I've seen the WithCustomHeader method, but that seems to only add an authorization header, and not update an already present authorization header that might exist within the consumer pact json. Is there any workaround for this? Or is it generally understood to not include auth headers in the consumer json?
    👍 1
    m
    s
    • 3
    • 8
  • p

    Pallavi Anirban Bose

    03/28/2023, 10:40 AM
    Hi Everyone, I was running by provider tests with pactnet version 3x. I upgraded it to 4x but my tests are failing. Also I'm unable to see the log. Please guide. I tried setting up loglevel to Info as well. but no use. var config = new PactVerifierConfig { Outputters = new List<IOutput> { new XUnitOutput(_output) }, LogLevel = PactLogLevel.Error };
    c
    • 2
    • 7
  • g

    GitHub

    03/30/2023, 9:34 PM
    #448 System.BadImageFormatException when using PactNet with an x86 assembly Issue created by marlonjimenezGL Hello, we have several .NET Framework projects where we want to use PactNet, but unfortunately they are configured with Platform target: x86 and we can not change that. My question: Is there a way to avoid this System.BadImageFormatException? We have tried many workarounds to use it with an x64 but none of them work. Any chance that you provide a PactNet compatible with x86? Thanks in advance for your help. pact-foundation/pact-net
    • 1
    • 1
  • b

    Bo Damgaard Mortensen

    04/04/2023, 3:56 PM
    Hi all, Is there a way to validate nullable reference types with Pact .NET? 🙂 If we have the following two classes:
    Copy code
    public class ConsumerClass 
    {
        public string MyProperty { get; init; }
    }
    
    public class ProviderClass 
    {
        public string? MyProperty { get; init; }
    }
    and in my consumer test, I've set the following:
    .WithJsonBody(Match.Type(new ConsumerClass { MyProperty = "test" }));
    (since I don't want to validate the actual values) I'd expect the provider test to fail this, since I have marked
    MyProperty
    to be a nullable property.
    m
    s
    • 3
    • 7
  • v

    Victor Lau

    04/05/2023, 5:05 PM
    Does anyone have an example of PactNet of setting up a server without a Startup file? E.g. I have a PactWebFactory that uses Microsofts in-memory, but I want to migrate a bunch of configuration to starting a server without having a <StartUp> file
    👀 1
1...56789Latest