Exemple #1
0
        public void GivenValueShouldNotThrowException()
        {
            // Arrange
            IExampleInterface reference;

            _exampleClass = new ExampleService();

            // Act
            Action act = () =>
            {
                reference = _exampleClass.ThrowIfNull("paramName");
            };

            // Assert
            act.Should().NotThrow <ArgumentNullException>();
        }
Exemple #2
0
        public void GivenNullValueShouldThrowException()
        {
            // Arrange
            IExampleInterface reference;

            _exampleClass = null;

            // Act
            Action act = () =>
            {
                reference = _exampleClass.ThrowIfNull("example");
            };

            // Assert
            act.Should().Throw <ArgumentNullException>().WithMessage("Value cannot be null. (Parameter 'example')");
        }