64 references to Throws
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (1)
SourceGeneration\AdditionalSourcesCollectionTests.cs (1)
183var exception = Assert.Throws<ArgumentException>("hintName", () => asc.CopyTo(asc2));
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (17)
Compilation\CompilationAPITests.cs (17)
2793Assert.Throws<ArgumentException>("name", () => 2797Assert.Throws<ArgumentException>("name", () => 2801Assert.Throws<ArgumentException>(null, () => 2805Assert.Throws<ArgumentException>(null, () => 2809Assert.Throws<ArgumentException>(null, () => 2818Assert.Throws<ArgumentNullException>("returnType", () => compilation.CreateBuiltinOperator( 2820Assert.Throws<ArgumentNullException>("leftType", () => compilation.CreateBuiltinOperator( 2822Assert.Throws<ArgumentNullException>("rightType", () => compilation.CreateBuiltinOperator( 2983Assert.Throws<ArgumentException>("name", () => 2987Assert.Throws<ArgumentException>(null, () => 2991Assert.Throws<ArgumentException>(null, () => 2995Assert.Throws<ArgumentException>("name", () => 2999Assert.Throws<ArgumentException>("name", () => 3003Assert.Throws<ArgumentException>("name", () => 3007Assert.Throws<ArgumentException>("name", () => 3016Assert.Throws<ArgumentNullException>("returnType", () => compilation.CreateBuiltinOperator( 3018Assert.Throws<ArgumentNullException>("operandType", () => compilation.CreateBuiltinOperator(
Microsoft.CodeAnalysis.UnitTests (28)
Analyzers\AnalyzerFileReferenceTests.cs (2)
47Assert.Throws<ArgumentNullException>("fullPath", () => new AnalyzerFileReference(null!, s_analyzerLoader)); 51Assert.Throws<ArgumentException>("fullPath", () => new AnalyzerFileReference("a.dll", s_analyzerLoader));
Collections\ImmutableSegmentedDictionaryTest.cs (2)
201Assert.Throws<ArgumentException>(null, () => map.WithComparer(StringComparer.OrdinalIgnoreCase)); 209var exception = Assert.Throws<ArgumentException>(null, () => map.Add("firstKey", "3"));
Collections\ImmutableSegmentedListTest.cs (8)
621Assert.Throws<ArgumentOutOfRangeException>("index", () => list.RemoveRange(-1, 0)); 622Assert.Throws<ArgumentOutOfRangeException>("count", () => list.RemoveRange(0, -1)); 642Assert.Throws<ArgumentNullException>("items", () => list.RemoveRange(null!)); 725Assert.Throws<ArgumentOutOfRangeException>("index", () => emptyList[-1]); 726Assert.Throws<ArgumentOutOfRangeException>("index", () => emptyList[0]); 727Assert.Throws<ArgumentOutOfRangeException>("index", () => emptyList[1]); 730Assert.Throws<ArgumentOutOfRangeException>("index", () => listOfOne[-1]); 732Assert.Throws<ArgumentOutOfRangeException>("index", () => listOfOne[1]);
Collections\List\SegmentedList.Generic.Tests.BinarySearch.cs (2)
69Assert.Throws<ArgumentException>(null, () => list.BinarySearch(0, count + 1, element, GetIComparer())); //"Finding items longer than array should throw ArgumentException" 72Assert.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)
73Assert.Throws<ArgumentException>(null, () => list.CopyTo(0, new T[0], 0, count + 1)); 74Assert.Throws<ArgumentException>(null, () => list.CopyTo(count, new T[0], 0, 1));
Collections\List\SegmentedList.Generic.Tests.Reverse.cs (1)
139Assert.Throws<ArgumentException>(null, () => list.Reverse(invalidSet.Item1, invalidSet.Item2));
Emit\SemanticEditTests.cs (11)
31Assert.Throws<ArgumentNullException>("oldSymbol", () => new SemanticEdit(SemanticEditKind.Update, oldSymbol: null, newSymbol: type)); 32Assert.Throws<ArgumentNullException>("oldSymbol", () => new SemanticEdit(SemanticEditKind.Delete, oldSymbol: null, newSymbol: type)); 34Assert.Throws<ArgumentNullException>("newSymbol", () => new SemanticEdit(SemanticEditKind.Update, oldSymbol: type, newSymbol: null)); 35Assert.Throws<ArgumentNullException>("newSymbol", () => new SemanticEdit(SemanticEditKind.Insert, oldSymbol: type, newSymbol: null)); 36Assert.Throws<ArgumentNullException>("newSymbol", () => new SemanticEdit(SemanticEditKind.Replace, oldSymbol: type, newSymbol: null)); 39Assert.Throws<ArgumentOutOfRangeException>("kind", () => new SemanticEdit(SemanticEditKind.Replace, oldSymbol: method, newSymbol: method, instrumentation: instrumentation)); 40Assert.Throws<ArgumentOutOfRangeException>("kind", () => new SemanticEdit(SemanticEditKind.Insert, oldSymbol: method, newSymbol: method, instrumentation: instrumentation)); 41Assert.Throws<ArgumentOutOfRangeException>("kind", () => new SemanticEdit(SemanticEditKind.Delete, oldSymbol: method, newSymbol: method, instrumentation: instrumentation)); 43Assert.Throws<ArgumentException>("oldSymbol", () => new SemanticEdit(SemanticEditKind.Update, oldSymbol: type, newSymbol: method, instrumentation: instrumentation)); 44Assert.Throws<ArgumentException>("newSymbol", () => new SemanticEdit(SemanticEditKind.Update, oldSymbol: method, newSymbol: type, instrumentation: instrumentation)); 49Assert.Throws<ArgumentOutOfRangeException>("Kinds", () => new SemanticEdit(SemanticEditKind.Update, oldSymbol: method, newSymbol: method,
Microsoft.CodeAnalysis.Workspaces.UnitTests (10)
Simplifier\SimplifierTests.cs (3)
51Assert.Throws<ArgumentNullException>("services", () => Simplifier.Expand(node, semanticModel, services: null!)); 52Assert.Throws<ArgumentNullException>("workspace", () => Simplifier.Expand(node, semanticModel, workspace: null!)); 54Assert.Throws<ArgumentNullException>("workspace", () => Simplifier.Expand(token: default, semanticModel, workspace: null!));
SolutionTests\ProjectInfoTests.cs (1)
59Assert.Throws<ArgumentException>("analyzerReferences[1]",
SolutionTests\SolutionTests.cs (6)
2176Assert.Throws<ArgumentNullException>("projectId", () => solution.AddAnalyzerReferences(null!, [analyzerRef1])); 2179Assert.Throws<ArgumentException>("analyzerReferences[1]", () => solution.AddAnalyzerReferences(projectId, [analyzerRef1, analyzerRef1])); 2202Assert.Throws<ArgumentNullException>("projectId", () => solution.RemoveAnalyzerReference(null!, analyzerRef1)); 2246Assert.Throws<ArgumentException>("analyzerReferences[1]", () => solution.AddAnalyzerReferences([analyzerRef1, analyzerRef1])); 2373Assert.Throws<ArgumentNullException>("documentId", () => solution.AddDocument(documentId: null!, "name", loader)); 2374Assert.Throws<ArgumentNullException>("name", () => solution.AddDocument(documentId, name: null!, loader));
System.Windows.Forms.Tests (8)
System\Windows\Forms\DragDropHelperTests.cs (5)
76Assert.Throws<ArgumentNullException>(nameof(dataObject), () => DragDropHelper.IsInDragLoop(dataObject)); 83Assert.Throws<ArgumentNullException>(nameof(dataObject), () => DragDropHelper.IsInDragLoop(dataObject)); 177Assert.Throws<ArgumentNullException>(nameof(dataObject), 185Assert.Throws<ArgumentNullException>(nameof(e), () => DragDropHelper.SetDragImage(new DataObject(), e)); 345Assert.Throws<ArgumentNullException>(nameof(dataObject), () => DragDropHelper.SetInDragLoop(dataObject, true));
System\Windows\Forms\MessageBoxTests.cs (3)
17Assert.Throws<InvalidEnumArgumentException>( 60Assert.Throws<InvalidEnumArgumentException>( 102Assert.Throws<InvalidEnumArgumentException>(