public void CreateWithMessageAndInnerExceptionSucceeds()
        {
            var ex = new EntityUniqueConstraintException(ErrorMessage, InnerException);

            Assert.Equal(ErrorMessage, ex.Message);
            Assert.Equal(InnerException, ex.InnerException);
            Assert.Null(ex.Value);
        }
        public void CreateSucceeds()
        {
            var ex = new EntityUniqueConstraintException();

            Assert.NotEmpty(ex.Message);
            Assert.Null(ex.InnerException);
            Assert.Null(ex.Value);
        }
        public void CreateWithMessageAndInnerExceptionSucceeds()
        {
            var ex = new EntityUniqueConstraintException(ErrorMessage, InnerException);

            Assert.Equal(ErrorMessage, ex.Message);
            Assert.Equal(InnerException, ex.InnerException);
            Assert.Null(ex.Value);
        }
        public void CreateSucceeds()
        {
            var ex = new EntityUniqueConstraintException();

            Assert.NotEmpty(ex.Message);
            Assert.Null(ex.InnerException);
            Assert.Null(ex.Value);
        }
        public void CreateWithMessageAndValueAndInnerExceptionSucceeds()
        {
            var ex = new EntityUniqueConstraintException(ErrorMessage, Value, InnerException);

            Assert.Contains(ErrorMessage, ex.Message);
            Assert.Contains(Value.ToString(), ex.Message);
            Assert.Equal(InnerException, ex.InnerException);
            Assert.Equal(Value, ex.Value);
        }
        public void CreateWithMessageAndValueAndInnerExceptionSucceeds()
        {
            var ex = new EntityUniqueConstraintException(ErrorMessage, Value, InnerException);

            Assert.Contains(ErrorMessage, ex.Message);
            Assert.Contains(Value.ToString(), ex.Message);
            Assert.Equal(InnerException, ex.InnerException);
            Assert.Equal(Value, ex.Value);
        }
        public void SerializeAndDeserializeSucceeds()
        {
            var ex = new EntityUniqueConstraintException(ErrorMessage, Value, InnerException);

            var stream = new MemoryStream();
            var formatter = new BinaryFormatter();

            formatter.Serialize(stream, ex);
            stream.Position = 0;

            var result = (EntityUniqueConstraintException)formatter.Deserialize(stream);

            Assert.Equal(ex.Message, result.Message);
            Assert.Equal(ex.InnerException.Message, result.InnerException.Message);
            Assert.Equal(ex.Value, result.Value);
        }
        public void SerializeAndDeserializeSucceeds()
        {
            var ex = new EntityUniqueConstraintException(ErrorMessage, Value, InnerException);

            var stream    = new MemoryStream();
            var formatter = new BinaryFormatter();

            formatter.Serialize(stream, ex);
            stream.Position = 0;

            var result = (EntityUniqueConstraintException)formatter.Deserialize(stream);

            Assert.Equal(ex.Message, result.Message);
            Assert.Equal(ex.InnerException.Message, result.InnerException.Message);
            Assert.Equal(ex.Value, result.Value);
        }