예제 #1
0
        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);
        }
예제 #2
0
        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);
        }
예제 #3
0
        public IHttpActionResult Post(ErrorInformation errorInfo)
        {
            _errorPoster.Post(_configuration.AppMonitorUrls, errorInfo);

            return Ok();
        }
예제 #4
0
        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);
        }