Example #1
0
        public void HandleException1Test()
        {
            ESSession          esSession = new ESSession();
            AggregateException ae        = new AggregateException("1");

            esSession.HandleException(ae);
            List <Exception> exs = new List <Exception>();
        }
Example #2
0
        public void HandleException2Test()
        {
            ESSession esSession      = new ESSession();
            var       expected       = "response content";
            var       expectedBytes  = Encoding.UTF8.GetBytes(expected);
            var       responseStream = new MemoryStream();

            responseStream.Write(expectedBytes, 0, expectedBytes.Length);
            responseStream.Seek(0, SeekOrigin.Begin);

            var response = new Mock <HttpWebResponse>();

            response.Setup(c => c.GetResponseStream()).Returns(responseStream);

            WebException we1 = new WebException("tset", new Exception("xx"), WebExceptionStatus.ConnectionClosed, response.Object);

            WebException       we2 = new WebException("tset2");
            AggregateException ae  = new AggregateException("1", we1, we2);

            esSession.HandleException(ae);
        }