public async Task ItShouldReceiveAFormResponseOnFail()
        {
            var mappedFormHtml = "<form action='/api/challenge/id'  method='post' />";

            MockFormMapper.Setup(x => x.UpdateForm(
                                     It.IsAny <SupportServiceResourceKey>(),
                                     It.IsAny <SupportServiceResourceKey>(),
                                     It.IsAny <string>(),
                                     It.IsAny <string>(),
                                     It.IsAny <string>()
                                     ))
            .Returns(mappedFormHtml);


            MockSiteConnector
            .Setup(x => x.Upload <string>(It.IsAny <Uri>(), It.IsAny <IDictionary <string, string> >()))
            .ReturnsAsync(mappedFormHtml);

            MockSiteConnector.SetupGet(x => x.LastCode).Returns(HttpStatusCode.OK);

            var result = await Unit.SubmitChallenge(_id, _submittedFormData);

            Assert.IsNotNull(result);
            Assert.IsFalse(result.HasRedirect);
            Assert.IsNull(result.RedirectUrl);
            Assert.AreEqual(mappedFormHtml, result.Page);
        }
        public void ItShouldThrownAnExceptionIfTheSubmissionErrors()
        {
            var httpException = new HttpException();

            MockSiteConnector
            .Setup(x => x.Upload <string>(It.IsAny <Uri>(), _postedFormData))
            .ThrowsAsync(httpException);

            MockSiteConnector.SetupGet(x => x.LastCode).Returns(HttpStatusCode.InternalServerError);
            MockSiteConnector.SetupGet(x => x.LastException).Returns(httpException);


            Assert.ThrowsAsync <HttpException>(() => Unit.SubmitChallenge(_id, _submittedFormData));
        }