61 references to Throws
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (1)
SourceGeneration\AdditionalSourcesCollectionTests.cs (1)
183
var exception = Assert.
Throws
<ArgumentException>("hintName", () => asc.CopyTo(asc2));
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (17)
Compilation\CompilationAPITests.cs (17)
2792
Assert.
Throws
<ArgumentException>("name", () =>
2796
Assert.
Throws
<ArgumentException>("name", () =>
2800
Assert.
Throws
<ArgumentException>(null, () =>
2804
Assert.
Throws
<ArgumentException>(null, () =>
2808
Assert.
Throws
<ArgumentException>(null, () =>
2817
Assert.
Throws
<ArgumentNullException>("returnType", () => compilation.CreateBuiltinOperator(
2819
Assert.
Throws
<ArgumentNullException>("leftType", () => compilation.CreateBuiltinOperator(
2821
Assert.
Throws
<ArgumentNullException>("rightType", () => compilation.CreateBuiltinOperator(
2982
Assert.
Throws
<ArgumentException>("name", () =>
2986
Assert.
Throws
<ArgumentException>(null, () =>
2990
Assert.
Throws
<ArgumentException>(null, () =>
2994
Assert.
Throws
<ArgumentException>("name", () =>
2998
Assert.
Throws
<ArgumentException>("name", () =>
3002
Assert.
Throws
<ArgumentException>("name", () =>
3006
Assert.
Throws
<ArgumentException>("name", () =>
3015
Assert.
Throws
<ArgumentNullException>("returnType", () => compilation.CreateBuiltinOperator(
3017
Assert.
Throws
<ArgumentNullException>("operandType", () => compilation.CreateBuiltinOperator(
Microsoft.CodeAnalysis.UnitTests (33)
Analyzers\AnalyzerFileReferenceTests.cs (2)
47
Assert.
Throws
<ArgumentNullException>("fullPath", () => new AnalyzerFileReference(null!, s_analyzerLoader));
51
Assert.
Throws
<ArgumentException>("fullPath", () => new AnalyzerFileReference("a.dll", s_analyzerLoader));
Collections\ImmutableSegmentedDictionaryTest.cs (2)
201
Assert.
Throws
<ArgumentException>(null, () => map.WithComparer(StringComparer.OrdinalIgnoreCase));
209
var exception = Assert.
Throws
<ArgumentException>(null, () => map.Add("firstKey", "3"));
Collections\ImmutableSegmentedListTest.cs (12)
296
Assert.
Throws
<ArgumentOutOfRangeException>("index", () => list.InsertRange(1, nonEmptyList));
297
Assert.
Throws
<ArgumentOutOfRangeException>("index", () => list.InsertRange(-1, nonEmptyList));
305
Assert.
Throws
<ArgumentOutOfRangeException>("index", () => list.InsertRange(106, nonEmptyList));
306
Assert.
Throws
<ArgumentOutOfRangeException>("index", () => list.InsertRange(-1, nonEmptyList));
621
Assert.
Throws
<ArgumentOutOfRangeException>("index", () => list.RemoveRange(-1, 0));
622
Assert.
Throws
<ArgumentOutOfRangeException>("count", () => list.RemoveRange(0, -1));
642
Assert.
Throws
<ArgumentNullException>("items", () => list.RemoveRange(null!));
725
Assert.
Throws
<ArgumentOutOfRangeException>("index", () => emptyList[-1]);
726
Assert.
Throws
<ArgumentOutOfRangeException>("index", () => emptyList[0]);
727
Assert.
Throws
<ArgumentOutOfRangeException>("index", () => emptyList[1]);
730
Assert.
Throws
<ArgumentOutOfRangeException>("index", () => listOfOne[-1]);
732
Assert.
Throws
<ArgumentOutOfRangeException>("index", () => listOfOne[1]);
Collections\List\SegmentedList.Generic.Tests.BinarySearch.cs (2)
69
Assert.
Throws
<ArgumentException>(null, () => list.BinarySearch(0, count + 1, element, GetIComparer())); //"Finding items longer than array should throw ArgumentException"
72
Assert.
Throws
<ArgumentException>(null, () => list.BinarySearch(count + 1, count, element, GetIComparer())); //"ArgumentException should be thrown on index greater than length of array."
Collections\List\SegmentedList.Generic.Tests.cs (2)
73
Assert.
Throws
<ArgumentException>(null, () => list.CopyTo(0, new T[0], 0, count + 1));
74
Assert.
Throws
<ArgumentException>(null, () => list.CopyTo(count, new T[0], 0, 1));
Collections\List\SegmentedList.Generic.Tests.Reverse.cs (1)
139
Assert.
Throws
<ArgumentException>(null, () => list.Reverse(invalidSet.Item1, invalidSet.Item2));
Collections\List\SegmentedList.Generic.Tests.Sort.cs (1)
200
Assert.
Throws
<ArgumentException>(null, () => list.Sort(invalidSet.Item1, invalidSet.Item2, GetIComparer()));
Emit\SemanticEditTests.cs (11)
31
Assert.
Throws
<ArgumentNullException>("oldSymbol", () => new SemanticEdit(SemanticEditKind.Update, oldSymbol: null, newSymbol: type));
32
Assert.
Throws
<ArgumentNullException>("oldSymbol", () => new SemanticEdit(SemanticEditKind.Delete, oldSymbol: null, newSymbol: type));
34
Assert.
Throws
<ArgumentNullException>("newSymbol", () => new SemanticEdit(SemanticEditKind.Update, oldSymbol: type, newSymbol: null));
35
Assert.
Throws
<ArgumentNullException>("newSymbol", () => new SemanticEdit(SemanticEditKind.Insert, oldSymbol: type, newSymbol: null));
36
Assert.
Throws
<ArgumentNullException>("newSymbol", () => new SemanticEdit(SemanticEditKind.Replace, oldSymbol: type, newSymbol: null));
39
Assert.
Throws
<ArgumentOutOfRangeException>("kind", () => new SemanticEdit(SemanticEditKind.Replace, oldSymbol: method, newSymbol: method, instrumentation: instrumentation));
40
Assert.
Throws
<ArgumentOutOfRangeException>("kind", () => new SemanticEdit(SemanticEditKind.Insert, oldSymbol: method, newSymbol: method, instrumentation: instrumentation));
41
Assert.
Throws
<ArgumentOutOfRangeException>("kind", () => new SemanticEdit(SemanticEditKind.Delete, oldSymbol: method, newSymbol: method, instrumentation: instrumentation));
43
Assert.
Throws
<ArgumentException>("oldSymbol", () => new SemanticEdit(SemanticEditKind.Update, oldSymbol: type, newSymbol: method, instrumentation: instrumentation));
44
Assert.
Throws
<ArgumentException>("newSymbol", () => new SemanticEdit(SemanticEditKind.Update, oldSymbol: method, newSymbol: type, instrumentation: instrumentation));
49
Assert.
Throws
<ArgumentOutOfRangeException>("Kinds", () => new SemanticEdit(SemanticEditKind.Update, oldSymbol: method, newSymbol: method,
Microsoft.CodeAnalysis.Workspaces.UnitTests (10)
Simplifier\SimplifierTests.cs (3)
51
Assert.
Throws
<ArgumentNullException>("services", () => Simplifier.Expand(node, semanticModel, services: null!));
52
Assert.
Throws
<ArgumentNullException>("workspace", () => Simplifier.Expand(node, semanticModel, workspace: null!));
54
Assert.
Throws
<ArgumentNullException>("workspace", () => Simplifier.Expand(token: default, semanticModel, workspace: null!));
SolutionTests\ProjectInfoTests.cs (1)
59
Assert.
Throws
<ArgumentException>("analyzerReferences[1]",
SolutionTests\SolutionTests.cs (6)
2176
Assert.
Throws
<ArgumentNullException>("projectId", () => solution.AddAnalyzerReferences(null!, [analyzerRef1]));
2179
Assert.
Throws
<ArgumentException>("analyzerReferences[1]", () => solution.AddAnalyzerReferences(projectId, [analyzerRef1, analyzerRef1]));
2202
Assert.
Throws
<ArgumentNullException>("projectId", () => solution.RemoveAnalyzerReference(null!, analyzerRef1));
2246
Assert.
Throws
<ArgumentException>("analyzerReferences[1]", () => solution.AddAnalyzerReferences([analyzerRef1, analyzerRef1]));
2373
Assert.
Throws
<ArgumentNullException>("documentId", () => solution.AddDocument(documentId: null!, "name", loader));
2374
Assert.
Throws
<ArgumentNullException>("name", () => solution.AddDocument(documentId, name: null!, loader));