예제 #1
0
        public static void NotNullOrEmpty1()
        {
            Action act = () => {
                Require.NotNullOrEmpty("value", "paramName");
                Require.NotNullOrEmpty(" ", "paramName");
            };

            Assert.DoesNotThrow(act);
        }
예제 #2
0
        public static void NotNullOrEmpty3()
        {
            var    paramName = "paramName";
            Action act       = () => Require.NotNullOrEmpty(String.Empty, paramName);

            var ex = Record.Exception(act);

            Assert.NotNull(ex);
            Assert.NotNull(ex.Message);
            var argex = Assert.IsType <ArgumentException>(ex);

            Assert.Equal(paramName, argex.ParamName);
        }
예제 #3
0
        public static void NotNullOrEmpty_ThrowsArgumentNullException_ForNull()
        {
            // Arrange
            var    paramName = "paramName";
            Action act       = () => Require.NotNullOrEmpty(null, paramName);

            // Act
            var ex = Record.Exception(act);

            // Assert
            Assert.NotNull(ex);
            Assert.NotNull(ex.Message);
            var argex = Assert.IsType <ArgumentNullException>(ex);

            Assert.Equal(paramName, argex.ParamName);
        }
예제 #4
0
 public static void NotNullOrEmpty_DoesNotThrow_ForNonNullOrEmptyString()
 => Require.NotNullOrEmpty("value", "paramName");