Exemplo n.º 1
0
        public void It_should_be_serializable()
        {
            var      aMessage     = "Hello world";
            ICommand aCommand     = MockRepository.GenerateMock <ICommand>();
            var      theException = new MappingNotFoundException(aMessage, aCommand);
            MappingNotFoundException deserializedException = null;

            using (var buffer = new MemoryStream())
            {
                var formatter = new BinaryFormatter();
                formatter.Serialize(buffer, theException);

                buffer.Seek(0, SeekOrigin.Begin);
                deserializedException = (MappingNotFoundException)formatter.Deserialize(buffer);
            }

            deserializedException.Should().NotBeNull();
        }