176 references to CreateSubmission
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (31)
CodeGen\CodeGenScriptTests.cs (29)
212var s0 = CreateSubmission("var x = new { a = 1 }; "); 213var sx = CreateSubmission("var y = new { b = 2 }; ", previous: s0); 214var s1 = CreateSubmission("var y = new { b = new { a = 3 } };", previous: s0); 215var s2 = CreateSubmission("x = y.b; ", previous: s1); 238var s0 = CreateSubmission("var i = 1; dynamic d = null; d.m(ref i);", references); 239var sx = CreateSubmission("var i = 1; dynamic d = null; d.m(ref i, ref i);", references, previous: s0); 240var s1 = CreateSubmission("var i = 1; dynamic d = null; d.m(out i);", references, previous: s0); 259var s0 = CreateSubmission("int a = 1;"); 260var s11 = CreateSubmission("a + 1", previous: s0); 261var s12 = CreateSubmission("a + 2", previous: s0); 270var c0 = CreateSubmission(@" 277var c1 = CreateSubmission(@" 292var c0 = CreateSubmission(@" 299var c1 = CreateSubmission(@" 314var c0 = CreateSubmission(@" 321var c1 = CreateSubmission(@" 336var c0 = CreateSubmission(@" 343var c1 = CreateSubmission(@" 358var c0 = CreateSubmission(@" 375var c0 = CreateSubmission(@" 382var c1 = CreateSubmission(@" 397var c0 = CreateSubmission(@" 407var c1 = CreateSubmission(@" 422var c0 = CreateSubmission(@" 442var c0 = CreateSubmission(@" 464var c0 = CreateSubmission(@" 477var s0 = CreateSubmission("int Goo() { return 2;}"); 478var s1 = CreateSubmission("(4 + 5) * Goo()", previous: s0); 648var s = CreateSubmission(test);
CodeGen\GotoTest.cs (2)
1179compilation = CreateSubmission(source); 1213compilation = CreateSubmission(source);
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (111)
Semantics\InteractiveUsingTests.cs (50)
23var sub = CreateSubmission("using System; typeof(String)"); 32var sub = CreateSubmission("using I = System.Int32; typeof(I)"); 41var sub = CreateSubmission("using static System.Environment; NewLine"); 51var sub1 = CreateSubmission( 57var sub2 = CreateSubmission( 63var sub3 = CreateSubmission( 80var sub = (Compilation)CreateSubmission(source); 103var sub1 = CreateSubmission("class A { }"); 104var sub2 = CreateSubmission("class B : A { }", previous: sub1); 105var sub3 = CreateSubmission("class C : B { }", previous: sub2); 107CreateSubmission("using A1 = A;", previous: sub3).VerifyDiagnostics(); 108CreateSubmission("using B1 = B;", previous: sub3).VerifyDiagnostics(); 110var sub4 = CreateSubmission("using C1 = C; typeof(C1)", previous: sub3); 143CreateSubmission(source).GetDiagnostics().Verify(expectedDiagnostics); 162CreateSubmission(source, options: options).GetDiagnostics().Verify(expectedDiagnostics); 180CreateSubmission(source).GetDiagnostics().Verify(expectedDiagnostics); 186var sub1 = CreateSubmission("using A = System.Int32; typeof(A)"); 189var sub2 = CreateSubmission("using A = System.Int16; typeof(A)", previous: sub1); 192var sub3 = CreateSubmission("class A { }", previous: sub2); 195var sub4 = CreateSubmission("using A = System.Int64; typeof(A)", previous: sub3); 212var sub = (Compilation)CreateSubmission(source); 222var sub1 = CreateSubmission("class A { public static int AA; }"); 223var sub2 = CreateSubmission("class B { public static int BB; }", previous: sub1); 224var sub3 = CreateSubmission("class C { public static int CC; }", previous: sub2); 226CreateSubmission("using static A;", previous: sub3).VerifyDiagnostics(); 227CreateSubmission("using static B;", previous: sub3).VerifyDiagnostics(); 229var sub4 = CreateSubmission("using static C;", previous: sub3); 252CreateSubmission(source).GetDiagnostics().Verify(expectedDiagnostics); 271CreateSubmission(source, options: options).GetDiagnostics().Verify(expectedDiagnostics); 277CreateSubmission("using System; using System;").VerifyDiagnostics( 286CreateSubmission("using System;", previous: CreateSubmission("using System;")).VerifyDiagnostics(); 292CreateSubmission("typeof(String)", options: TestOptions.DebugDll.WithUsings("System", "System")).VerifyDiagnostics(); 300var sub1 = CreateSubmission("typeof(String)", options: options); 303var sub2 = CreateSubmission("typeof(String)", options: options, previous: sub1); 327var sub1 = CreateSubmission("using A; typeof(A1) == typeof(B1)", new[] { lib1 }, options); 330var sub2 = CreateSubmission("typeof(A1) == typeof(B1) && typeof(A2) == typeof(B2)", new[] { lib1, lib2 }, options: options, previous: sub1); 363var compilation = CreateSubmission( 434var compilation = CreateSubmission( 437previous: CreateSubmission(previousSubmissionSource)); 484var compilation = CreateSubmission( 533var curr = CreateSubmission(submission, refs, previous: prev); 559CreateSubmission("using NInner;", refs, previous: CreateSubmission("using NOuter;", refs)).VerifyDiagnostics( 564CreateSubmission("using NI = NInner;", refs, previous: CreateSubmission("using NOuter;", refs)).VerifyDiagnostics( 569CreateSubmission("using static COuter;", refs, previous: CreateSubmission("using NOuter;", refs)).VerifyDiagnostics( 574CreateSubmission("using static NInner.CInner;", refs, previous: CreateSubmission("using NOuter;", refs)).VerifyDiagnostics(
Semantics\LocalFunctionTests.cs (10)
5141CreateSubmission(source, new[] { ScriptTestFixtures.HostRef }, hostObjectType: typeof(ScriptGlobals)) 5157CreateSubmission(source, new[] { ScriptTestFixtures.HostRef }, hostObjectType: typeof(ScriptGlobals)) 5164var previous = CreateSubmission("int previousSubmissionVariable = 42;") 5176CreateSubmission(source, previous: previous) 5183var previous = CreateSubmission("int previousSubmissionVariable = 42;") 5195CreateSubmission(source, previous: previous) 5202var previous = CreateSubmission("void PreviousSubmissionMethod() { }") 5214CreateSubmission(source, previous: previous) 5221var previous = CreateSubmission("void PreviousSubmissionMethod() { }") 5233CreateSubmission(source, previous: previous)
Semantics\ScriptSemanticsTests.cs (51)
322var c = CreateSubmission(@" 508var submission = CreateSubmission(source); 552var compilation = CreateSubmission(test); 583var compilation = CreateSubmission(text); 612var submission = CreateSubmission("x", 661var compilation = CreateSubmission(source); 677var compilation = CreateSubmission(source); 695var c0 = CreateSubmission(source0); 703var c1 = CreateSubmission(source1, previous: c0); 712var c0 = CreateSubmission(@"public class C { private static int goo() { return 1; } }"); 713var c1 = CreateSubmission(@"C.goo()", previous: c0); 723var c0 = CreateSubmission(@" 731var c1 = CreateSubmission(@" 756CreateSubmission(@"protected A x;", previous: c1).VerifyDiagnostics( 762CreateSubmission(@"internal A x;", previous: c1).VerifyDiagnostics( 766CreateSubmission(@"internal protected A x;", previous: c1).VerifyDiagnostics( 772CreateSubmission(@"public A x;", previous: c1).VerifyDiagnostics( 776CreateSubmission(@"internal B x;", previous: c1).VerifyDiagnostics( 780CreateSubmission(@"internal protected B x;", previous: c1).VerifyDiagnostics( 786CreateSubmission(@"public B x;", previous: c1).VerifyDiagnostics( 794var c0 = CreateSubmission(@" 799var c1 = CreateSubmission("s + i", previous: c0, returnType: typeof(int)); 800var c2 = CreateSubmission("static int t = i;", previous: c1); 808var c0 = CreateSubmission(@" 814var c1 = CreateSubmission(@" 831var c0 = CreateSubmission(@" 848var c0 = CreateSubmission(@" 851var c1 = CreateSubmission(@" 869var s0 = CreateSubmission("int a = \"x\";"); 874Assert.Throws<InvalidOperationException>(() => CreateSubmission("a + 1", previous: s0)); 881var submission = CreateSubmission("using Unknown;"); 896var c = CreateSubmission("Z()", new[] { HostRef }); 912var c = CreateSubmission(source, new[] { HostRef }, hostObjectType: typeof(C)); 931var c = CreateSubmission("int i = 42l;"); 943var c = CreateSubmission("var x = x;"); 953var c = CreateSubmission("var x = 1; { var x = x;}"); 965var c = CreateSubmission( 990var c = CreateSubmission( 1014var c = CreateSubmission(@" 1032var c0 = CreateSubmission("var x = 1;"); 1033var c1 = CreateSubmission("&x", previous: c0); 1044var c0 = CreateSubmission("&x", new[] { HostRef }, hostObjectType: typeof(B2)); 1058var c0 = CreateSubmission(source, new[] { SystemCoreRef }); 1069var s0 = CreateSubmission("int i = 5;"); 1070var s1 = CreateSubmission("i* i", previous: s0); 1071var s2 = CreateSubmission("i* i;", previous: s1); 1086var s0 = CreateSubmission(@" 1097var s0 = CreateSubmission("goto Object;"); 1111var s0 = CreateSubmission("static void E(this object o) { }", references); 1113var s1 = CreateSubmission("void F(this object o) { }", references, previous: s0); 1120var s2 = CreateSubmission("static void G(this dynamic o) { }", references, previous: s0);
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (34)
Compilation\CompilationAPITests.cs (32)
2431Assert.True(CreateSubmission("1", parseOptions: TestOptions.Script).HasSubmissionResult()); 2432Assert.False(CreateSubmission("1;", parseOptions: TestOptions.Script).HasSubmissionResult()); 2433Assert.False(CreateSubmission("void goo() { }", parseOptions: TestOptions.Script).HasSubmissionResult()); 2434Assert.False(CreateSubmission("using System;", parseOptions: TestOptions.Script).HasSubmissionResult()); 2435Assert.False(CreateSubmission("int i;", parseOptions: TestOptions.Script).HasSubmissionResult()); 2436Assert.False(CreateSubmission("System.Console.WriteLine();", parseOptions: TestOptions.Script).HasSubmissionResult()); 2437Assert.False(CreateSubmission("System.Console.WriteLine()", parseOptions: TestOptions.Script).HasSubmissionResult()); 2438Assert.True(CreateSubmission("null", parseOptions: TestOptions.Script).HasSubmissionResult()); 2439Assert.True(CreateSubmission("System.Console.WriteLine", parseOptions: TestOptions.Script).HasSubmissionResult()); 2448var s0 = CreateSubmission("int a = \"x\";"); 2453Assert.Throws<InvalidOperationException>(() => CreateSubmission("a + 1", previous: s0)); 3155var script = CreateSubmission("return null;", returnType: typeof(object)); 3163var script = CreateSubmission("return \"¡Hola!\";", returnType: typeof(object)); 3171var script = CreateSubmission("return 42;", returnType: typeof(object)); 3179var script = CreateSubmission("return", returnType: typeof(object)); 3193var script = CreateSubmission("return 42;", returnType: typeof(int)); 3202var script = CreateSubmission("return 42;", returnType: null); 3210var script = CreateSubmission("return 42", returnType: typeof(uint)); 3221var script = CreateSubmission("return await System.Threading.Tasks.Task.FromResult(42);", returnType: typeof(int)); 3225script = CreateSubmission("return await System.Threading.Tasks.Task.FromResult(42);", returnType: typeof(Task<int>)); 3236var script = CreateSubmission("return System.Threading.Tasks.Task.FromResult(42);", returnType: typeof(int)); 3247var script = CreateSubmission(@" 3264var script = CreateSubmission(@" 3276script = CreateSubmission(@" 3292var script = CreateSubmission(@" 3306var script = CreateSubmission(@" 3314script = CreateSubmission(@" 3327var script = CreateSubmission(@" 3336script = CreateSubmission(@" 3346var script = CreateSubmission(@" 3361var script = CreateSubmission(@" 3377var script = CreateSubmission(@"
Symbols\RequiredMembersTests.cs (1)
6277var submission = CreateSubmission("""
Symbols\Source\FileModifierTests.cs (1)
4089var comp = CreateSubmission(source1, parseOptions: TestOptions.Script.WithLanguageVersion(LanguageVersion.Preview));