Bugfix: Force build with parameters when using WebURL

I normally start out with simple mock/test target creation methods in the
interest of time saving and YAGNI principals and then refactor to something
better when/as I add more tests. It's never a good thing to over complicate
too early.

Also, the Setup routine is always to be avoided and is a leading cause of
brittle tests. You should have custom methods for setting up test state as
this becomes much more readable when looking at a test. There is an
extremely good book that I read a few years back, xUnit Testing Patterns
that is fantastic for showing lots of ways to improve unit tests

On Sat, Oct 4, 2014 at 3:30 AM, Nate Tovo <notifications@github.com> wrote:

> In JenkinsTransport.UnitTests/JenkinsProjectManagerTests.cs:
>
> > @@ -36,5 +61,35 @@ public void TestInstanciation()
> >              Assert.AreEqual(Manager.Settings.Server, "https://builds.apache.org/");
> >          }
> >
> > +        [TestMethod]
> > +        public void ForceBuild_when_using_weburl_should_call_api_with_parameters()
> > +        {
> > +            Mock<IWebRequestFactory> mockWebRequestFactory;
> > +            Mock<IJenkinsApiFactory> mockJenkinsApiFactory;
> > +            Mock<IJenkinsApi> mockApi;
> > +
> > +            var target = CreateTestTarget(out mockWebRequestFactory, out mockJenkinsApiFactory, out mockApi);
>
> 3 out parameters feels like the wrong approach here. What about
> refactoring the Setup to set new protected Mock IWebRequestFactory,
> IJenkinsApiFactory, and IJenkinsApi properties. Then you can write this
> test against the protected Manager instead of a new target as well.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/csnate/cctray-jenkins-transport/pull/5/files#r18397871>
> .
>