Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
Nancy.Testing lovin' #633
Nancy.Testing needs some love to polish out some of the rouge edges.
Currently we have open issues, assigned to 0.12, for the following things (this list is altered each time one of the items below are picked up and put into a separate issue)
In addition here are some stuff I want to be looked at
Each of these issues should be split out to a proper issue if/when you start working on it
If you are experiencing other concerns with Nancy.Testing, please add a comment in this issue!
I want to add something that I found confusing. I wanted to test that the content type of a response was application/json, so I wrote a test with the following assert:
(Here, result is of type BrowserResponse.) This didn't work though, as the Headers dictionary was empty. I had to change the assert to:
I realize that I could have an integration test suite where I start a full-fledged server and send HTTP requests to it, but being able to test the headers as I first tried to do would bring my unit tests a little bit "closer to the browser."
Any thoughts on this?
Ah... Checking the Nancy code, I see now that Nancy doesn't translate anything into headers on its own, so doing it for a unit testing scenario may be a bit too "artificial." Especially if only a few select headers are translated.
Still, it was confusing not to see Content-Type in the dictionary. I do like my first test attempt better than the second.
I'm in two minds about this. :-)
i think i may have hit a dependency mismatch again with the Testing stuff. i'll look into it again to confirm, but after updating my xunit to the latest, i would get run time errors saying i wasn't using the
Fortunately, setting my NuGet packages to the
i can put together another PR on the subject, but i haven't looked to see if there are any current changes that would make this whole thing moot.
If i don't hear about anything i'll probably make another PR in a few days on the subject.
@thecodejunkie For the ConfigurableBootstrapper(Configurator), it would be nice to be able to hook into the ApplicationStartup and RequestStartup methods. Right now, I usually derive from ConfigurableBootstrapper to hook into ApplicationStartup. That way I can add things like an alternate FormsAuthentication.Enable(...) to the bootstrapper.
I would think this would just add to the end of the App/Request startup methods. I can work something up and send a PR. I have the code in my head already. Just wonder how I would test it. Any particular test fixture that I can model after for ConfigurableBootstrapper?