Exemple #1
0
        public void ThrowExceptionIfNull_WithNullArguments_ShouldThrow_ArgumentNullException()
        {
            //Act
            Action act = () => NullChecking.ThrowExceptionIfNull(null, "Something");

            //Assert
            act.Should().ThrowExactly <ArgumentNullException>().Where(e => e.Message.Contains("Something"));
        }
Exemple #2
0
        public void ThrowExceptionIfNull_WithGoodArguments_ShouldNotThrow_ArgumentNullException()
        {
            //Act
            Action act = () => NullChecking.ThrowExceptionIfNull(new object(), "Something");

            //Assert
            act.Should().NotThrow();
        }
Exemple #3
0
        public void ThrowExceptionIfNullOrContainsNull_WithNullArguments_ShouldNotThrow_ArgumentNullException()
        {
            //Act
            Action act = () =>
                         NullChecking.ThrowExceptionIfNullOrContainsNull(new List <object> {
                new object(), null
            },
                                                                         "Something interesting");

            //Assert
            act.Should().ThrowExactly <ArgumentNullException>().Where(e => e.Message.Contains("Something interesting"));
        }