1005 references to From
Analyzer.Utilities.UnitTests (3)
ConfigurationSchemaGenerator.Tests (2)
GenerateDocumentationAndConfigFiles (3)
IdeCoreBenchmarks (3)
Metrics (3)
Metrics.Legacy (3)
Microsoft.Analyzers.Extra.Tests (2)
Microsoft.Analyzers.Local.Tests (2)
Microsoft.AspNetCore.Analyzer.Testing (2)
Microsoft.AspNetCore.App.Analyzers (1)
Microsoft.AspNetCore.App.Analyzers.Test (1)
Microsoft.AspNetCore.Components.Analyzers.Tests (1)
Microsoft.AspNetCore.Components.SdkAnalyzers.Tests (1)
Microsoft.AspNetCore.Http.Extensions.Tests (11)
RequestDelegateGenerator\CompileTimeCreationTests.cs (10)
56project = project.AddDocument("TestMapActions.cs", SourceText.From(source, Encoding.UTF8)).Project;
57project = project.AddDocument("OtherTestMapActions.cs", SourceText.From(otherSource, Encoding.UTF8)).Project;
82project = project.AddDocument("TestMapActions.cs", SourceText.From(source, Encoding.UTF8)).Project;
83project = project.AddDocument("OtherTestMapActions.cs", SourceText.From(otherSource, Encoding.UTF8)).Project;
165project = project.AddDocument("TestMapActions.cs", SourceText.From(source, Encoding.UTF8), filePath: Path.Combine(currentDirectory, "TestMapActions.cs")).Project;
232project = project.AddDocument("TestMapActions.cs", SourceText.From(source, Encoding.UTF8)).Project;
286project = project.AddDocument("TestMapActions.cs", SourceText.From(source, Encoding.UTF8)).Project;
333project = project.AddDocument("TestMapActions.cs", SourceText.From(source, Encoding.UTF8)).Project;
669project = project.AddDocument("TestMapActions.cs", SourceText.From(source, Encoding.UTF8)).Project;
726project = project.AddDocument("TestMapActions.cs", SourceText.From(source, Encoding.UTF8)).Project;
Microsoft.AspNetCore.Http.Microbenchmarks (2)
Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation (1)
Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation.Test (1)
Microsoft.AspNetCore.OpenApi.SourceGenerators.Tests (1)
Microsoft.AspNetCore.SignalR.Client.SourceGenerator (4)
Microsoft.CodeAnalysis (13)
Microsoft.CodeAnalysis.Analyzers (3)
Microsoft.CodeAnalysis.AnalyzerUtilities (3)
Microsoft.CodeAnalysis.BannedApiAnalyzers (3)
Microsoft.CodeAnalysis.CodeStyle (4)
Microsoft.CodeAnalysis.CodeStyle.UnitTestUtilities (2)
Microsoft.CodeAnalysis.CSharp (11)
Syntax\CSharpSyntaxTree.cs (2)
459return ParseText(SourceText.From(text, encoding, SourceHashAlgorithm.Sha1), options, path, diagnosticOptions, isGeneratedCode, cancellationToken);
929=> ParseText(SourceText.From(text, encoding, SourceHashAlgorithm.Sha1), options, path, diagnosticOptions, isGeneratedCode: null, cancellationToken);
Syntax\SyntaxFactory.cs (4)
1561return CSharpSyntaxTree.ParseText(SourceText.From(text, encoding, SourceHashAlgorithm.Sha1), (CSharpParseOptions?)options, path, diagnosticOptions: null, isGeneratedCode: null, cancellationToken);
1922return SourceText.From(text, Encoding.UTF8).GetSubText(offset);
2799return ParseSyntaxTree(SourceText.From(text, encoding), options, path, diagnosticOptions, isGeneratedCode: null, cancellationToken);
2827return ParseSyntaxTree(SourceText.From(text, encoding), options, path, diagnosticOptions, isGeneratedCode, cancellationToken);
Microsoft.CodeAnalysis.CSharp.CodeStyle (1)
Microsoft.CodeAnalysis.CSharp.CommandLine.UnitTests (1)
Microsoft.CodeAnalysis.CSharp.EditorFeatures (6)
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (64)
PdbSourceDocument\ImplementationAssemblyLookupServiceTests.cs (17)
39var sourceText = SourceText.From(metadataSource, encoding: Encoding.UTF8);
73var sourceText = SourceText.From(metadataSource, encoding: Encoding.UTF8);
111var sourceText = SourceText.From(metadataSource, encoding: Encoding.UTF8);
142var sourceText = SourceText.From(metadataSource, Encoding.UTF8);
167sourceText = SourceText.From("""
199var sourceText = SourceText.From(metadataSource, encoding: Encoding.UTF8);
223sourceText = SourceText.From("""
256var sourceText = SourceText.From(metadataSource, encoding: Encoding.UTF8);
280sourceText = SourceText.From("""
307var sourceText = SourceText.From(metadataSource, encoding: Encoding.UTF8);
331sourceText = SourceText.From("""
354var sourceText = SourceText.From(metadataSource, encoding: Encoding.UTF8);
378sourceText = SourceText.From("""
412var sourceText = SourceText.From(metadataSource, encoding: Encoding.UTF8);
436sourceText = SourceText.From("""
474var sourceText = SourceText.From(metadataSource, encoding: Encoding.UTF8);
498var typeForwardSourceText = SourceText.From(typeForwardSource, Encoding.UTF8);
PdbSourceDocument\PdbSourceDocumentTests.cs (13)
327var sourceText = SourceText.From(metadataSource, encoding: Encoding.UTF8);
353var sourceText = SourceText.From(metadataSource, encoding: Encoding.UTF8);
385var sourceText = SourceText.From(metadataSource, Encoding.UTF8);
426var sourceText = SourceText.From(metadataSource, Encoding.UTF8);
453sourceText = SourceText.From("""
623CompileTestSource(path, SourceText.From("""
775var sourceText = SourceText.From(source, Encoding.UTF8);
826var sourceText1 = SourceText.From(source1, Encoding.UTF8);
827var sourceText2 = SourceText.From(source2, Encoding.UTF8);
872var result = service.TryAddDocumentToWorkspace(requestPath, new StaticSourceTextContainer(SourceText.From(string.Empty)), out var documentId);
891var openResult = service.TryAddDocumentToWorkspace(file.FilePath, new StaticSourceTextContainer(SourceText.From(string.Empty)), out var documentId);
934var openResult = service.TryAddDocumentToWorkspace(fileOne.FilePath, new StaticSourceTextContainer(SourceText.From(string.Empty)), out var documentId);
945Assert.Throws<System.ArgumentException>(() => service.TryAddDocumentToWorkspace(fileTwo.FilePath, new StaticSourceTextContainer(SourceText.From(string.Empty)), out var documentIdTwo));
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (1)
Microsoft.CodeAnalysis.CSharp.Emit2.UnitTests (7)
PDB\PDBTests.cs (4)
47var tree3 = SyntaxFactory.ParseSyntaxTree(SourceText.From("class C { }", encoding: null), path: "Bar.cs");
68var tree4 = SyntaxFactory.ParseSyntaxTree(SourceText.From("class D { public void F() { } }", new UTF8Encoding(false, false)), path: "Baz.cs");
104context.AddSource("hint2", SourceText.From("class G2 { void F() {} }", Encoding.UTF8, checksumAlgorithm: SourceHashAlgorithm.Sha256));
106Assert.Throws<ArgumentException>(() => context.AddSource("hint3", SourceText.From("class G3 { void F() {} }", encoding: null, checksumAlgorithm: SourceHashAlgorithm.Sha256)));
Microsoft.CodeAnalysis.CSharp.Features.UnitTests (10)
EditAndContinue\CSharpEditAndContinueAnalyzerTests.cs (10)
299var newSolution = oldSolution.WithDocumentText(documentId, SourceText.From(source2));
364var newSolution = oldSolution.WithDocumentText(documentId, SourceText.From(source2));
428var newSolution = oldSolution.WithDocumentText(documentId, SourceText.From(source2));
510var newSolution = workspace.CurrentSolution.WithDocumentText(documentId, SourceText.From(source2));
580var newSolution = oldSolution.WithDocumentText(documentId, SourceText.From(source2));
620var newSolution = oldSolution.WithDocumentText(documentId, SourceText.From(source2));
661var newSolution = oldSolution.AddDocument(newDocId, "goo.cs", SourceText.From(source2), filePath: Path.Combine(TempRoot.Root, "goo.cs"));
707var newSolution = oldSolution.AddDocument(newDocId, "goo.cs", SourceText.From(source2), filePath: Path.Combine(TempRoot.Root, "goo.cs"));
740var newSolution = oldSolution.AddDocument(documentId, "goo.cs", SourceText.From(source2), filePath: filePath);
797var newSolution = oldSolution.WithDocumentText(documentId, SourceText.From(source2));
Microsoft.CodeAnalysis.CSharp.Scripting (1)
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (53)
SourceGeneration\AdditionalSourcesCollectionTests.cs (23)
54asc.Add(hintName, SourceText.From("public class D{}", Encoding.UTF8));
70asc.Add(hintName, SourceText.From("public class D{}", Encoding.UTF8));
110var exception = Assert.Throws<ArgumentException>(nameof(hintName), () => asc.Add(hintName, SourceText.From("public class D{}", Encoding.UTF8)));
120asc.Add("file3.cs", SourceText.From("", Encoding.UTF8));
121asc.Add("file1.cs", SourceText.From("", Encoding.UTF8));
122asc.Add("file2.cs", SourceText.From("", Encoding.UTF8));
123asc.Add("file5.cs", SourceText.From("", Encoding.UTF8));
124asc.Add("file4.cs", SourceText.From("", Encoding.UTF8));
144asc.Add(names[i], SourceText.From("", Encoding.UTF8));
166asc.Add(hintName1, SourceText.From("", Encoding.UTF8));
167var exception = Assert.Throws<ArgumentException>("hintName", () => asc.Add(hintName2, SourceText.From("", Encoding.UTF8)));
176asc.Add("hintName1", SourceText.From("", Encoding.UTF8));
177asc.Add("hintName2", SourceText.From("", Encoding.UTF8));
180asc2.Add("hintName3", SourceText.From("", Encoding.UTF8));
181asc2.Add("hintName1", SourceText.From("", Encoding.UTF8));
200asc.Add(addHintName, SourceText.From("", Encoding.UTF8));
212asc.Add(addHintName, SourceText.From("", Encoding.UTF8));
224asc.Add("file1.cs", SourceText.From("", Encoding.UTF8));
225asc.Add("file2.cs", SourceText.From("", Encoding.UTF32));
226asc.Add("file3.cs", SourceText.From("", Encoding.Unicode));
229Assert.Throws<ArgumentException>(() => asc.Add("file4.cs", SourceText.From("")));
232Assert.Throws<ArgumentException>(() => asc.Add("file5.cs", SourceText.From("", encoding: null)));
234var exception = Assert.Throws<ArgumentException>(() => asc.Add("file5.cs", SourceText.From("", encoding: null)));
SourceGeneration\GeneratorDriverTests.cs (12)
460sgc.AddSource("test", SourceText.From("public class D{}", Encoding.UTF8));
463Assert.Throws<ArgumentException>("hintName", () => sgc.AddSource("test", SourceText.From("public class D{}", Encoding.UTF8)));
466Assert.Throws<ArgumentException>("hintName", () => sgc.AddSource("test.cs", SourceText.From("public class D{}", Encoding.UTF8)));
491spc.AddSource("test", SourceText.From("public class D{}", Encoding.UTF8));
494Assert.Throws<ArgumentException>("hintName", () => spc.AddSource("test", SourceText.From("public class D{}", Encoding.UTF8)));
497Assert.Throws<ArgumentException>("hintName", () => spc.AddSource("test.cs", SourceText.From("public class D{}", Encoding.UTF8)));
504spc.AddSource("test", SourceText.From("public class D{}", Encoding.UTF8));
586var generator = new CallbackGenerator((ic) => { }, (sgc) => { sgc.AddSource("test", SourceText.From("public class D {}", Encoding.UTF8)); });
616var generator = new CallbackGenerator((ic) => { }, (sgc) => { sgc.AddSource("test", SourceText.From("public class D {}", Encoding.UTF8)); sgc.AddSource("test2", SourceText.From("public class E {}", Encoding.UTF8)); });
756e.AddSource("a", SourceText.From("public class E {}", Encoding.UTF8));
780var generator = new CallbackGenerator((ic) => { }, (sgc) => { sgc.AddSource("a", SourceText.From("")); });
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (140)
Syntax\SyntaxTreeTests.cs (9)
86SyntaxTreeFactoryKind.ParseText => CSharpSyntaxTree.ParseText(SourceText.From(source, Encoding.UTF8, SourceHashAlgorithm.Sha256), parseOptions),
87SyntaxTreeFactoryKind.Subclass => new MockCSharpSyntaxTree(root, SourceText.From(source, Encoding.UTF8, SourceHashAlgorithm.Sha256), parseOptions),
142SourceText.From(""),
149var newTree = tree.WithChangedText(SourceText.From("class C { }"));
157SourceText.From(""),
173SourceText.From(""),
189SourceText.From(""),
259var oldText = SourceText.From("class B {}", Encoding.Unicode, SourceHashAlgorithms.Default);
301var oldText = SourceText.From("class B {}", Encoding.Unicode, SourceHashAlgorithms.Default);
Microsoft.CodeAnalysis.CSharp.Test.Utilities (3)
Microsoft.CodeAnalysis.CSharp.Workspaces (1)
Microsoft.CodeAnalysis.CSharp.Workspaces.UnitTests (3)
Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities (3)
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (21)
Diagnostics\DiagnosticAnalyzerServiceTests.cs (6)
164project = project.AddAnalyzerConfigDocument(".editorconfig", filePath: "z:\\.editorconfig", text: SourceText.From($"""
172var document = project.AddDocument("test.cs", SourceText.From("class A {}"), filePath: "z:\\test.cs");
255loader: TextLoader.From(TextAndVersion.Create(SourceText.From("class A {}"), VersionStamp.Create(), filePath: "test.cs")),
298text: SourceText.From($"""
331loader: TextLoader.From(TextAndVersion.Create(SourceText.From("class A {}"), VersionStamp.Create(), filePath: "test.cs")),
981return workspace.AddDocument(project.Id, "Empty.cs", SourceText.From("class A { B B {get} }"));
Microsoft.CodeAnalysis.Features (7)
Microsoft.CodeAnalysis.Features.Test.Utilities (6)
Microsoft.CodeAnalysis.Features.UnitTests (23)
EditAndContinue\CompileTimeSolutionProviderTests.cs (5)
48AddAdditionalDocument(additionalDocumentId, "additional", SourceText.From(""), filePath: additionalFilePath).
49AddAnalyzerConfigDocument(analyzerConfigId, "config", SourceText.From(""), filePath: "RazorSourceGenerator.razorencconfig").
102context.AddSource("hint", SourceText.From(s));
114.AddAdditionalDocument(additionalDocumentId, "additional", SourceText.From(""), filePath: "additional.razor")
115.AddAnalyzerConfigDocument(analyzerConfigId, "config", SourceText.From("is_global = true\r\nbuild_property.SuppressRazorSourceGenerator = true"), filePath: "Z:\\RazorSourceGenerator.razorencconfig"),
EditAndContinue\EditAndContinueWorkspaceServiceTests.cs (6)
929solution = solution.AddDocument(designTimeOnlyDocumentId, designTimeOnlyFileName, SourceText.From(sourceDesignTimeOnly, Encoding.UTF8), filePath: designTimeOnlyFilePath);
949solution = solution.AddDocument(designTimeOnlyDocumentId, designTimeOnlyFileName, SourceText.From(sourceDesignTimeOnly, Encoding.UTF8), filePath: designTimeOnlyFilePath);
1150AddDocument("a.cs", SourceText.From(source1, Encoding.UTF8, SourceHashAlgorithm.Sha1), filePath: sourceFile.Path);
1524AddDocument(documentId, "test.cs", SourceText.From(source1, encoding, SourceHashAlgorithm.Sha1), filePath: sourceFile.Path);
2409context.AddSource("generated.cs", SourceText.From("generated: " + additionalText, Encoding.UTF8, SourceHashAlgorithm.Sha256));
2890solution = solution.WithDocumentText(document1.Id, SourceText.From("class C1 { void M() { System.Console.WriteLine(2); } }", encoding: null, SourceHashAlgorithms.Default));
Microsoft.CodeAnalysis.LanguageServer.Protocol (3)
Microsoft.CodeAnalysis.LanguageServer.Protocol.UnitTests (18)
Workspaces\LspWorkspaceManagerTests.cs (5)
85await testLspServer.TestWorkspace.ChangeDocumentAsync(firstDocument.Id, SourceText.From($"Some more text{markupOne}", System.Text.Encoding.UTF8, SourceHashAlgorithms.Default));
119await testLspServer.TestWorkspace.ChangeDocumentAsync(secondDocument.Id, SourceText.From("Two is now three!", System.Text.Encoding.UTF8, SourceHashAlgorithms.Default));
221var newSolution = testLspServer.TestWorkspace.CurrentSolution.AddDocument(newDocumentId, "NewDoc.cs", SourceText.From("New Doc", System.Text.Encoding.UTF8, SourceHashAlgorithms.Default), filePath: @"C:\NewDoc.cs");
516.AddDocument(filePath, SourceText.From("ProjectSystemText"), filePath: filePath)
573testLspServer.TestWorkspace.CurrentSolution.WithDocumentText(document.Id, SourceText.From("New Disk Contents")));
Microsoft.CodeAnalysis.LanguageServer.UnitTests (2)
Microsoft.CodeAnalysis.PerformanceSensitiveAnalyzers (3)
Microsoft.CodeAnalysis.PublicApiAnalyzers (3)
Microsoft.CodeAnalysis.PublicApiAnalyzers.CodeFixes (2)
Microsoft.CodeAnalysis.Rebuild.UnitTests (1)
Microsoft.CodeAnalysis.ResxSourceGenerator (7)
Microsoft.CodeAnalysis.ResxSourceGenerator.UnitTests (2)
Microsoft.CodeAnalysis.Scripting (4)
Hosting\CommandLine\CommandLineRunner.cs (3)
231var script = Script.CreateInitialScript<object>(_scriptCompiler, SourceText.From(initialScriptCodeOpt), options, globals.GetType(), assemblyLoaderOpt: null);
258var tree = _scriptCompiler.ParseSubmission(SourceText.From(input.ToString()), options.ParseOptions, cancellationToken);
283newScript = Script.CreateInitialScript<object>(_scriptCompiler, SourceText.From(code ?? string.Empty), options, globals.GetType(), assemblyLoaderOpt: null);
Microsoft.CodeAnalysis.Scripting.TestUtilities (3)
Microsoft.CodeAnalysis.Test.Utilities (15)
Microsoft.CodeAnalysis.TestAnalyzerReference (4)
Microsoft.CodeAnalysis.UnitTests (137)
EmbeddedTextTests.cs (6)
39Assert.Throws<ArgumentException>("text", () => EmbeddedText.FromSource("path", SourceText.From("source")));
103var source = SourceText.From("", new UTF8Encoding(encoderShouldEmitUTF8Identifier: false), SourceHashAlgorithm.Sha1);
145var source = SourceText.From(SmallSource, Encoding.UTF8, SourceHashAlgorithm.Sha1);
187var source = SourceText.From(LargeSource, Encoding.Unicode, SourceHashAlgorithms.Default);
200var expected = SourceText.From(SmallSource, Encoding.UTF8, SourceHashAlgorithm.Sha1);
215var expected = SourceText.From(LargeSource, Encoding.UTF8, SourceHashAlgorithm.Sha1);
Text\SourceTextTests.cs (20)
29SourceText[] texts = [SourceText.From(string.Empty), SourceText.From([], 0), SourceText.From(new MemoryStream())];
56Assert.Same(s_utf8, SourceText.From(HelloWorld, s_utf8).Encoding);
57Assert.Same(s_unicode, SourceText.From(HelloWorld, s_unicode).Encoding);
85Assert.Equal(SourceHashAlgorithm.Sha1, SourceText.From(HelloWorld).ChecksumAlgorithm);
99Assert.Equal(algorithm, SourceText.From(HelloWorld, checksumAlgorithm: algorithm).ChecksumAlgorithm);
121verifyChecksumAndContentHash(SourceText.From(HelloWorld, encodingNoBOM, checksumAlgorithm), checksumNoBOM, expectedContentHash);
122verifyChecksumAndContentHash(SourceText.From(HelloWorld, encodingBOM, checksumAlgorithm), checksumBOM, expectedContentHash);
166verifyChecksumAndContentHash(fromChanges(SourceText.From(HelloWorld, encodingNoBOM, checksumAlgorithm)), checksumNoBOM, expectedContentHash);
167verifyChecksumAndContentHash(fromChanges(SourceText.From(HelloWorld, encodingBOM, checksumAlgorithm)), checksumBOM, expectedContentHash);
213var f = SourceText.From(HelloWorld, s_utf8);
215Assert.True(f.ContentEquals(SourceText.From(HelloWorld, s_utf8)));
216Assert.False(f.ContentEquals(SourceText.From(HelloWorld + "o", s_utf8)));
217Assert.True(SourceText.From(HelloWorld, s_utf8).ContentEquals(SourceText.From(HelloWorld, s_utf8)));
353var expectedSourceText = SourceText.From(expected);
369var expectedSourceText = SourceText.From(expected);
425var sourceText = SourceText.From("ABCDEFGHIJKLMNOPQRSTUVWXYZ");
444var sourceText = SourceText.From(Text);
456SourceText.From("ABC").Write(TextWriter.Null, TextSpan.FromBounds(4, 4)));
465SourceText.From("ABC").Write(TextWriter.Null, TextSpan.FromBounds(2, 4)));
Text\TextUtilitiesTests.cs (8)
35Assert.Equal(0, TextUtilities.GetLengthOfLineBreak(SourceText.From("aoeu"), 0));
36Assert.Equal(0, TextUtilities.GetLengthOfLineBreak(SourceText.From("aoeu"), 2));
45Assert.Equal(1, TextUtilities.GetLengthOfLineBreak(SourceText.From("\naoeu"), 0));
46Assert.Equal(1, TextUtilities.GetLengthOfLineBreak(SourceText.From("a\nbaou"), 1));
47Assert.Equal(0, TextUtilities.GetLengthOfLineBreak(SourceText.From("a\n"), 0));
56Assert.Equal(2, TextUtilities.GetLengthOfLineBreak(SourceText.From("\r\n"), 0));
57Assert.Equal(1, TextUtilities.GetLengthOfLineBreak(SourceText.From("\n\r"), 0));
66Assert.Equal(1, TextUtilities.GetLengthOfLineBreak(SourceText.From("\r"), 0));
Microsoft.CodeAnalysis.VisualBasic (8)
Syntax\SyntaxNodeFactories.vb (3)
50Return ParseSyntaxTree(SourceText.From(text, encoding, SourceHashAlgorithm.Sha1), options, path, cancellationToken)
79Return ParseSyntaxTree(SourceText.From(text, encoding), options, path, diagnosticOptions, cancellationToken)
288Return SourceText.From(text, Encoding.UTF8).GetSubText(offset)
Microsoft.CodeAnalysis.Workspaces (9)
Microsoft.CodeAnalysis.Workspaces.MSBuild.UnitTests (10)
Microsoft.CodeAnalysis.Workspaces.Test.Utilities (5)
Microsoft.CodeAnalysis.Workspaces.UnitTests (212)
FindReferencesTests.cs (5)
40return solution.AddProject(pi).AddDocument(did, $"{projectName}.{suffix}", SourceText.From(code));
56return solution.AddProject(pi).AddDocument(did, $"{projectName}.{suffix}", SourceText.From(code));
66.AddDocument(did, "goo.cs", SourceText.From(sourceText));
82solution = solution.AddDocument(did, $"goo{docCounter++}.cs", SourceText.From(sourceText));
130.AddDocument(did, "goo.cs", SourceText.From(text));
Formatter\FormatterTests.cs (5)
42=> Task.FromResult(document.WithText(SourceText.From($"Formatted with options: {lineFormattingOptions.ToString().Replace("\r", "\\r").Replace("\n", "\\n")}")));
52var document = workspace.AddDocument(project.Id, "File.dummy", SourceText.From("dummy"));
70var document = workspace.AddDocument(project.Id, "File.dummy", SourceText.From("dummy"));
115var csDocument = workspace.AddDocument(csProject.Id, "File.cs", SourceText.From("class C { }"));
116var vbDocument = workspace.AddDocument(vbProject.Id, "File.vb", SourceText.From("Class C : End Class"));
SolutionTests\SolutionTests.cs (88)
58.AddDocument(DocumentId.CreateNewId(projectId), "goo.cs", SourceText.From("public class Goo { }", Encoding.UTF8, SourceHashAlgorithms.Default), filePath: Path.Combine(s_projectDir, "goo.cs"))
59.AddAdditionalDocument(DocumentId.CreateNewId(projectId), "add.txt", SourceText.From("text", Encoding.UTF8, SourceHashAlgorithms.Default))
60.AddAnalyzerConfigDocument(DocumentId.CreateNewId(projectId), "editorcfg", SourceText.From(editorConfig ?? "#empty", Encoding.UTF8, SourceHashAlgorithms.Default), filePath: Path.Combine(s_projectDir, "editorcfg"))));
80.AddDocument(DocumentId.CreateNewId(projectId1), "goo.cs", SourceText.From(docContents, Encoding.UTF8, SourceHashAlgorithms.Default), filePath: "goo.cs")
81.AddAdditionalDocument(DocumentId.CreateNewId(projectId1), "add.txt", SourceText.From("text", Encoding.UTF8, SourceHashAlgorithms.Default), filePath: "add.txt")
82.AddAnalyzerConfigDocument(DocumentId.CreateNewId(projectId1), "editorcfg", SourceText.From("config", Encoding.UTF8, SourceHashAlgorithms.Default), filePath: "/a/b")
84.AddDocument(DocumentId.CreateNewId(projectId2), "goo.cs", SourceText.From(docContents, Encoding.UTF8, SourceHashAlgorithms.Default), filePath: "goo.cs")
85.AddAdditionalDocument(DocumentId.CreateNewId(projectId2), "add.txt", SourceText.From("text", Encoding.UTF8, SourceHashAlgorithms.Default), filePath: "add.txt")
86.AddAnalyzerConfigDocument(DocumentId.CreateNewId(projectId2), "editorcfg", SourceText.From("config", Encoding.UTF8, SourceHashAlgorithms.Default), filePath: "/a/b")));
332.AddAnalyzerConfigDocument(DocumentId.CreateNewId(projectId), "editorcfg", SourceText.From("config"));
348var text = SourceText.From("new text", encoding: null, SourceHashAlgorithm.Sha1);
372var textAndVersion = TextAndVersion.Create(SourceText.From("new text"), VersionStamp.Default);
396var text = SourceText.From("new text");
449var text = SourceText.From("new text", encoding: null, SourceHashAlgorithm.Sha1);
537var text = SourceText.From("new text", encoding: null, SourceHashAlgorithm.Sha1);
620var text = SourceText.From("new text without pp directives", encoding: null, SourceHashAlgorithm.Sha1);
703var text = SourceText.From("#if true", encoding: null, SourceHashAlgorithm.Sha1);
779var text = SourceText.From("new text", encoding: null, SourceHashAlgorithm.Sha1);
841.AddDocument(DocumentId.CreateNewId(projectId1), "goo.cs", SourceText.From(docContents, Encoding.UTF8, SourceHashAlgorithms.Default), filePath: "goo.cs")
843.AddDocument(DocumentId.CreateNewId(projectId2), "goo.cs", SourceText.From(docContents, Encoding.UTF8, SourceHashAlgorithms.Default), filePath: "goo.cs")));
866var text = SourceText.From(" ", encoding: null, SourceHashAlgorithm.Sha1);
918var text = SourceText.From("new text");
940var textAndVersion = TextAndVersion.Create(SourceText.From("new text"), VersionStamp.Default);
964var text = SourceText.From("new text");
986var textAndVersion = TextAndVersion.Create(SourceText.From("new text"), VersionStamp.Default);
1091.AddDocument(d1, "d1.cs", SourceText.From("class D1;", Encoding.UTF8, SourceHashAlgorithms.Default), filePath: Path.Combine(s_projectDir, "d1.cs"))
1092.AddDocument(d2, "d2.cs", SourceText.From("class D2;", Encoding.UTF8, SourceHashAlgorithms.Default), filePath: Path.Combine(s_projectDir, "d2.cs"))
1093.AddAdditionalDocument(a1, "a1.txt", SourceText.From("text1", Encoding.UTF8, SourceHashAlgorithms.Default))
1094.AddAdditionalDocument(a2, "a2.txt", SourceText.From("text2", Encoding.UTF8, SourceHashAlgorithms.Default))
1095.AddAnalyzerConfigDocument(c1, "c1", SourceText.From("#empty1", Encoding.UTF8, SourceHashAlgorithms.Default), filePath: Path.Combine(s_projectDir, "editorcfg"))
1096.AddAnalyzerConfigDocument(c2, "c2", SourceText.From("#empty2", Encoding.UTF8, SourceHashAlgorithms.Default), filePath: Path.Combine(s_projectDir, "editorcfg"));
1106loader: TextLoader.From(TextAndVersion.Create(SourceText.From("class NewD1;", Encoding.UTF32, SourceHashAlgorithm.Sha256), VersionStamp.Create(), filePath: Path.Combine(s_projectDir, "newD1.cs"))),
1115loader: TextLoader.From(TextAndVersion.Create(SourceText.From("class NewD3;", Encoding.UTF8, SourceHashAlgorithms.Default), VersionStamp.Create(), filePath: Path.Combine(s_projectDir, "newD3.cs"))),
1125loader: TextLoader.From(TextAndVersion.Create(SourceText.From("new text1", Encoding.UTF32, SourceHashAlgorithm.Sha256), VersionStamp.Create(), filePath: Path.Combine(s_projectDir, "newD1.cs"))),
1134loader: TextLoader.From(TextAndVersion.Create(SourceText.From("new text3", Encoding.UTF8, SourceHashAlgorithms.Default), VersionStamp.Create(), filePath: Path.Combine(s_projectDir, "newD3.cs"))),
1144loader: TextLoader.From(TextAndVersion.Create(SourceText.From("#new empty1", Encoding.UTF32, SourceHashAlgorithm.Sha256), VersionStamp.Create(), filePath: Path.Combine(s_projectDir, "newD1.cs"))),
1153loader: TextLoader.From(TextAndVersion.Create(SourceText.From("#new empty3", Encoding.UTF8, SourceHashAlgorithms.Default), VersionStamp.Create(), filePath: Path.Combine(s_projectDir, "newD3.cs"))),
1617var textC = SourceText.From("class C {}", encoding: null, checksumAlgorithm: SourceHashAlgorithm.Sha1);
2312var solution4 = solution3.AddAnalyzerConfigDocument(editorConfigId, ".editorconfig", SourceText.From(editorConfigContent), filePath: Path.Combine(s_projectDir, "subfolder", ".editorconfig"));
2423var sourceText = SourceText.From("text", checksumAlgorithm: SourceHashAlgorithms.Default);
2507var root = CSharp.SyntaxFactory.ParseSyntaxTree(SourceText.From("class C {}", encoding: Encoding.ASCII, SourceHashAlgorithm.Sha1)).GetRoot();
3190.AddDocument(documentId, "DocumentName", SourceText.From("class Class{}"));
3806.AddDocument(did, "test", SourceText.From(language == LanguageNames.CSharp ? "class C {}" : "Class C : End Class", Encoding.UTF8, SourceHashAlgorithm.Sha256), filePath: "old path");
4019var solution2 = solution.WithDocumentText(did3, SourceText.From(text4));
4032var doc = ws.AddDocument(proj.Id, "a.cs", SourceText.From("public class c { }", Encoding.UTF32));
4097workspace.AddDocument(project1.Id, "Broken.cs", SourceText.From("class "));
4119project = project.AddDocument("Extra.cs", SourceText.From("class Extra { }")).Project;
4121var documentToFreeze = project.AddDocument("DocumentToFreeze.cs", SourceText.From(""));
4144project = project.AddDocument("Extra.cs", SourceText.From("class Extra { }")).Project;
4146var documentToFreeze = project.AddDocument("DocumentToFreeze.cs", SourceText.From(""));
4172project = project.AddDocument("Extra.cs", SourceText.From("class Extra { }")).Project;
4174var documentToFreezeOriginal = project.AddDocument("DocumentToFreeze.cs", SourceText.From("class DocumentToFreeze { void M() { } }"));
4178var solution = project.Solution.WithDocumentText(documentToFreezeOriginal.Id, SourceText.From("class DocumentToFreeze { void M() { /*no top level change*/ } }"));
4217project = project.AddDocument("Extra.cs", SourceText.From("class Extra { }")).Project;
4219var documentToFreezeOriginal = project.AddDocument("DocumentToFreeze.cs", SourceText.From("class DocumentToFreeze { void M() { } }"));
4223var solution = project.Solution.WithDocumentText(documentToFreezeOriginal.Id, SourceText.From("class DocumentToFreeze { void M() { } public void NewMethod() { } }"));
4285var document = workspace.AddDocument(project2.Id, "Test.cs", SourceText.From(""));
4389document = document.WithText(SourceText.From("// Source File with Changes"));
4415.WithDocumentText(documentId1, SourceText.From("// Document 1 Changed"))
4416.WithDocumentText(documentId2, SourceText.From("// Document 2 Changed"))
4417.WithDocumentText(documentId3, SourceText.From("// Document 3 Changed"));
4602var text = SourceText.From("// empty", encoding: null, SourceHashAlgorithms.Default);
4717loader: TextLoader.From(TextAndVersion.Create(SourceText.From("[*.*]\r\n\r\ndotnet_diagnostic.CA1234.severity = error"), VersionStamp.Default)))));
4750loader: TextLoader.From(TextAndVersion.Create(SourceText.From("[*.*]\r\n\r\ndotnet_diagnostic.CA1234.severity = error"), VersionStamp.Default)))));
4791loader: TextLoader.From(TextAndVersion.Create(SourceText.From("[*.*]\r\n\r\ndotnet_diagnostic.CA1234.severity = error"), VersionStamp.Default)))));
4803TextLoader.From(TextAndVersion.Create(SourceText.From("[*.*]\r\n\r\ndotnet_diagnostic.CA6789.severity = error"), VersionStamp.Default)),
4839loader: TextLoader.From(TextAndVersion.Create(SourceText.From("is_global = true\r\n\r\ndotnet_diagnostic.CA1234.severity = error"), VersionStamp.Default)))));
4885loader: TextLoader.From(TextAndVersion.Create(SourceText.From("[*.*]\r\n\r\ngenerated_code = true"), VersionStamp.Default)))));
5467var text = SourceText.From("public class C { }");
5515var sourceTextToRelease = ObjectReference.CreateFromFactory(static () => SourceText.From(Guid.NewGuid().ToString()));
5563.AddDocument(documentId, "test.cs", SourceText.From("public class C { }"), filePath: sourcePath)
5564.AddAnalyzerConfigDocument(DocumentId.CreateNewId(projectId), ".editorconfig", SourceText.From($"[{pattern}]\nindent_style = tab"), filePath: configPath);
5624project = project.AddDocument("Extra.cs", SourceText.From("class Extra { }")).Project;
5641project = project.AddDocument("Extra.cs", SourceText.From("class Extra { }")).Project;
5662project1 = project2.Solution.GetProject(project1.Id).AddDocument("Doc1", SourceText.From("class Doc1 { }")).Project;
5663project2 = project1.Solution.GetProject(project2.Id).AddDocument("Doc2", SourceText.From("class Doc2 { }")).Project;
5690project1 = project2.Solution.GetProject(project1.Id).AddDocument("Doc1", SourceText.From("class Doc1 { }")).Project;
5691project2 = project1.Solution.GetProject(project2.Id).AddDocument("Doc2", SourceText.From("class Doc2 { }")).Project;
5720project1 = project2.Solution.GetProject(project1.Id).AddDocument("Doc1", SourceText.From("class Doc1 { }")).Project;
5721project2 = project1.Solution.GetProject(project2.Id).AddDocument("Doc2", SourceText.From("class Doc2 { }")).Project;
5752project1 = project1.AddDocument("Doc1", SourceText.From("class Doc1 { }")).Project;
5761var forkedProject1 = frozenSolution.WithDocumentText(project1.Documents.Single().Id, SourceText.From("class Doc2 { }")).GetProject(project1.Id);
5780project1 = project1.AddDocument("Doc1", SourceText.From("class Doc1 { }")).Project;
5800var forkedProject1 = frozenSolution.WithDocumentText(project1.Documents.Single().Id, SourceText.From("class Doc2 { }")).GetProject(project1.Id);
5829project = project.AddDocument("Extra.ts", SourceText.From("class Extra { }")).Project;
5852.AddDocument($"Document", SourceText.From("class C { }"), filePath: @"c:\test\Document.cs").Project;
5862.AddDocument($"Document", SourceText.From("class C { }"), filePath: @"c:\test\Document.cs").Project;
5873old => old.WithDocumentText(documentId1, SourceText.From(lastContents)),
SolutionTests\SolutionWithSourceGeneratorTests.cs (33)
204project = project.AdditionalDocuments.First().WithAdditionalDocumentText(SourceText.From("Changed text!")).Project;
228project = project.AddDocument("Source.cs", SourceText.From("")).Project;
261project = project.Solution.WithDocumentText(documentId, SourceText.From("// Changed Source File")).Projects.Single();
304project = project.Solution.WithAdditionalDocumentText(additionalDocumentId, SourceText.From("Hello, everyone!")).Projects.Single();
309project = project.Solution.WithAdditionalDocumentText(additionalDocumentId, SourceText.From("Good evening, everyone!")).Projects.Single();
373SourceText.From("Hello, world!!!!")).Projects.Single();
487project = project.Documents.Single().WithText(SourceText.From("// Change")).Project;
593var differentOpenTextContainer = SourceText.From("// Open Text").Container;
617var differentOpenTextContainer = SourceText.From("// StaticContent", Encoding.UTF8).Container;
632.AddAdditionalDocument("Test.txt", SourceText.From(""));
637var differentOpenTextContainer = SourceText.From("// Open Text").Container;
668var differentOpenTextContainer = SourceText.From("// Open Text").Container;
695var differentOpenTextContainer = SourceText.From("// Open Text").Container;
732documentToFreeze = documentToFreeze.WithText(SourceText.From("// Changed Source File"));
762document = document.WithText(SourceText.From("// Something else"));
791document = document.WithText(SourceText.From("// Something else"));
825document = document.WithText(SourceText.From("// Something else"));
886identity, DateTime.Now, SourceText.From("// Frozen Document"));
913[(sourceGeneratedDocument1.Identity, DateTime.Now, SourceText.From("// Frozen 1")), (sourceGeneratedDocument2.Identity, DateTime.Now, SourceText.From("// Frozen 2"))]);
933sourceGeneratedDocumentIdentity, sourceGeneratedDocument.GenerationDateTime, SourceText.From("// Hello, World"));
997[(ordinaryDocument.Id, SourceText.From("// Regular modified")),
998(sourceGeneratedDocument.Id, SourceText.From("// Source gen modified"))]);
1152sourceGeneratedDocument = sourceGeneratedDocument.WithText(SourceText.From("// Something else"));
1180sourceGeneratedDocument = sourceGeneratedDocument.WithText(SourceText.From("// Something else"));
1184sourceGeneratedDocument = sourceGeneratedDocument.WithText(SourceText.From("// Thrice is nice"));
1216var solution = sourceGeneratedDocument1.WithText(SourceText.From("// Change doc 1")).Project.Solution;
1223solution = sourceGeneratedDocument2!.WithText(SourceText.From("// Change doc 2")).Project.Solution;
1265newDocument = newDocument.WithText(SourceText.From("// Changed frozen document"));
1274identity, DateTime.Now, SourceText.From("// Frozen Document"));
1311identity, DateTime.Now, SourceText.From("// Frozen Document"));
1342identity, DateTime.Now, SourceText.From("// Frozen Document"));
1377identity, DateTime.Now, SourceText.From("// Frozen Document"));
WorkspaceTests\AdhocWorkspaceTests.cs (13)
73var doc = ws.AddDocument(project.Id, name, SourceText.From(source));
155loader: TextLoader.From(TextAndVersion.Create(SourceText.From(""), VersionStamp.Create())));
213var text = SourceText.From("public class C { }");
247var text = SourceText.From("public class C { }");
281var text = SourceText.From("public class C { }");
320var text = SourceText.From("public class C { }");
378var docid1 = ws.AddDocument(projid, "A.cs", SourceText.From("public class A { }")).Id;
379var docid2 = ws.AddDocument(projid, "B.cs", SourceText.From("public class B { }")).Id;
415var originalDoc = ws.AddDocument(projectId, "TestDocument", SourceText.From(""));
446var originalDoc = ws.AddDocument(projectId, "TestDocument", SourceText.From(""));
482var originalDoc = ws.AddDocument(projectId, "TestDocument", SourceText.From(""));
514var originalDoc = ws.AddDocument(projectId, "TestDocument", SourceText.From(""));
545var originalDoc = ws.AddDocument(projectId, "TestDocument", SourceText.From(""));
WorkspaceTests\WorkspaceTests.cs (6)
25var originalDoc = ws.AddDocument(projectId, "TestDocument", SourceText.From(""));
27var changedDoc = originalDoc.WithText(SourceText.From("new"));
38var originalDoc = ws.AddDocument(projectId, "TestDocument", SourceText.From(""));
54var originalDoc = ws.AddDocument(projectId, "TestDocument", SourceText.From(""));
73var originalDoc = ws.AddDocument(projectId, "TestDocument", SourceText.From(""));
90var originalDoc = ws.AddDocument(projectId, "TestDocument", SourceText.From(""));
Microsoft.Extensions.Logging.Generators (1)
Microsoft.Extensions.Options.SourceGeneration (1)
Microsoft.Extensions.Validation.ValidationsGenerator (1)
Microsoft.Gen.ComplianceReports.Unit.Tests (1)
Microsoft.Gen.ContextualOptions.Unit.Tests (1)
Microsoft.Gen.Logging (1)
Microsoft.Gen.Logging.Unit.Tests (1)
Microsoft.Gen.MetadataExtractor.Unit.Tests (1)
Microsoft.Gen.Metrics (2)
Microsoft.Gen.Metrics.Unit.Tests (1)
Microsoft.Gen.MetricsReports.Unit.Tests (1)
Microsoft.Maui.Controls.SourceGen (3)
Microsoft.ML.AutoML.SourceGenerator (3)
Microsoft.VisualStudio.LanguageServices (1)
Microsoft.VisualStudio.LanguageServices.CSharp (2)
Microsoft.VisualStudio.LanguageServices.CSharp.UnitTests (2)
Microsoft.VisualStudio.LanguageServices.Implementation (2)
Microsoft.VisualStudio.LanguageServices.LiveShare (2)
Roslyn.Diagnostics.Analyzers (3)
Roslyn.Diagnostics.CSharp.Analyzers (1)
Roslyn.VisualStudio.Next.UnitTests (69)
Remote\SnapshotSerializationTests.cs (9)
50var document1 = project1.AddDocument("Document1", SourceText.From(csCode));
54var document2 = project2.AddDocument("Document2", SourceText.From(vbCode));
60.AddAdditionalDocument("Additional", SourceText.From("hello"), ["test"], @".\Add").Project.Solution;
67loader: TextLoader.From(TextAndVersion.Create(SourceText.From("root = true"), VersionStamp.Create())))]);
153var document = workspace.CurrentSolution.AddProject("Project", "Project.dll", LanguageNames.CSharp).AddDocument("Document", SourceText.From(code));
173var document = solution.AddProject("Project", "Project.dll", LanguageNames.CSharp).AddDocument("Document", SourceText.From(code));
532var document = CreateWorkspace().CurrentSolution.AddProject("empty", "empty", LanguageNames.CSharp).AddDocument("empty", SourceText.From(""));
609var sourceText = SourceText.From("Hello", Encoding.UTF8);
627sourceText = SourceText.From("Hello", new NotSerializableEncoding());
Services\ServiceHubServicesTests.cs (43)
454var tempDoc = project.AddDocument("X.cs", SourceText.From("// "));
469Assert.True(localWorkspace.SetCurrentSolution(s => s.WithDocumentText(tempDocId, SourceText.From("// " + i)), WorkspaceChangeKind.SolutionChanged));
515=> SourceText.From(content, encoding ?? Encoding.UTF8, checksumAlgorithm);
722return ImmutableArray.Create(("hint", SourceText.From($"// generated document {callCount}", Encoding.UTF8)));
744solution = solution.WithTextDocumentText(tempDocId, SourceText.From("// new contents"));
777var tempDoc = project.AddDocument("X.cs", SourceText.From("// "));
806return ImmutableArray.Create(("hint", SourceText.From($"// generated document {callCount}", Encoding.UTF8)));
861return ImmutableArray.Create(("hint", SourceText.From($"// generated document {callCount}", Encoding.UTF8)));
915var tempDoc = project1.AddDocument("X.cs", SourceText.From("// "));
924var tempDoc = project2.AddDocument("X.cs", SourceText.From("// "));
966var tempDoc = project1.AddDocument("X.cs", SourceText.From("// "));
975var tempDoc = project2.AddDocument("X.cs", SourceText.From("// "));
1007var tempDoc = project1.AddDocument("X.cs", SourceText.From("// "));
1016var tempDoc = project2.AddDocument("X.cs", SourceText.From("// "));
1050var tempDoc = project1.AddDocument("X.cs", SourceText.From("// "));
1059var tempDoc = project2.AddDocument("X.cs", SourceText.From("// "));
1102var tempDoc = project1.AddDocument("X.cs", SourceText.From("// "));
1112var tempDoc = project2.AddDocument("X.cs", SourceText.From("// "));
1155var tempDoc = project1.AddDocument("X.cs", SourceText.From("// "));
1165var tempDoc = project2.AddDocument("X.cs", SourceText.From("// "));
1208var tempDoc = project1.AddDocument("X.cs", SourceText.From("// "));
1218var tempDoc = project2.AddDocument("X.cs", SourceText.From("// "));
1253var tempDoc = project1.AddDocument("X.cs", SourceText.From("// "));
1263var tempDoc = project2.AddDocument("X.cs", SourceText.From("// "));
1298var tempDoc = project1.AddDocument("X.cs", SourceText.From("// "));
1307var tempDoc = project2.AddDocument("X.cs", SourceText.From("// "));
1341var tempDoc = project1.AddDocument("X.cs", SourceText.From("// "));
1350var tempDoc = project2.AddDocument("X.cs", SourceText.From("// "));
1455Contract.ThrowIfFalse(workspace.TryApplyChanges(workspace.CurrentSolution.WithDocumentText(normalDocId, SourceText.From("// new text"))));
1515var tempDoc = project.AddDocument("X.cs", SourceText.From("// "));
1527Contract.ThrowIfFalse(workspace.TryApplyChanges(workspace.CurrentSolution.WithDocumentText(tempDoc.Id, SourceText.From("// new text"))));
1541Contract.ThrowIfFalse(workspace.TryApplyChanges(workspace.CurrentSolution.WithDocumentText(tempDoc.Id, SourceText.From("// more new text"))));
1599var tempDoc = project.AddDocument("X.cs", SourceText.From("// "));
1611Contract.ThrowIfFalse(workspace.TryApplyChanges(workspace.CurrentSolution.WithDocumentText(tempDoc.Id, SourceText.From("// new text"))));
1633Contract.ThrowIfFalse(workspace.TryApplyChanges(workspace.CurrentSolution.WithDocumentText(tempDoc.Id, SourceText.From("// more new text"))));
1678var tempDoc = project.AddDocument("X.cs", SourceText.From("// "));
1690Contract.ThrowIfFalse(workspace.TryApplyChanges(workspace.CurrentSolution.WithDocumentText(tempDoc.Id, SourceText.From("// new text"))));
1717Contract.ThrowIfFalse(workspace.TryApplyChanges(workspace.CurrentSolution.WithDocumentText(tempDoc.Id, SourceText.From("// more new text"))));
1810var tempDoc = project1.AddDocument("X.cs", SourceText.From("// "));
1985return SourceText.From(document.State.GetTextSynchronously(CancellationToken.None).ToString() + csAddition);
1988return SourceText.From(document.State.GetTextSynchronously(CancellationToken.None).ToString() + vbAddition);
2100solution = current.AddDocument($"Document{i}", SourceText.From(documents[i])).Project.Solution;
2106solution = current.AddAdditionalDocument($"AdditionalDocument{i}", SourceText.From(additionalDocuments[i])).Project.Solution;
Services\SolutionServiceTests.cs (16)
159await VerifySolutionUpdate(code, s => s.WithDocumentText(s.Projects.First().DocumentIds.First(), SourceText.From(code + " ")));
307project = project.AddDocument("newDocument", SourceText.From("// new text")).Project;
326loader: TextLoader.From(TextAndVersion.Create(SourceText.From("test"), VersionStamp.Create())));
337return s.WithAdditionalDocumentText(additionalDocumentId, SourceText.From("changed"));
358loader: TextLoader.From(TextAndVersion.Create(SourceText.From("root = true"), VersionStamp.Create(), filePath: configPath)),
370return s.WithAnalyzerConfigDocumentText(analyzerConfigDocumentId, SourceText.From("root = false"));
390loader: TextLoader.From(TextAndVersion.Create(SourceText.From("class A { }"), VersionStamp.Create())));
401return s.WithDocumentText(documentId, SourceText.From("class Changed { }"));
428var currentSolution = remoteSolution1.WithDocumentText(remoteSolution1.Projects.First().Documents.First().Id, SourceText.From(code + " class Test2 { }"));
437currentSolution = oopSolution2.WithDocumentText(oopSolution2.Projects.First().Documents.First().Id, SourceText.From(code + " class Test3 { }"));
513var frozenText1 = SourceText.From("// Hello, World!");
522var frozenText2 = SourceText.From("// Hello, World! A second time!");
826solution = solution.GetProject(project1.Id).AddDocument("X.cs", SourceText.From("// X")).Project.Solution;
827solution = solution.GetProject(project2.Id).AddDocument("Y.vb", SourceText.From("' Y")).Project.Solution;
881solution = solution.GetProject(project1.Id).AddDocument("X.cs", SourceText.From("// X")).Project.Solution;
882solution = solution.GetProject(project2.Id).AddDocument("Y.cs", SourceText.From("// Y")).Project.Solution;
StackDepthTest (1)
System.Private.CoreLib.Generators (2)
System.Text.Json.SourceGeneration (1)
System.Windows.Forms.Analyzers.CSharp.Tests (1)
System.Windows.Forms.Analyzers.Tests (6)
Test.Utilities (4)
Text.Analyzers (4)
Text.Analyzers.UnitTests (1)