Example #1
0
        public static void ScriptThrowsAnException(ScriptFile script, Exception ex)
        {
            var scenario = MethodBase.GetCurrentMethod().GetFullName();

            "Given a script which throws an exception"
                .f(() => script = ScriptFile.Create(scenario).WriteLine(@"throw new Exception(""BOOM!"");"));

            "When I execute the script"
                .f(() => ex = Record.Exception(() => script.Execute()));

            "Then the script fails"
                .f(() => ex.ShouldNotBeNull());

            "And I see the exception message"
                .f(() => ex.Message.ShouldContain("BOOM!"));
        }
Example #2
0
        public void ShouldNotBeNull_returns_the_value_for_further_expectations()
        {
            var value = new Exception();

            var returnedValue = value.ShouldNotBeNull();

            Assert.IsNotNull(returnedValue);
        }
Example #3
0
        public void ShouldNotBeNull_does_nothing_for_none_values()
        {
            var value = new Exception();

            value.ShouldNotBeNull();
        }