GithubHelp home page GithubHelp logo

Comments (12)

fluffynuts avatar fluffynuts commented on May 24, 2024 1

@cindra10 if you can inject a url for the endpoints you want to hit, check out nuget package PeanutButter.SimpleHttpServer -- check out the tests here for usage. Happy hacking (:

from matterhook.net.matterhookclient.

rgomez90 avatar rgomez90 commented on May 24, 2024 1

@PromoFaux , @cindra10 AFAIK unit tests SHOULD be self-contained. You should not hit any real endpoint in unit tests, that's the case for integration tests. I never tested http methods, but I heard about mocking HttpMessageHandler.

from matterhook.net.matterhookclient.

PromoFaux avatar PromoFaux commented on May 24, 2024

Very agree with that. I'm a terrible dev insofar as I never learned to write testable code! All a bit "new fangled" for my experience ;) this project feels like a good fit to start learning, however :)

from matterhook.net.matterhookclient.

cindra10 avatar cindra10 commented on May 24, 2024

Hi everyone,
I would like to give this a shot.
Would it be ok to provide a webhook URL from the app.config since the webhook endpoint should be kept secret?
Are there any specific cases you would like to be covered?

from matterhook.net.matterhookclient.

PromoFaux avatar PromoFaux commented on May 24, 2024

Feel free to give it a shot! I think I could probably stand to learn a thing or two myself.

RE: Webhook URL. That raises an interesting point. In order to test this library, are we going to need an available endpoint for it to ping? I would have thought the tests would need to be self-contained, and not rely on a (potentially unavailable) external source.

Then again, I have no idea what I'm talking about when it comes to tests so... 🤷‍♂️

from matterhook.net.matterhookclient.

cindra10 avatar cindra10 commented on May 24, 2024

Tests should be mocked but I've never done any HTTP related testing and this was the first idea I've had. I could do some research on this topic later today.

from matterhook.net.matterhookclient.

PromoFaux avatar PromoFaux commented on May 24, 2024

Just going to drop this here to remember to read it later:

https://github.com/WireMock-Net/WireMock.Net

from matterhook.net.matterhookclient.

rgomez90 avatar rgomez90 commented on May 24, 2024

After reading a while, a possible solution would be to mock (using Moq) HttpMessageHandler to return a OK response that contains the json we sent. This way we could test if the json looks like it should.

Here the article

from matterhook.net.matterhookclient.

cindra10 avatar cindra10 commented on May 24, 2024

@rgomez90 You are correct, I was too tired when I initialy responded to this so we can kind of ignore previous replies 😄. I've taken a look at both proposed packages (by @PromoFaux and @fluffynuts), both are relatively easy to setup . Other than that I didn't have much time to investigate, I will take a look at the article you linked ASAP.

from matterhook.net.matterhookclient.

rgomez90 avatar rgomez90 commented on May 24, 2024

hey @cindra10 😄 are you working / gonna work on it at the end?

from matterhook.net.matterhookclient.

cindra10 avatar cindra10 commented on May 24, 2024

Hi @rgomez90 sorry but I simply can't find time to work on anything currently, college and work are just taking too much effort 😞. Since I'd still like to learn a few things about testing HTTP related projects, could you please let me know when these are implemented so I can take a look? :)

from matterhook.net.matterhookclient.

rgomez90 avatar rgomez90 commented on May 24, 2024

First goes first @cindra10!! Thanks for the quick response! 😄 Sure! We'll let you know once implemented!

from matterhook.net.matterhookclient.

Related Issues (13)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.