コード例 #1
0
        public void ConstructorWithMessageAndPropertySource_ExceptionMessageCorrectlyFormatted()
        {
            var propertySource = new { Entity = "Car", Id = -1 };

            var exception = new ExceptionDummy("{Entity} with id {Id} could not be found.", propertySource);

            Assert.Equal("Car with id -1 could not be found.", exception.Message);
        }
コード例 #2
0
        public void ConstructorWithMessageAndPropertySourceAndInnerException_InnerExceptionPreserved()
        {
            var innerException = new Exception("InnerExceptionMessage");

            var exception = new ExceptionDummy("Car with id -1 could not be found.",
                                               innerException);

            Assert.Equal("InnerExceptionMessage", exception.InnerException.Message);
        }
コード例 #3
0
        public void ConstructorWithMessageAndInnerException_InnerExceptionPreserved()
        {
            var propertySource = new { Entity = "Car", Id = -1 };
            var innerException = new Exception("InnerExceptionMessage");

            var exception = new ExceptionDummy("{Entity} with id {Id} could not be found.",
                                               propertySource,
                                               innerException);

            Assert.Equal("InnerExceptionMessage", exception.InnerException.Message);
        }
コード例 #4
0
 public void DefaultConstructor_ReturnsDefaultMessage()
 {
     var exception = new ExceptionDummy();
     Assert.Equal("Exception of type 'DryPants.Test.Exceptions.DryExceptionTests+ExceptionDummy' was thrown.", exception.Message);
 }
コード例 #5
0
        public void ConstructorWithMessage_ExceptionMessageCorrectlyFormatted()
        {
            var exception = new ExceptionDummy("Car with id -1 could not be found.");

            Assert.Equal("Car with id -1 could not be found.", exception.Message);
        }