Exemplo n.º 1
0
        public void Constructor_Empty_ShouldSetDefaultMessage()
        {
            // Act
            var exception = new DroidTooManyArmsException();

            // Assert
            exception.Message.Should().Be(_defaultMessage);
        }
Exemplo n.º 2
0
        public void Constructor_WithMessage_ShouldSetMessage()
        {
            // Arrange
            var message = "Test Message";

            // Act
            var exception = new DroidTooManyArmsException(message);

            // Assert
            exception.Message.Should().Be(message);
        }
Exemplo n.º 3
0
        public void Constructor_WithMessageAndInnerException_ShouldSetBoth()
        {
            // Arrange
            var message        = "Test Message";
            var innerException = new Exception("Inner Test Exception");

            // Act
            var exception = new DroidTooManyArmsException(message, innerException);

            // Assert
            exception.Message.Should().Be(message);
            exception.InnerException.Should().Be(innerException);
        }
Exemplo n.º 4
0
        public void Constructor_WithSerializationInfoAndStreamingContext_ShouldSetBoth()
        {
            // Arrange
            IFormatter formatter       = new BinaryFormatter();
            Stream     stream          = new MemoryStream();
            var        beforeException = new DroidTooManyArmsException();

            // Act
            formatter.Serialize(stream, beforeException);
            stream.Position = 0;
            var afterException = (DroidTooManyArmsException)formatter.Deserialize(stream);

            // Assert
            afterException.Message.Should().Be(_defaultMessage);
        }