public void WhenPostingErrorInformation() { _errorInfo = new ErrorInformation { ErrorId = "errorId", Error = "SomeError", InfoUrl = "http://error", SourceId = "srcId" }; _urls = new List<string> { "url1", "url2" }; _errorCount = 0; _webClientWrapper = new Mock<IWebClientWrapper>(); _webClientWrapper .Setup(wc => wc.UploadValues(It.IsAny<string>(), It.IsAny<NameValueCollection>())) .Callback(() => { if (_errorCount == 1) { throw new Exception(); } _errorCount++; }); var errorPoster = new ErrorPoster(_webClientWrapper.Object); errorPoster.Post(_urls, _errorInfo); }
public void WhenPosting() { _errorInfo = new ErrorInformation { ErrorId = "errorId", Error = "SomeError", InfoUrl = "http://error", SourceId = "srcId" }; _urls = new List<string> { "url1", "url2" }; _configuration = new Mock<IProxyConfiguration>(); _configuration .SetupGet(c => c.AppMonitorUrls) .Returns(_urls); _errorPoster = new Mock<IErrorPoster>(); var controller = new ErrorController(_configuration.Object, _errorPoster.Object); _result = controller.Post(_errorInfo); }
public IHttpActionResult Post(ErrorInformation errorInfo) { _errorPoster.Post(_configuration.AppMonitorUrls, errorInfo); return Ok(); }
public void WhenPostingErrorInformation() { _errorInfo = new ErrorInformation { ErrorId = "errorId", Error = "SomeError", InfoUrl = "http://error", SourceId = "srcId" }; _urls = new List<string> { "url1", "url2" }; _webClientWrapper = new Mock<IWebClientWrapper>(); var errorPoster = new ErrorPoster(_webClientWrapper.Object); errorPoster.Post(_urls, _errorInfo); }