예제 #1
0
        public void Create_FromApplicationException_IsOk()
        {
            var key     = "key";
            var details = "details";

            var ex = new ApplicationException("category", "correlationId", "code", "message")
            {
                Status     = 777,
                Cause      = "cause",
                StackTrace = "stackTrace"
            };

            ex.WithDetails(key, details);

            var descr = ErrorDescriptionFactory.Create(ex);

            Assert.NotNull(descr);
            Assert.Equal(ex.Category, descr.Category);
            Assert.Equal(ex.CorrelationId, descr.CorrelationId);
            Assert.Equal(ex.Code, descr.Code);
            Assert.Equal(ex.Message, descr.Message);
            Assert.Equal(ex.Status, descr.Status);
            Assert.Equal(ex.Cause, descr.Cause);
            Assert.Equal(ex.StackTrace, descr.StackTrace);
            Assert.Equal(ex.Details, descr.Details);
        }
        private void CheckProperties(ApplicationException ex)
        {
            Assert.NotNull(ex);

            Assert.Equal(_descr.Cause, ex.Cause);
            Assert.Equal(_descr.StackTrace, ex.StackTrace);
            Assert.Equal(_descr.Details, ex.Details);
        }
        public void Constructor_WithCouse_IsOk()
        {
            var ex = new Exception();

            var appEx = new ApplicationException();

            appEx.WithCause(ex);

            Assert.Equal(ex.Message, appEx.Cause);
        }
        public ApplicationExceptionTest()
        {
            _ex = new Exception("Couse exception");

            _appEx = new ApplicationException(Category, CorrelationId, Code, Message);
        }