public void UsingConstructorWithCausationIdAndMessageReturnsExceptionWithExcpectedProperties()
 {
     var sut = new OptimisticCausationException(CausationId, "Message");
     Assert.That(sut.CausationId, Is.EqualTo(CausationId));
     Assert.That(sut.Message, Is.EqualTo("Message"));
     Assert.That(sut.InnerException, Is.Null);
 }
 public void UsingConstructorWithCausationIdReturnsExceptionWithExcpectedProperties()
 {
     var sut = new OptimisticCausationException(CausationId);
     Assert.That(sut.CausationId, Is.EqualTo(CausationId));
     //Use of Contains.Substring due to differences in OS.
     Assert.That(sut.Message, Contains.Substring(typeof (OptimisticCausationException).Name));
     Assert.That(sut.InnerException, Is.Null);
 }
        public void UsingConstructorWithCausationIdAndMessageReturnsExceptionWithExcpectedProperties()
        {
            var sut = new OptimisticCausationException(CausationId, "Message");

            Assert.That(sut.CausationId, Is.EqualTo(CausationId));
            Assert.That(sut.Message, Is.EqualTo("Message"));
            Assert.That(sut.InnerException, Is.Null);
        }
        public void UsingConstructorWithCausationIdReturnsExceptionWithExcpectedProperties()
        {
            var sut = new OptimisticCausationException(CausationId);

            Assert.That(sut.CausationId, Is.EqualTo(CausationId));
            //Use of Contains.Substring due to differences in OS.
            Assert.That(sut.Message, Contains.Substring(typeof(OptimisticCausationException).Name));
            Assert.That(sut.InnerException, Is.Null);
        }
        public void CanBeSerialized()
        {
            var innerException = new Exception("InnerMessage");
            var sut = new OptimisticCausationException(CausationId, "Message", innerException);

            using (var stream = new MemoryStream())
            {
                var formatter = new BinaryFormatter();
                formatter.Serialize(stream, sut);
                stream.Position = 0;
                var result = (OptimisticCausationException) formatter.Deserialize(stream);

                Assert.That(sut.CausationId, Is.EqualTo(CausationId));
                Assert.That(sut.Message, Is.EqualTo(result.Message));
                Assert.That(sut.InnerException.Message, Is.EqualTo(result.InnerException.Message));
            }
        }
        public void CanBeSerialized()
        {
            var innerException = new Exception("InnerMessage");
            var sut            = new OptimisticCausationException(CausationId, "Message", innerException);

            using (var stream = new MemoryStream())
            {
                var formatter = new BinaryFormatter();
                formatter.Serialize(stream, sut);
                stream.Position = 0;
                var result = (OptimisticCausationException)formatter.Deserialize(stream);

                Assert.That(sut.CausationId, Is.EqualTo(CausationId));
                Assert.That(sut.Message, Is.EqualTo(result.Message));
                Assert.That(sut.InnerException.Message, Is.EqualTo(result.InnerException.Message));
            }
        }