Example #1
0
        public void TestNull()
        {
            // ReSharper disable ExpressionIsAlwaysNull
            // Define variables and constants
            object nonNullObj = new object();
            object nullObj    = null;
            int?   nonNullInt = 3;
            int?   nullInt    = null;

            // Set up context


            // Execute
            Assure.Null(nullObj);
            try {
                Assure.Null(nonNullObj);
                Assert.Fail();                 // Should throw the exception
            }
            catch (AssuranceFailedException) { }

            Assure.Null(nullInt);
            try {
                Assure.Null(nonNullInt);
                Assert.Fail();                 // Should throw the exception
            }
            catch (AssuranceFailedException) { }

            // Assert outcome

            // ReSharper restore ExpressionIsAlwaysNull
        }