@@ -12,7 +12,7 @@ public class ScriptExecutionTests
12
12
{
13
13
[ Fact ]
14
14
public void ShouldExecuteHelloWorld ( )
15
- {
15
+ {
16
16
var result = ExecuteInProcess ( Path . Combine ( "HelloWorld" , "HelloWorld.csx" ) ) ;
17
17
//Assert.Contains("Hello World", result.output);
18
18
}
@@ -39,9 +39,9 @@ public void ShouldHandlePackageWithNativeLibraries()
39
39
{
40
40
var result = Execute ( Path . Combine ( "NativeLibrary" , "NativeLibrary.csx" ) ) ;
41
41
Assert . Contains ( "Connection successful" , result . output ) ;
42
- }
42
+ }
43
43
}
44
-
44
+
45
45
[ Fact ]
46
46
public static void ShouldReturnExitCodeOnenWhenScriptFails ( )
47
47
{
@@ -80,7 +80,7 @@ public static void ShouldHandleIssue166()
80
80
{
81
81
var result = Execute ( Path . Combine ( "Issue166" , "Issue166.csx" ) ) ;
82
82
Assert . Contains ( "Connection successful" , result . output ) ;
83
- }
83
+ }
84
84
}
85
85
86
86
[ Fact ]
@@ -101,7 +101,7 @@ public static void ShouldPassKnownArgumentToScriptWhenEscapedByDoubleHyphen()
101
101
public static void ShouldNotPassUnEscapedKnownArgumentToScript ( )
102
102
{
103
103
var result = Execute ( $ "{ Path . Combine ( "Arguments" , "Arguments.csx" ) } ", "-v" ) ;
104
- Assert . DoesNotContain ( "-v" , result . output ) ;
104
+ Assert . DoesNotContain ( "-v" , result . output ) ;
105
105
}
106
106
107
107
[ Fact ]
@@ -120,15 +120,15 @@ public static void ShouldHandleIssue181()
120
120
121
121
[ Fact ]
122
122
public static void ShouldHandleIssue198 ( )
123
- {
123
+ {
124
124
var result = Execute ( Path . Combine ( "Issue198" , "Issue198.csx" ) ) ;
125
125
Assert . Contains ( "NuGet.Client" , result . output ) ;
126
126
}
127
127
128
128
129
129
[ Fact ]
130
130
public static void ShouldHandleIssue204 ( )
131
- {
131
+ {
132
132
var result = Execute ( Path . Combine ( "Issue204" , "Issue204.csx" ) ) ;
133
133
Assert . Contains ( "System.Net.WebProxy" , result . output ) ;
134
134
}
@@ -192,6 +192,45 @@ public void ShouldSupportInlineNugetReferencesWithTrailingSemicoloninEvaluatedCo
192
192
Assert . Contains ( "AutoMapper.MapperConfiguration" , result . output ) ;
193
193
}
194
194
195
+ [ Fact ]
196
+ public static void ShouldHandleIssue235 ( )
197
+ {
198
+ string code =
199
+ @"using AgileObjects.AgileMapper;
200
+ public class TestClass
201
+ {
202
+ public TestClass()
203
+ {
204
+ IMapper mapper = Mapper.CreateNew();
205
+ }
206
+ }" ;
207
+
208
+ string script =
209
+ @"#! ""netcoreapp2.0""
210
+ #r ""nuget: AgileObjects.AgileMapper, 0.23.1""
211
+ #r ""TestLibrary.dll""
212
+
213
+ using AgileObjects.AgileMapper;
214
+
215
+ IMapper mapper = Mapper.CreateNew();
216
+ var testClass = new TestClass();
217
+ Console.WriteLine(""Hello World!"");" ;
218
+
219
+
220
+ using ( var disposableFolder = new DisposableFolder ( ) )
221
+ {
222
+ var projectFolder = Path . Combine ( disposableFolder . Path , "TestLibrary" ) ;
223
+ ProcessHelper . RunAndCaptureOutput ( "dotnet" , new [ ] { "new classlib -n TestLibrary" } , disposableFolder . Path ) ;
224
+ ProcessHelper . RunAndCaptureOutput ( "dotnet" , new [ ] { "add TestLibrary.csproj package AgileObjects.AgileMapper -v 0.23.0" } , projectFolder ) ;
225
+ File . WriteAllText ( Path . Combine ( projectFolder , "Class1.cs" ) , code ) ;
226
+ File . WriteAllText ( Path . Combine ( projectFolder , "script.csx" ) , script ) ;
227
+ ProcessHelper . RunAndCaptureOutput ( "dotnet" , new [ ] { "build -c release -o ./" } , projectFolder ) ;
228
+
229
+ var dotnetScriptArguments = GetDotnetScriptArguments ( Path . Combine ( projectFolder , "script.csx" ) ) ;
230
+ var result = ProcessHelper . RunAndCaptureOutput ( "dotnet" , dotnetScriptArguments ) ;
231
+ Assert . Contains ( "Hello World!" , result . output ) ;
232
+ }
233
+ }
195
234
private static ( string output , int exitCode ) Execute ( string fixture , params string [ ] arguments )
196
235
{
197
236
var result = ProcessHelper . RunAndCaptureOutput ( "dotnet" , GetDotnetScriptArguments ( Path . Combine ( ".." , ".." , ".." , "TestFixtures" , fixture ) , arguments ) ) ;
@@ -209,8 +248,8 @@ private static (string output, int exitCode) ExecuteCode(string code)
209
248
/// </summary>
210
249
private static int ExecuteInProcess ( string fixture , params string [ ] arguments )
211
250
{
212
- var pathToFixture = Path . Combine ( ".." , ".." , ".." , "TestFixtures" , fixture ) ;
213
- var allArguments = new List < string > ( new [ ] { pathToFixture } ) ;
251
+ var pathToFixture = Path . Combine ( ".." , ".." , ".." , "TestFixtures" , fixture ) ;
252
+ var allArguments = new List < string > ( new [ ] { pathToFixture } ) ;
214
253
if ( arguments != null )
215
254
{
216
255
allArguments . AddRange ( arguments ) ;
0 commit comments