@@ -12,16 +12,16 @@ public static class ScriptExecution
1212 [ Scenario ]
1313 [ Example ( true ) ]
1414 [ Example ( false ) ]
15- public static void HelloWorld ( bool debug , ScriptDirectory directory , string output )
15+ public static void HelloWorld ( bool debug , ScenarioDirectory directory , string output )
1616 {
1717 var scenario = MethodBase . GetCurrentMethod ( ) . GetFullName ( ) ;
1818
1919 "Given a hello world script"
20- . f ( ( ) => directory = new ScriptDirectory ( scenario )
20+ . f ( ( ) => directory = ScenarioDirectory . Create ( scenario )
2121 . WriteLine ( "foo.csx" , @"Console.WriteLine(""Hello world!"");" ) ) ;
2222
2323 "When I execute the script with debug set to {0}"
24- . f ( ( ) => output = directory . RunScript ( "foo.csx" , debug ) ) ;
24+ . f ( ( ) => output = ScriptCsExe . Run ( "foo.csx" , debug , directory ) ) ;
2525
2626 "Then I see 'Hello world!'"
2727 . f ( ( ) => output . ShouldContain ( "Hello world!" ) ) ;
@@ -30,21 +30,22 @@ public static void HelloWorld(bool debug, ScriptDirectory directory, string outp
3030 [ Scenario ]
3131 [ Example ( true ) ]
3232 [ Example ( false ) ]
33- public static void ScriptThrowsAnException ( bool debug , ScriptDirectory directory , Exception ex )
33+ public static void ScriptThrowsAnException ( bool debug , ScenarioDirectory directory , Exception exception )
3434 {
3535 var scenario = MethodBase . GetCurrentMethod ( ) . GetFullName ( ) ;
3636
3737 "Given a script which throws an exception"
38- . f ( ( ) => directory = new ScriptDirectory ( scenario ) . WriteLine ( "foo.csx" , @"throw new Exception(""BOOM!"");" ) ) ;
38+ . f ( ( ) => directory = ScenarioDirectory . Create ( scenario )
39+ . WriteLine ( "foo.csx" , @"throw new Exception(""BOOM!"");" ) ) ;
3940
4041 "When I execute the script with debug set to {0}"
41- . f ( ( ) => ex = Record . Exception ( ( ) => directory . RunScript ( "foo.csx" , debug ) ) ) ;
42+ . f ( ( ) => exception = Record . Exception ( ( ) => ScriptCsExe . Run ( "foo.csx" , debug , directory ) ) ) ;
4243
43- "Then the script fails"
44- . f ( ( ) => ex . ShouldNotBeNull ( ) ) ;
44+ "Then scriptcs fails"
45+ . f ( ( ) => exception . ShouldBeType < ScriptCsException > ( ) ) ;
4546
4647 "And I see the exception message"
47- . f ( ( ) => ex . Message . ShouldContain ( "BOOM!" ) ) ;
48+ . f ( ( ) => exception . Message . ShouldContain ( "BOOM!" ) ) ;
4849 }
4950 }
5051}
0 commit comments