예제 #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"));
        }
예제 #2
0
        public void ThrowExceptionIfNull_WithGoodArguments_ShouldNotThrow_ArgumentNullException()
        {
            //Act
            Action act = () => NullChecking.ThrowExceptionIfNull(new object(), "Something");

            //Assert
            act.Should().NotThrow();
        }
예제 #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"));
        }