private static byte[] SerializeToBytes(OrganizationalServiceException e)
 {
     using (var stream = new MemoryStream())
     {
         new BinaryFormatter().Serialize(stream, e);
         return(stream.GetBuffer());
     }
 }
        public void OrganizationalServiceExceptionSerialization()
        {
            var message = "Test message";

            var exception = new OrganizationalServiceException(message);

            var actual = SerializeToBytes(exception);

            actual.Length.Should().BeGreaterThan(0);
        }
        public void OrganizationalServiceExceptionConstructWithMessageParameter()
        {
            var message = "Test message";

            FluentActions.Invoking(() => systemUnderTest = new OrganizationalServiceException(message))
            .Should()
            .NotThrow();

            Assert.AreEqual(message, systemUnderTest.Message);
        }
        public void OrganizationalServiceExceptionnWithMessageAndInnerException()
        {
            var message = "Test message";

            FluentActions.Invoking(() => systemUnderTest = new OrganizationalServiceException(message, new Exception()))
            .Should()
            .NotThrow();

            Assert.AreEqual(message, systemUnderTest.Message);
            Assert.IsNotNull(systemUnderTest.InnerException);
        }
        public void OrganizationalServiceExceptionDeserialization()
        {
            var message = "Test message";

            var exception = new OrganizationalServiceException(message);
            var bytes     = SerializeToBytes(exception);

            bytes.Length.Should().BeGreaterThan(0);

            var actual = DeserializeFromBytes(bytes);

            actual.Message.Should().Be(message);
            actual.InnerException.Should().BeNull();
        }
 public void OrganizationalServiceExceptionDefaultConstructor()
 {
     FluentActions.Invoking(() => systemUnderTest = new OrganizationalServiceException())
     .Should()
     .NotThrow();
 }
 public void Setup()
 {
     systemUnderTest = new OrganizationalServiceException();
 }