A Patch with redesign to use mocks instead of using test-only Methods
GoogleCodeExporter opened this issue · comments
Google Code Exporter commented
This patch is just my own kind of "clean up", that I thought was necessary
before getting stuck into adding some of the features I'm thinking of.
1) There's some use of 3.5 features thrown in, where I think they should be
2) Sorry, I couldn't stand the 'cursive' font for the 3 URL settings, so I
made some minor changes there
3) Most importantly, I basically redesigned HttpProjectXmlResolver...
I didn't like the way that there was a lot of code in that class, *only*
for testing. 2 static methods and one property. And also methods that used
the test-only property were modified especially to cater for testing (like
setting a member instead of returning a value
I hope you find this redesign cleaner.
I wrote the class without relying on test-only methods, and just wrote it,
without any contrivance.
Created an IWebClient interface, and implemented it, so that I could mock
out calls to WebClient.DownloadString.
I did a little 'extract method' and I think the code looks cleaner and so
do the tests, and there's much less code in those tests now too.
There is still 1 test failing, but that's how it was when I got it.
Original issue reported on code.google.com by spurrymo...@gmail.com
on 13 Dec 2008 at 11:29
Attachments:
Google Code Exporter commented
I failed to mentioned, that I'd also updated NUnit and RhinoMock libraries -
which is
why the patch is reasonably large.
... I also forgot to delete the offending property ProjectStatusDocument - in
the
patch. It's unused and can be deleted.
Original comment by spurrymo...@gmail.com
on 13 Dec 2008 at 1:03
Google Code Exporter commented
Thanks for the patch. I'll get it reviewed soon.
Original comment by benca...@gmail.com
on 14 Dec 2008 at 9:12
Google Code Exporter commented
I added the patch. Thanks for cleanup and I like the introduction of the stubs
-
feels much cleaner. I haven't had much time to work on the project lately, so I
appreciate the effort to help me clean up the code. It's very appreciated.
Patch is applied and in the trunk. This will make it in for the next release.
Thanks again.
- Ben
Original comment by benca...@gmail.com
on 15 Dec 2008 at 1:41
- Changed state: RequestImplemented
Google Code Exporter commented
No worries, I'm happy to work on this at the moment. I've already done a fair
bit
since that patch, yesterday ;-)
eg I've added a gradient to the background colors and I'll be adding a simple
animation to move from one color to another tonight.
If the patches are hard to keep up with, I'm happy to commit directly, if you
trust
me ;-)
Original comment by spurrymo...@gmail.com
on 15 Dec 2008 at 1:59
Google Code Exporter commented
Good to hear. I've added a few minor mods as well. So, try and update before
submitting - it will make my life a little easier :)
Original comment by benca...@gmail.com
on 15 Dec 2008 at 3:55