272 references to Throws
Microsoft.AspNetCore.Http.Results.Tests (54)
AcceptedAtRouteOfTResultTests.cs (2)
154
Assert.
Throws
<ArgumentNullException>("method", () => PopulateMetadata<AcceptedAtRoute<object>>(null, new RouteEndpointBuilder(requestDelegate: null, RoutePatternFactory.Parse("/"), order: 0)));
155
Assert.
Throws
<ArgumentNullException>("builder", () => PopulateMetadata<AcceptedAtRoute<object>>(((Delegate)PopulateMetadata_ThrowsArgumentNullException_WhenMethodOrBuilderAreNull).GetMethodInfo(), null));
AcceptedAtRouteResultTests.cs (2)
107
Assert.
Throws
<ArgumentNullException>("method", () => PopulateMetadata<AcceptedAtRoute>(null, new RouteEndpointBuilder(requestDelegate: null, RoutePatternFactory.Parse("/"), order: 0)));
108
Assert.
Throws
<ArgumentNullException>("builder", () => PopulateMetadata<AcceptedAtRoute>(((Delegate)PopulateMetadata_ThrowsArgumentNullException_WhenMethodOrBuilderAreNull).GetMethodInfo(), null));
AcceptedOfTResultTests.cs (2)
95
Assert.
Throws
<ArgumentNullException>("method", () => PopulateMetadata<Accepted<object>>(null, new RouteEndpointBuilder(requestDelegate: null, RoutePatternFactory.Parse("/"), order: 0)));
96
Assert.
Throws
<ArgumentNullException>("builder", () => PopulateMetadata<Accepted<object>>(((Delegate)PopulateMetadata_ThrowsArgumentNullException_WhenMethodOrBuilderAreNull).GetMethodInfo(), null));
AcceptedResultTests.cs (2)
64
Assert.
Throws
<ArgumentNullException>("method", () => PopulateMetadata<Accepted>(null, new RouteEndpointBuilder(requestDelegate: null, RoutePatternFactory.Parse("/"), order: 0)));
65
Assert.
Throws
<ArgumentNullException>("builder", () => PopulateMetadata<Accepted>(((Delegate)PopulateMetadata_ThrowsArgumentNullException_WhenMethodOrBuilderAreNull).GetMethodInfo(), null));
BadRequestOfTResultTests.cs (2)
138
Assert.
Throws
<ArgumentNullException>("method", () => PopulateMetadata<BadRequest<object>>(null, new RouteEndpointBuilder(requestDelegate: null, RoutePatternFactory.Parse("/"), order: 0)));
139
Assert.
Throws
<ArgumentNullException>("builder", () => PopulateMetadata<BadRequest<object>>(((Delegate)PopulateMetadata_ThrowsArgumentNullException_WhenMethodOrBuilderAreNull).GetMethodInfo(), null));
BadRequestResultTests.cs (2)
77
Assert.
Throws
<ArgumentNullException>("method", () => PopulateMetadata<BadRequest>(null, new RouteEndpointBuilder(requestDelegate: null, RoutePatternFactory.Parse("/"), order: 0)));
78
Assert.
Throws
<ArgumentNullException>("builder", () => PopulateMetadata<BadRequest>(((Delegate)PopulateMetadata_ThrowsArgumentNullException_WhenMethodOrBuilderAreNull).GetMethodInfo(), null));
ConflictOfTResultTests.cs (2)
116
Assert.
Throws
<ArgumentNullException>("method", () => PopulateMetadata<Conflict<object>>(null, new RouteEndpointBuilder(requestDelegate: null, RoutePatternFactory.Parse("/"), order: 0)));
117
Assert.
Throws
<ArgumentNullException>("builder", () => PopulateMetadata<Conflict<object>>(((Delegate)PopulateMetadata_ThrowsArgumentNullException_WhenMethodOrBuilderAreNull).GetMethodInfo(), null));
ConflictResultTests.cs (2)
78
Assert.
Throws
<ArgumentNullException>("method", () => PopulateMetadata<Conflict>(null, new RouteEndpointBuilder(requestDelegate: null, RoutePatternFactory.Parse("/"), order: 0)));
79
Assert.
Throws
<ArgumentNullException>("builder", () => PopulateMetadata<Conflict>(((Delegate)PopulateMetadata_ThrowsArgumentNullException_WhenMethodOrBuilderAreNull).GetMethodInfo(), null));
CreatedAtRouteOfTResultTests.cs (2)
124
Assert.
Throws
<ArgumentNullException>("method", () => PopulateMetadata<CreatedAtRoute<object>>(null, new RouteEndpointBuilder(requestDelegate: null, RoutePatternFactory.Parse("/"), order: 0)));
125
Assert.
Throws
<ArgumentNullException>("builder", () => PopulateMetadata<CreatedAtRoute<object>>(((Delegate)PopulateMetadata_ThrowsArgumentNullException_WhenMethodOrBuilderAreNull).GetMethodInfo(), null));
CreatedAtRouteResultTests.cs (2)
105
Assert.
Throws
<ArgumentNullException>("method", () => PopulateMetadata<CreatedAtRoute>(null, new RouteEndpointBuilder(requestDelegate: null, RoutePatternFactory.Parse("/"), order: 0)));
106
Assert.
Throws
<ArgumentNullException>("builder", () => PopulateMetadata<CreatedAtRoute>(((Delegate)PopulateMetadata_ThrowsArgumentNullException_WhenMethodOrBuilderAreNull).GetMethodInfo(), null));
CreatedOfTResultTests.cs (2)
130
Assert.
Throws
<ArgumentNullException>("method", () => PopulateMetadata<Created<object>>(null, new RouteEndpointBuilder(requestDelegate: null, RoutePatternFactory.Parse("/"), order: 0)));
131
Assert.
Throws
<ArgumentNullException>("builder", () => PopulateMetadata<Created<object>>(((Delegate)PopulateMetadata_ThrowsArgumentNullException_WhenMethodOrBuilderAreNull).GetMethodInfo(), null));
CreatedResultTests.cs (2)
95
Assert.
Throws
<ArgumentNullException>("method", () => PopulateMetadata<Created>(null, new RouteEndpointBuilder(requestDelegate: null, RoutePatternFactory.Parse("/"), order: 0)));
96
Assert.
Throws
<ArgumentNullException>("builder", () => PopulateMetadata<Created>(((Delegate)PopulateMetadata_ThrowsArgumentNullException_WhenMethodOrBuilderAreNull).GetMethodInfo(), null));
InternalServerErrorOfTResultTests.cs (2)
138
Assert.
Throws
<ArgumentNullException>("method", () => PopulateMetadata<InternalServerError<object>>(null, new RouteEndpointBuilder(requestDelegate: null, RoutePatternFactory.Parse("/"), order: 0)));
139
Assert.
Throws
<ArgumentNullException>("builder", () => PopulateMetadata<InternalServerError<object>>(((Delegate)PopulateMetadata_ThrowsArgumentNullException_WhenMethodOrBuilderAreNull).GetMethodInfo(), null));
InternalServerErrorResultTests.cs (2)
77
Assert.
Throws
<ArgumentNullException>("method", () => PopulateMetadata<InternalServerError>(null, new RouteEndpointBuilder(requestDelegate: null, RoutePatternFactory.Parse("/"), order: 0)));
78
Assert.
Throws
<ArgumentNullException>("builder", () => PopulateMetadata<InternalServerError>(((Delegate)PopulateMetadata_ThrowsArgumentNullException_WhenMethodOrBuilderAreNull).GetMethodInfo(), null));
NoContentResultTests.cs (2)
74
Assert.
Throws
<ArgumentNullException>("method", () => PopulateMetadata<NoContent>(null, new RouteEndpointBuilder(requestDelegate: null, RoutePatternFactory.Parse("/"), order: 0)));
75
Assert.
Throws
<ArgumentNullException>("builder", () => PopulateMetadata<NoContent>(((Delegate)PopulateMetadata_ThrowsArgumentNullException_WhenMethodOrBuilderAreNull).GetMethodInfo(), null));
NotFoundOfTResultTests.cs (2)
98
Assert.
Throws
<ArgumentNullException>("method", () => PopulateMetadata<NotFound<object>>(null, new RouteEndpointBuilder(requestDelegate: null, RoutePatternFactory.Parse("/"), order: 0)));
99
Assert.
Throws
<ArgumentNullException>("builder", () => PopulateMetadata<NotFound<object>>(((Delegate)PopulateMetadata_ThrowsArgumentNullException_WhenMethodOrBuilderAreNull).GetMethodInfo(), null));
NotFoundResultTests.cs (2)
73
Assert.
Throws
<ArgumentNullException>("method", () => PopulateMetadata<NotFound>(null, new RouteEndpointBuilder(requestDelegate: null, RoutePatternFactory.Parse("/"), order: 0)));
74
Assert.
Throws
<ArgumentNullException>("builder", () => PopulateMetadata<NotFound>(((Delegate)PopulateMetadata_ThrowsArgumentNullException_WhenMethodOrBuilderAreNull).GetMethodInfo(), null));
OkOfTResultTests.cs (2)
115
Assert.
Throws
<ArgumentNullException>("method", () => PopulateMetadata<Ok<object>>(null, new RouteEndpointBuilder(requestDelegate: null, RoutePatternFactory.Parse("/"), order: 0)));
116
Assert.
Throws
<ArgumentNullException>("builder", () => PopulateMetadata<Ok<object>>(((Delegate)PopulateMetadata_ThrowsArgumentNullException_WhenMethodOrBuilderAreNull).GetMethodInfo(), null));
OkResultTests.cs (2)
76
Assert.
Throws
<ArgumentNullException>("method", () => PopulateMetadata<Ok>(null, new RouteEndpointBuilder(requestDelegate: null, RoutePatternFactory.Parse("/"), order: 0)));
77
Assert.
Throws
<ArgumentNullException>("builder", () => PopulateMetadata<Ok>(((Delegate)PopulateMetadata_ThrowsArgumentNullException_WhenMethodOrBuilderAreNull).GetMethodInfo(), null));
ResultsOfTTests.Generated.cs (10)
223
Assert.
Throws
<ArgumentNullException>("method", () => PopulateMetadata<Results<ProvidesMetadataResult1, ProvidesMetadataResult2>>(null, new RouteEndpointBuilder(requestDelegate: null, RoutePatternFactory.Parse("/"), order: 0)));
224
Assert.
Throws
<ArgumentNullException>("builder", () => PopulateMetadata<Results<ProvidesMetadataResult1, ProvidesMetadataResult2>>(((Delegate)GeneratedCodeIsUpToDate).GetMethodInfo(), null));
503
Assert.
Throws
<ArgumentNullException>("method", () => PopulateMetadata<Results<ProvidesMetadataResult1, ProvidesMetadataResult2, ProvidesMetadataResult3>>(null, new RouteEndpointBuilder(requestDelegate: null, RoutePatternFactory.Parse("/"), order: 0)));
504
Assert.
Throws
<ArgumentNullException>("builder", () => PopulateMetadata<Results<ProvidesMetadataResult1, ProvidesMetadataResult2, ProvidesMetadataResult3>>(((Delegate)GeneratedCodeIsUpToDate).GetMethodInfo(), null));
860
Assert.
Throws
<ArgumentNullException>("method", () => PopulateMetadata<Results<ProvidesMetadataResult1, ProvidesMetadataResult2, ProvidesMetadataResult3, ProvidesMetadataResult4>>(null, new RouteEndpointBuilder(requestDelegate: null, RoutePatternFactory.Parse("/"), order: 0)));
861
Assert.
Throws
<ArgumentNullException>("builder", () => PopulateMetadata<Results<ProvidesMetadataResult1, ProvidesMetadataResult2, ProvidesMetadataResult3, ProvidesMetadataResult4>>(((Delegate)GeneratedCodeIsUpToDate).GetMethodInfo(), null));
1302
Assert.
Throws
<ArgumentNullException>("method", () => PopulateMetadata<Results<ProvidesMetadataResult1, ProvidesMetadataResult2, ProvidesMetadataResult3, ProvidesMetadataResult4, ProvidesMetadataResult5>>(null, new RouteEndpointBuilder(requestDelegate: null, RoutePatternFactory.Parse("/"), order: 0)));
1303
Assert.
Throws
<ArgumentNullException>("builder", () => PopulateMetadata<Results<ProvidesMetadataResult1, ProvidesMetadataResult2, ProvidesMetadataResult3, ProvidesMetadataResult4, ProvidesMetadataResult5>>(((Delegate)GeneratedCodeIsUpToDate).GetMethodInfo(), null));
1837
Assert.
Throws
<ArgumentNullException>("method", () => PopulateMetadata<Results<ProvidesMetadataResult1, ProvidesMetadataResult2, ProvidesMetadataResult3, ProvidesMetadataResult4, ProvidesMetadataResult5, ProvidesMetadataResult6>>(null, new RouteEndpointBuilder(requestDelegate: null, RoutePatternFactory.Parse("/"), order: 0)));
1838
Assert.
Throws
<ArgumentNullException>("builder", () => PopulateMetadata<Results<ProvidesMetadataResult1, ProvidesMetadataResult2, ProvidesMetadataResult3, ProvidesMetadataResult4, ProvidesMetadataResult5, ProvidesMetadataResult6>>(((Delegate)GeneratedCodeIsUpToDate).GetMethodInfo(), null));
UnprocessableEntityOfTResultTests.cs (2)
115
Assert.
Throws
<ArgumentNullException>("method", () => PopulateMetadata<UnprocessableEntity<object>>(null, new RouteEndpointBuilder(requestDelegate: null, RoutePatternFactory.Parse("/"), order: 0)));
116
Assert.
Throws
<ArgumentNullException>("builder", () => PopulateMetadata<UnprocessableEntity<object>>(((Delegate)PopulateMetadata_ThrowsArgumentNullException_WhenMethodOrBuilderAreNull).GetMethodInfo(), null));
UnprocessableEntityResultTests.cs (2)
77
Assert.
Throws
<ArgumentNullException>("method", () => PopulateMetadata<UnprocessableEntity>(null, new RouteEndpointBuilder(requestDelegate: null, RoutePatternFactory.Parse("/"), order: 0)));
78
Assert.
Throws
<ArgumentNullException>("builder", () => PopulateMetadata<UnprocessableEntity>(((Delegate)PopulateMetadata_ThrowsArgumentNullException_WhenMethodOrBuilderAreNull).GetMethodInfo(), null));
ValidationProblemResultTests.cs (2)
126
Assert.
Throws
<ArgumentNullException>("method", () => PopulateMetadata<ValidationProblem>(null, new RouteEndpointBuilder(requestDelegate: null, RoutePatternFactory.Parse("/"), order: 0)));
127
Assert.
Throws
<ArgumentNullException>("builder", () => PopulateMetadata<ValidationProblem>(((Delegate)PopulateMetadata_ThrowsArgumentNullException_WhenMethodOrBuilderAreNull).GetMethodInfo(), null));
Microsoft.AspNetCore.Identity.Test (1)
UserManagerTest.cs (1)
1371
Assert.
Throws
<ArgumentNullException>("provider", () => manager.RegisterTokenProvider("whatever", null));
Microsoft.AspNetCore.Mvc.Core.Test (2)
AcceptedAtActionResultTests.cs (2)
224
Assert.
Throws
<ArgumentNullException>("provider", () => result.OnFormatting(context));
234
Assert.
Throws
<ArgumentNullException>("context", () => result.OnFormatting(null));
Microsoft.AspNetCore.Mvc.ViewFeatures.Test (3)
Buffers\PagedBufferedTextWriterTest.cs (1)
109
Assert.
Throws
<ArgumentNullException>("buffer", () => writer.Write(null, 0, 0));
Rendering\HtmlHelperTest.cs (2)
324
var exception = Assert.
Throws
<ArgumentException>("viewContext", () => helperToContextualize.Contextualize(viewContext));
345
var exception = Assert.
Throws
<ArgumentException>("viewContext", () => helperToContextualize.Contextualize(viewContext));
Microsoft.AspNetCore.Razor.Test (4)
TagHelpers\TagHelperAttributeListTest.cs (4)
103
var exception = Assert.
Throws
<ArgumentOutOfRangeException>("index", () =>
209
var exception = Assert.
Throws
<ArgumentOutOfRangeException>("index", () =>
321
var exception = Assert.
Throws
<ArgumentOutOfRangeException>("index",
574
var exception = Assert.
Throws
<ArgumentOutOfRangeException>("index",
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (8)
SourceGeneration\AdditionalSourcesCollectionTests.cs (3)
110
var exception = Assert.
Throws
<ArgumentException>(nameof(hintName), () => asc.Add(hintName, SourceText.From("public class D{}", Encoding.UTF8)));
167
var exception = Assert.
Throws
<ArgumentException>("hintName", () => asc.Add(hintName2, SourceText.From("", Encoding.UTF8)));
183
var exception = Assert.
Throws
<ArgumentException>("hintName", () => asc.CopyTo(asc2));
SourceGeneration\GeneratorDriverTests.cs (5)
463
Assert.
Throws
<ArgumentException>("hintName", () => sgc.AddSource("test", SourceText.From("public class D{}", Encoding.UTF8)));
466
Assert.
Throws
<ArgumentException>("hintName", () => sgc.AddSource("test.cs", SourceText.From("public class D{}", Encoding.UTF8)));
494
Assert.
Throws
<ArgumentException>("hintName", () => spc.AddSource("test", SourceText.From("public class D{}", Encoding.UTF8)));
497
Assert.
Throws
<ArgumentException>("hintName", () => spc.AddSource("test.cs", SourceText.From("public class D{}", Encoding.UTF8)));
2556
Assert.
Throws
<ArgumentException>("hintName", () => c.AddEmbeddedAttributeDefinition());
Microsoft.CodeAnalysis.UnitTests (22)
AnalyzerAssemblyLoaderTests.cs (2)
267
Assert.
Throws
<ArgumentNullException>("originalPath", () => loader.AddDependencyLocation(null!));
268
Assert.
Throws
<ArgumentException>("originalPath", () => loader.AddDependencyLocation("a"));
Collections\ImmutableDictionaryBuilderTestBase.cs (2)
55
Assert.
Throws
<ArgumentException>(null, () => builder.Add("five", 6));
116
Assert.
Throws
<ArgumentNullException>("array", () => builder.CopyTo(null!, 0));
Collections\ImmutableDictionaryTestBase.nonnetstandard.cs (1)
299
Assert.
Throws
<ArgumentNullException>("array", () => nonGeneric.CopyTo(null!, 0));
Collections\ImmutableSegmentedHashSetBuilderTest.cs (4)
176
Assert.
Throws
<ArgumentNullException>("other", () => builder.UnionWith(null!));
185
Assert.
Throws
<ArgumentNullException>("other", () => builder.ExceptWith(null!));
194
Assert.
Throws
<ArgumentNullException>("other", () => builder.SymmetricExceptWith(null!));
203
Assert.
Throws
<ArgumentNullException>("other", () => builder.IntersectWith(null!));
Collections\ImmutableSegmentedListBuilderTest.cs (7)
137
Assert.
Throws
<ArgumentOutOfRangeException>("index", () => mutable.Insert(-1, 0));
138
Assert.
Throws
<ArgumentOutOfRangeException>("index", () => mutable.Insert(4, 0));
169
Assert.
Throws
<ArgumentNullException>("items", () => mutable.AddRange(null!));
216
Assert.
Throws
<ArgumentOutOfRangeException>("index", () => mutable.RemoveAt(1));
221
Assert.
Throws
<ArgumentOutOfRangeException>("index", () => mutable.RemoveAt(0));
222
Assert.
Throws
<ArgumentOutOfRangeException>("index", () => mutable.RemoveAt(-1));
223
Assert.
Throws
<ArgumentOutOfRangeException>("index", () => mutable.RemoveAt(1));
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.Misc.cs (1)
118
Assert.
Throws
<ArgumentException>("value", () => _ilist.Insert(0, new LinkedListNode<string>("blargh"))); //"ArgumentException expected."
Collections\List\SegmentedList.Generic.Tests.Remove.cs (1)
126
Assert.
Throws
<ArgumentException>(null, () => list.RemoveRange(invalidSet.Item1, invalidSet.Item2));
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()));
Microsoft.DotNet.XUnitAssert.Tests (53)
AsyncCollectionAssertsTests.cs (16)
21
Assert.
Throws
<ArgumentNullException>("collection", () => Assert.All(default(IAsyncEnumerable<object>)!, _ => { }));
22
Assert.
Throws
<ArgumentNullException>("action", () => Assert.All(new object[0].ToAsyncEnumerable(), (Action<object>)null!));
23
Assert.
Throws
<ArgumentNullException>("action", () => Assert.All(new object[0].ToAsyncEnumerable(), (Action<object, int>)null!));
283
Assert.
Throws
<ArgumentNullException>("collection", () => Assert.Contains(14, default(IAsyncEnumerable<int>)!));
334
Assert.
Throws
<ArgumentNullException>("collection", () => Assert.Contains(14, default(IAsyncEnumerable<int>)!, comparer));
335
Assert.
Throws
<ArgumentNullException>("comparer", () => Assert.Contains(14, new int[0].ToAsyncEnumerable(), null!));
359
Assert.
Throws
<ArgumentNullException>("collection", () => Assert.Contains(default(IAsyncEnumerable<int>)!, item => true));
360
Assert.
Throws
<ArgumentNullException>("filter", () => Assert.Contains(new int[0].ToAsyncEnumerable(), (Predicate<int>)null!));
392
Assert.
Throws
<ArgumentNullException>("collection", () => Assert.Distinct(default(IAsyncEnumerable<int>)!));
393
Assert.
Throws
<ArgumentNullException>("comparer", () => Assert.Distinct(new object[0].ToAsyncEnumerable(), null!));
467
Assert.
Throws
<ArgumentNullException>("collection", () => Assert.DoesNotContain(14, default(IAsyncEnumerable<int>)!));
519
Assert.
Throws
<ArgumentNullException>("collection", () => Assert.DoesNotContain(14, default(IAsyncEnumerable<int>)!, comparer));
520
Assert.
Throws
<ArgumentNullException>("comparer", () => Assert.DoesNotContain(14, new int[0].ToAsyncEnumerable(), null!));
544
Assert.
Throws
<ArgumentNullException>("collection", () => Assert.DoesNotContain(default(IAsyncEnumerable<int>)!, item => true));
545
Assert.
Throws
<ArgumentNullException>("filter", () => Assert.DoesNotContain(new int[0].ToAsyncEnumerable(), (Predicate<int>)null!));
578
Assert.
Throws
<ArgumentNullException>("collection", () => Assert.Empty(default(IAsyncEnumerable<int>)!));
CollectionAssertsTests.cs (17)
19
Assert.
Throws
<ArgumentNullException>("collection", () => Assert.All(default(IEnumerable<object>)!, _ => { }));
20
Assert.
Throws
<ArgumentNullException>("action", () => Assert.All(new object[0], (Action<object>)null!));
21
Assert.
Throws
<ArgumentNullException>("action", () => Assert.All(new object[0], (Action<object, int>)null!));
283
Assert.
Throws
<ArgumentNullException>("collection", () => Assert.Contains(14, default(IEnumerable<int>)!));
352
Assert.
Throws
<ArgumentNullException>("collection", () => Assert.Contains(14, default(IEnumerable<int>)!, comparer));
353
Assert.
Throws
<ArgumentNullException>("comparer", () => Assert.Contains(14, new int[0], null!));
393
Assert.
Throws
<ArgumentNullException>("collection", () => Assert.Contains(default(IEnumerable<int>)!, item => true));
394
Assert.
Throws
<ArgumentNullException>("filter", () => Assert.Contains(new int[0], (Predicate<int>)null!));
426
Assert.
Throws
<ArgumentNullException>("collection", () => Assert.Distinct(default(IEnumerable<int>)!));
427
Assert.
Throws
<ArgumentNullException>("comparer", () => Assert.Distinct(new object[0], null!));
501
Assert.
Throws
<ArgumentNullException>("collection", () => Assert.DoesNotContain(14, default(IEnumerable<int>)!));
589
Assert.
Throws
<ArgumentNullException>("collection", () => Assert.DoesNotContain(14, default(IEnumerable<int>)!, comparer));
590
Assert.
Throws
<ArgumentNullException>("comparer", () => Assert.DoesNotContain(14, new int[0], null!));
622
Assert.
Throws
<ArgumentNullException>("collection", () => Assert.DoesNotContain(default(IEnumerable<int>)!, item => true));
623
Assert.
Throws
<ArgumentNullException>("filter", () => Assert.DoesNotContain(new int[0], (Predicate<int>)null!));
656
Assert.
Throws
<ArgumentNullException>("collection", () => Assert.Empty(default(IEnumerable)!));
2341
Assert.
Throws
<ArgumentNullException>("collection", () => Assert.Single(null!, null));
EqualityAssertsTests.cs (4)
66
Assert.
Throws
<ArgumentNullException>("comparer", () => Assert.Equal(1, 2, default(IEqualityComparer<int>)!));
155
Assert.
Throws
<ArgumentNullException>("comparer", () => Assert.Equal(1, 2, default(Func<int, int, bool>)!));
2350
Assert.
Throws
<ArgumentNullException>("comparer", () => Assert.NotEqual(1, 2, default(IEqualityComparer<int>)!));
2462
Assert.
Throws
<ArgumentNullException>("comparer", () => Assert.NotEqual(1, 2, default(Func<int, int, bool>)!));
ExceptionAssertsTests.cs (5)
335
var ex = Record.Exception(() => Assert.
Throws
<ArgumentException>("paramName", testCode));
351
Assert.
Throws
<ArgumentException>("paramName", testCode);
359
var ex = Record.Exception(() => Assert.
Throws
<ArgumentException>("paramName2", testCode));
377
var ex = Record.Exception(() => Assert.
Throws
<ArgumentException>("paramName", testCode));
395
var ex = Record.Exception(() => Assert.
Throws
<ArgumentException>("paramName", testCode));
PropertyAssertsTests.cs (2)
15
Assert.
Throws
<ArgumentNullException>("object", () => Assert.PropertyChanged(null!, "propertyName", delegate { }));
16
Assert.
Throws
<ArgumentNullException>("testCode", () => Assert.PropertyChanged(Substitute.For<INotifyPropertyChanged>(), "propertyName", (Action)null!));
SetAssertsTests.cs (4)
117
Assert.
Throws
<ArgumentNullException>("expectedSubset", () => Assert.ProperSubset(null!, new HashSet<int>()));
183
Assert.
Throws
<ArgumentNullException>("expectedSuperset", () => Assert.ProperSuperset(null!, new HashSet<int>()));
249
Assert.
Throws
<ArgumentNullException>("expectedSubset", () => Assert.Subset(null!, new HashSet<int>()));
307
Assert.
Throws
<ArgumentNullException>("expectedSuperset", () => Assert.Superset(null!, new HashSet<int>()));
StringAssertsTests.cs (5)
343
Assert.
Throws
<ArgumentNullException>("expectedRegexPattern", () => Assert.DoesNotMatch((string?)null!, "Hello, world!"));
373
Assert.
Throws
<ArgumentNullException>("expectedRegex", () => Assert.DoesNotMatch((Regex?)null!, "Hello, world!"));
403
Assert.
Throws
<ArgumentNullException>("value", () => Assert.Empty(default(string)!));
741
Assert.
Throws
<ArgumentNullException>("expectedRegexPattern", () => Assert.Matches((string?)null!, "Hello, world!"));
784
Assert.
Throws
<ArgumentNullException>("expectedRegex", () => Assert.Matches((Regex?)null!, "Hello, world!"));
Microsoft.Extensions.AI.Abstractions.Tests (13)
ChatCompletion\ChatClientExtensionsTests.cs (4)
75
Assert.
Throws
<ArgumentNullException>("client", () =>
80
Assert.
Throws
<ArgumentNullException>("chatMessage", () =>
89
Assert.
Throws
<ArgumentNullException>("client", () =>
94
Assert.
Throws
<ArgumentNullException>("chatMessage", () =>
SpeechToText\SpeechToTextClientExtensionsTests.cs (1)
17
Assert.
Throws
<ArgumentNullException>("client", () =>
Utilities\AIJsonUtilitiesTests.cs (8)
960
Assert.
Throws
<ArgumentException>("contentType", () => options.AddAIContentType(typeof(int), "discriminator"));
961
Assert.
Throws
<ArgumentException>("contentType", () => options.AddAIContentType(typeof(object), "discriminator"));
962
Assert.
Throws
<ArgumentException>("contentType", () => options.AddAIContentType(typeof(ChatMessage), "discriminator"));
988
Assert.
Throws
<ArgumentNullException>("options", () => ((JsonSerializerOptions)null!).AddAIContentType<DerivedAIContent>("discriminator"));
989
Assert.
Throws
<ArgumentNullException>("options", () => ((JsonSerializerOptions)null!).AddAIContentType(typeof(DerivedAIContent), "discriminator"));
990
Assert.
Throws
<ArgumentNullException>("typeDiscriminatorId", () => options.AddAIContentType<DerivedAIContent>(null!));
991
Assert.
Throws
<ArgumentNullException>("typeDiscriminatorId", () => options.AddAIContentType(typeof(DerivedAIContent), null!));
992
Assert.
Throws
<ArgumentNullException>("contentType", () => options.AddAIContentType(null!, "discriminator"));
System.ServiceModel.Primitives.Tests (11)
ServiceModel\DuplexChannelFactoryTest.cs (3)
72
Assert.
Throws
<ArgumentException>("via", () =>
87
Assert.
Throws
<ArgumentException>("via", () =>
119
Assert.
Throws
<ArgumentNullException>("uri", () =>
ServiceModel\DuplexClientBaseTest.cs (4)
47
Assert.
Throws
<ArgumentNullException>("callbackInstance", () => { MyDuplexClientBase<IWcfDuplexService> duplexClientBase = new MyDuplexClientBase<IWcfDuplexService>(null, binding, endpoint); });
55
Assert.
Throws
<ArgumentNullException>("binding", () => { MyDuplexClientBase<IWcfDuplexService> duplexClientBase = new MyDuplexClientBase<IWcfDuplexService>(context, null, endpoint); });
63
Assert.
Throws
<ArgumentNullException>("remoteAddress", () => { MyDuplexClientBase<IWcfDuplexService> duplexClientBase = new MyDuplexClientBase<IWcfDuplexService>(context, binding, null); });
72
Assert.
Throws
<ArgumentException>("via", () =>
ServiceModel\SynchronizedCollection.cs (4)
76
Assert.
Throws
<ArgumentNullException>("syncRoot", () =>
81
Assert.
Throws
<ArgumentNullException>("list", () =>
86
Assert.
Throws
<ArgumentNullException>("syncRoot", () =>
91
Assert.
Throws
<ArgumentNullException>("syncRoot", () =>
System.Xaml.Tests (22)
System\Xaml\Schema\XamlMemberInvokerTests.cs (1)
137
Assert.
Throws
<ArgumentNullException>("instance", () => XamlMemberInvoker.UnknownInvoker.SetValue(null, "value"));
System\Xaml\Schema\XamlTypeInvokerTests.cs (2)
72
Assert.
Throws
<ArgumentNullException>("instance", () => invoker.AddToCollection(null, 1));
128
Assert.
Throws
<ArgumentNullException>("instance", () => invoker.AddToDictionary(null, 1, 2));
System\Xaml\XamlDuplicateMemberExceptionTests.cs (1)
92
Assert.
Throws
<ArgumentNullException>("info", () => exception.GetObjectData(null, new StreamingContext()));
System\Xaml\XamlExceptionTests.cs (1)
82
Assert.
Throws
<ArgumentNullException>("info", () => exception.GetObjectData(null, new StreamingContext()));
System\Xaml\XamlInternalExceptionTests.cs (1)
62
Assert.
Throws
<ArgumentNullException>("info", () => exception.GetObjectData(null, new StreamingContext()));
System\Xaml\XamlObjectReaderExceptionTests.cs (1)
62
Assert.
Throws
<ArgumentNullException>("info", () => exception.GetObjectData(null, new StreamingContext()));
System\Xaml\XamlObjectWriterExceptionTests.cs (1)
62
Assert.
Throws
<ArgumentNullException>("info", () => exception.GetObjectData(null, new StreamingContext()));
System\Xaml\XamlParseExceptionTests.cs (1)
62
Assert.
Throws
<ArgumentNullException>("info", () => exception.GetObjectData(null, new StreamingContext()));
System\Xaml\XamlSchemaExceptionTests.cs (1)
62
Assert.
Throws
<ArgumentNullException>("info", () => exception.GetObjectData(null, new StreamingContext()));
System\Xaml\XamlServicesTests.cs (10)
52
Assert.
Throws
<ArgumentNullException>("xamlReader", () => XamlServices.Transform((XamlReader)null!, new XamlObjectWriter(new XamlSchemaContext())));
53
Assert.
Throws
<ArgumentNullException>("xamlReader", () => XamlServices.Transform((XamlReader)null!, new XamlObjectWriter(new XamlSchemaContext()), false));
59
Assert.
Throws
<ArgumentNullException>("xamlWriter", () => XamlServices.Transform(new XamlObjectReader(1), null));
60
Assert.
Throws
<ArgumentNullException>("xamlWriter", () => XamlServices.Transform(new XamlObjectReader(1), null, false));
66
Assert.
Throws
<ArgumentNullException>("fileName", () => XamlServices.Save((string)null!, 1));
72
Assert.
Throws
<ArgumentException>("fileName", () => XamlServices.Save("", 1));
78
Assert.
Throws
<ArgumentNullException>("stream", () => XamlServices.Save((Stream)null!, 1));
84
Assert.
Throws
<ArgumentNullException>("writer", () => XamlServices.Save((TextWriter)null!, 1));
90
Assert.
Throws
<ArgumentNullException>("writer", () => XamlServices.Save((XmlWriter)null!, 1));
96
Assert.
Throws
<ArgumentNullException>("writer", () => XamlServices.Save((XamlWriter)null!, 1));
System\Xaml\XamlWriterTests.cs (1)
83
Assert.
Throws
<ArgumentNullException>("reader", () => writer.WriteNode(null));
System\Xaml\XamlXmlWriterExceptionTests.cs (1)
62
Assert.
Throws
<ArgumentNullException>("info", () => exception.GetObjectData(null, new StreamingContext()));
WindowsBase.Tests (79)
System\Collections\Specialized\CollectionChangedEventManagerTests.cs (7)
177
Assert.
Throws
<ArgumentNullException>("handler", () => CollectionChangedEventManager.AddHandler(null, null));
178
Assert.
Throws
<ArgumentNullException>("handler", () => CollectionChangedEventManager.AddHandler(source, null));
341
Assert.
Throws
<ArgumentNullException>("source", () => CollectionChangedEventManager.AddListener(null, listener));
348
Assert.
Throws
<ArgumentNullException>("listener", () => CollectionChangedEventManager.AddListener(source, null));
443
Assert.
Throws
<ArgumentNullException>("handler", () => CollectionChangedEventManager.RemoveHandler(null, null));
444
Assert.
Throws
<ArgumentNullException>("handler", () => CollectionChangedEventManager.RemoveHandler(source, null));
537
Assert.
Throws
<ArgumentNullException>("listener", () => CollectionChangedEventManager.RemoveListener(source, null));
System\ComponentModel\CurrentChangedEventManagerTests.cs (7)
190
Assert.
Throws
<ArgumentNullException>("handler", () => CurrentChangedEventManager.AddHandler(null, null));
191
Assert.
Throws
<ArgumentNullException>("handler", () => CurrentChangedEventManager.AddHandler(source, null));
354
Assert.
Throws
<ArgumentNullException>("source", () => CurrentChangedEventManager.AddListener(null, listener));
361
Assert.
Throws
<ArgumentNullException>("listener", () => CurrentChangedEventManager.AddListener(source, null));
464
Assert.
Throws
<ArgumentNullException>("handler", () => CurrentChangedEventManager.RemoveHandler(null, null));
465
Assert.
Throws
<ArgumentNullException>("handler", () => CurrentChangedEventManager.RemoveHandler(source, null));
557
Assert.
Throws
<ArgumentNullException>("listener", () => CurrentChangedEventManager.RemoveListener(source, null));
System\ComponentModel\CurrentChangingEventManagerTests.cs (7)
181
Assert.
Throws
<ArgumentNullException>("handler", () => CurrentChangingEventManager.AddHandler(null, null));
182
Assert.
Throws
<ArgumentNullException>("handler", () => CurrentChangingEventManager.AddHandler(source, null));
345
Assert.
Throws
<ArgumentNullException>("source", () => CurrentChangingEventManager.AddListener(null, listener));
352
Assert.
Throws
<ArgumentNullException>("listener", () => CurrentChangingEventManager.AddListener(source, null));
447
Assert.
Throws
<ArgumentNullException>("handler", () => CurrentChangingEventManager.RemoveHandler(null, null));
448
Assert.
Throws
<ArgumentNullException>("handler", () => CurrentChangingEventManager.RemoveHandler(source, null));
539
Assert.
Throws
<ArgumentNullException>("listener", () => CurrentChangingEventManager.RemoveListener(source, null));
System\ComponentModel\ErrorsChangedEventManagerTests.cs (4)
163
Assert.
Throws
<ArgumentNullException>("source", () => ErrorsChangedEventManager.AddHandler(null, handler));
170
Assert.
Throws
<ArgumentNullException>("handler", () => ErrorsChangedEventManager.AddHandler(source, null));
248
Assert.
Throws
<ArgumentNullException>("source", () => ErrorsChangedEventManager.RemoveHandler(null, handler));
255
Assert.
Throws
<ArgumentNullException>("handler", () => ErrorsChangedEventManager.RemoveHandler(source, null));
System\ComponentModel\PropertyChangedEventManagerTests.cs (9)
408
Assert.
Throws
<ArgumentNullException>("handler", () => PropertyChangedEventManager.AddHandler(source, null, "propertyName"));
418
Assert.
Throws
<ArgumentNullException>("key", () => PropertyChangedEventManager.AddHandler(source, handler, null));
823
Assert.
Throws
<ArgumentNullException>("source", () => PropertyChangedEventManager.AddListener(null, listener, "propertyName"));
826
Assert.
Throws
<ArgumentNullException>("source", () => PropertyChangedEventManager.AddListener(null, listener, "propertyName"));
833
Assert.
Throws
<ArgumentNullException>("listener", () => PropertyChangedEventManager.AddListener(source, null, "propertyName"));
1016
Assert.
Throws
<ArgumentNullException>("key", () => PropertyChangedEventManager.RemoveHandler(source, handler, null));
1022
Assert.
Throws
<ArgumentNullException>("key", () => PropertyChangedEventManager.RemoveHandler(source, handler, null));
1031
Assert.
Throws
<ArgumentNullException>("handler", () => PropertyChangedEventManager.RemoveHandler(source, null, "propertyName"));
1248
Assert.
Throws
<ArgumentNullException>("listener", () => PropertyChangedEventManager.RemoveListener(source, null, "propertyName"));
System\ComponentModel\SortDescriptionCollectionTests.cs (5)
295
Assert.
Throws
<ArgumentOutOfRangeException>("index", () => collection.Insert(index, description));
384
Assert.
Throws
<ArgumentOutOfRangeException>("index", () => collection.InsertItem(index, description));
614
Assert.
Throws
<ArgumentOutOfRangeException>("index", () => collection.RemoveAt(index));
700
Assert.
Throws
<ArgumentOutOfRangeException>("index", () => collection.RemoveItem(index));
773
Assert.
Throws
<ArgumentOutOfRangeException>("index", () => collection.SetItem(index, description));
System\IO\Packaging\PackageDigitalSignatureManagerTests.cs (1)
319
Assert.
Throws
<ArgumentNullException>("signatureUri", () => manager.RemoveSignature(null));
System\Security\RightsManagement\RightsManagementExceptionTests.cs (1)
272
Assert.
Throws
<ArgumentNullException>("info", () => exception.GetObjectData(null!, default));
System\Security\RightsManagement\SecureEnvironmentTests.cs (3)
183
Assert.
Throws
<ArgumentNullException>("user", () => SecureEnvironment.RemoveActivatedUser(null!));
190
Assert.
Throws
<ArgumentOutOfRangeException>("user", () => SecureEnvironment.RemoveActivatedUser(user));
199
Assert.
Throws
<ArgumentOutOfRangeException>("user", () => SecureEnvironment.RemoveActivatedUser(user));
System\Windows\DependencyObjectTests.cs (6)
410
Assert.
Throws
<ArgumentNullException>("dp", () => obj.ClearValue((DependencyProperty)null!));
773
Assert.
Throws
<ArgumentNullException>("key", () => obj.ClearValue((DependencyPropertyKey)null!));
1711
Assert.
Throws
<ArgumentNullException>("dp", () => obj.InvalidateProperty(null!));
2385
Assert.
Throws
<ArgumentNullException>("dp", () => obj.SetValue((DependencyProperty)null!, true));
2817
Assert.
Throws
<ArgumentNullException>("key", () => obj.SetValue((DependencyPropertyKey)null!, true));
2919
Assert.
Throws
<ArgumentException>("e", () => obj.OnPropertyChanged(e));
System\Windows\DependencyPropertyKeyTests.cs (2)
34
Assert.
Throws
<ArgumentNullException>("forType", () => key.OverrideMetadata(null!, new PropertyMetadata()));
50
Assert.
Throws
<ArgumentNullException>("typeMetadata", () => key.OverrideMetadata(typeof(int), null));
System\Windows\FreezableTests.cs (5)
38
Assert.
Throws
<ArgumentException>("handler", () => freezable.Changed -= handler);
806
Assert.
Throws
<ArgumentNullException>("dp", () => obj.ClearValue((DependencyProperty)null!));
1280
Assert.
Throws
<ArgumentNullException>("key", () => obj.ClearValue((DependencyPropertyKey)null!));
6694
Assert.
Throws
<ArgumentException>("e", () => obj.OnPropertyChanged(e));
6798
Assert.
Throws
<ArgumentNullException>("dp", () => obj.SetValue((DependencyProperty)null!, true));
System\Windows\Markup\ServiceProvidersTests.cs (3)
32
Assert.
Throws
<ArgumentNullException>("serviceType", () => serviceProviders.AddService(null, new object()));
39
Assert.
Throws
<ArgumentNullException>("service", () => serviceProviders.AddService(typeof(object), null));
47
Assert.
Throws
<ArgumentException>("serviceType", () => serviceProviders.AddService(typeof(object), new object()));
System\Windows\NameScopeTests.cs (8)
62
Assert.
Throws
<ArgumentNullException>("dependencyObject", () => NameScope.SetNameScope(null, nameScope));
182
Assert.
Throws
<ArgumentNullException>("key", () => nameScope.Add(null, scopedElement));
329
Assert.
Throws
<ArgumentNullException>("scopedElement", () => nameScope.Add("name", null!));
397
Assert.
Throws
<ArgumentException>("item", () => nameScope.Add(new KeyValuePair<string, object>(null!, scopedElement)));
423
Assert.
Throws
<ArgumentException>("item", () => nameScope.Add(new KeyValuePair<string, object>("name", null!)));
900
Assert.
Throws
<ArgumentNullException>("name", () => nameScope.RegisterName(null, scopedElement));
926
Assert.
Throws
<ArgumentNullException>("scopedElement", () => nameScope.RegisterName("name", null!));
1145
Assert.
Throws
<ArgumentNullException>("name", () => nameScope.UnregisterName(null));
System\Windows\PropertyMetadataTests.cs (1)
499
Assert.
Throws
<ArgumentNullException>("baseMetadata", () => metadata.Merge(null!, null!));
System\Windows\Threading\DispatcherTests.cs (3)
27
Assert.
Throws
<ArgumentNullException>("frame", () => Dispatcher.PushFrame(null!));
81
Assert.
Throws
<InvalidEnumArgumentException>("priority", () => Dispatcher.ValidatePriority(priority, "priority"));
82
Assert.
Throws
<InvalidEnumArgumentException>("", () => Dispatcher.ValidatePriority(priority, ""));
System\Windows\WeakEventManagerTests.cs (5)
1225
Assert.
Throws
<ArgumentNullException>("handler", () => manager.ProtectedAddHandler(source, null!));
1591
Assert.
Throws
<ArgumentNullException>("listener", () => manager.ProtectedAddListener(source, null!));
2129
Assert.
Throws
<ArgumentNullException>("handler", () => manager.ProtectedRemoveHandler(source, null!));
2554
Assert.
Throws
<ArgumentNullException>("listener", () => manager.ProtectedRemoveListener(source, null!));
2921
Assert.
Throws
<ArgumentNullException>("key", () => SubWeakEventManager.SetCurrentManager(null!, new SubWeakEventManager()));
System\Windows\WeakEventManagerTTests.cs (2)
222
Assert.
Throws
<ArgumentNullException>("handler", () => WeakEventManager<object, EventArgs>.AddHandler(new object(), "EventName", null));
343
Assert.
Throws
<ArgumentNullException>("handler", () => WeakEventManager<object, EventArgs>.RemoveHandler(new object(), "EventName", null));