657 references to Throws
Microsoft.AspNetCore.Http.Results.Tests (40)
ResultsTests.cs (17)
344Assert.Throws<ArgumentNullException>("contents", () => Results.Bytes(null)); 350Assert.Throws<ArgumentNullException>("fileContents", () => Results.File(default(byte[]))); 356Assert.Throws<ArgumentNullException>("fileStream", () => Results.File(default(Stream))); 362Assert.Throws<ArgumentNullException>("stream", () => Results.Stream(default(Stream))); 368Assert.Throws<ArgumentNullException>("pipeReader", () => Results.Stream(default(PipeReader))); 374Assert.Throws<ArgumentNullException>("streamWriterCallback", () => TypedResults.Stream(default(Func<Stream, Task>))); 478Assert.Throws<ArgumentNullException>("principal", () => Results.SignIn(null)); 1039Assert.Throws<ArgumentNullException>("context", () => Results.Json<object>(null, context: null)); 1045Assert.Throws<ArgumentNullException>("context", () => Results.Json(null, type: typeof(object), context: null)); 1065Assert.Throws<ArgumentNullException>("jsonTypeInfo", () => Results.Json(null, jsonTypeInfo: null)); 1071Assert.Throws<ArgumentNullException>("jsonTypeInfo", () => Results.Json<object>(null, jsonTypeInfo: null)); 1077Assert.Throws<ArgumentNullException>("localUrl", () => Results.LocalRedirect(default(string))); 1083Assert.Throws<ArgumentException>("localUrl", () => Results.LocalRedirect(string.Empty)); 1244Assert.Throws<ArgumentNullException>("problemDetails", () => Results.Problem(default(ProblemDetails))); 1392Assert.Throws<ArgumentNullException>("errors", () => Results.ValidationProblem(default(IDictionary<string, string[]>))); 1460Assert.Throws<ArgumentNullException>("url", () => Results.Redirect(default(string))); 1466Assert.Throws<ArgumentException>("url", () => Results.Redirect(string.Empty));
TypedResultsTests.cs (21)
99Assert.Throws<ArgumentNullException>("uri", () => TypedResults.Accepted(default(Uri))); 105Assert.Throws<ArgumentNullException>("uri", () => TypedResults.Accepted(default(Uri), default(object))); 318Assert.Throws<ArgumentNullException>("contents", () => TypedResults.Bytes(null)); 324Assert.Throws<ArgumentNullException>("fileContents", () => TypedResults.File(default(byte[]))); 330Assert.Throws<ArgumentNullException>("fileStream", () => TypedResults.File(default(Stream))); 336Assert.Throws<ArgumentNullException>("stream", () => TypedResults.Stream(default(Stream))); 342Assert.Throws<ArgumentNullException>("pipeReader", () => TypedResults.Stream(default(PipeReader))); 348Assert.Throws<ArgumentNullException>("streamWriterCallback", () => TypedResults.Stream(default(Func<Stream, Task>))); 354Assert.Throws<ArgumentNullException>("path", () => TypedResults.PhysicalFile(default(string))); 360Assert.Throws<ArgumentException>("path", () => TypedResults.PhysicalFile(string.Empty)); 366Assert.Throws<ArgumentNullException>("path", () => TypedResults.VirtualFile(default(string))); 372Assert.Throws<ArgumentException>("path", () => TypedResults.VirtualFile(string.Empty)); 488Assert.Throws<ArgumentNullException>("principal", () => TypedResults.SignIn(null)); 899Assert.Throws<ArgumentNullException>("context", () => TypedResults.Json(data, context: null)); 915Assert.Throws<ArgumentNullException>("jsonTypeInfo", () => TypedResults.Json(data, jsonTypeInfo: null)); 921Assert.Throws<ArgumentNullException>("localUrl", () => TypedResults.LocalRedirect(default(string))); 927Assert.Throws<ArgumentException>("localUrl", () => TypedResults.LocalRedirect(string.Empty)); 1060Assert.Throws<ArgumentNullException>("problemDetails", () => TypedResults.Problem(default(ProblemDetails))); 1184Assert.Throws<ArgumentNullException>("errors", () => TypedResults.ValidationProblem(default(IDictionary<string, string[]>))); 1242Assert.Throws<ArgumentNullException>("url", () => TypedResults.Redirect(default(string))); 1248Assert.Throws<ArgumentException>("url", () => TypedResults.Redirect(string.Empty));
ValidationProblemResultTests.cs (2)
83Assert.Throws<ArgumentNullException>("problemDetails", () => new ValidationProblem(null)); 89Assert.Throws<ArgumentException>("problemDetails", () => new ValidationProblem(
Microsoft.AspNetCore.Http.Tests (1)
HttpServiceCollectionExtensionsTests.cs (1)
28Assert.Throws<ArgumentNullException>("services", () => HttpServiceCollectionExtensions.AddHttpContextAccessor(null));
Microsoft.AspNetCore.Identity.EntityFrameworkCore.Test (1)
UserStoreTest.cs (1)
99Assert.Throws<ArgumentNullException>("context", () => new UserStore(null));
Microsoft.AspNetCore.Identity.Test (6)
RoleManagerTest.cs (1)
123Assert.Throws<ArgumentNullException>("store",
SignInManagerTest.cs (3)
24Assert.Throws<ArgumentNullException>("userManager", () => new SignInManager<PocoUser>(null, null, null, null, null, null, null)); 26Assert.Throws<ArgumentNullException>("contextAccessor", () => new SignInManager<PocoUser>(userManager, null, null, null, null, null, null)); 30Assert.Throws<ArgumentNullException>("claimsFactory", () => new SignInManager<PocoUser>(userManager, contextAccessor.Object, null, null, null, null, null));
UserClaimsPrincipalFactoryTest.cs (1)
18Assert.Throws<ArgumentException>("optionsAccessor",
UserManagerTest.cs (1)
1093Assert.Throws<ArgumentNullException>("store",
Microsoft.AspNetCore.Mvc.Core.Test (4)
Formatters\FormatterMappingsTest.cs (1)
20Assert.Throws<ArgumentException>("format", () => options.GetMediaTypeMappingForFormat(format));
Formatters\MediaTypeTest.cs (3)
108Assert.Throws<ArgumentNullException>("mediaType", () => new MediaType(null, 0, 2)); 117Assert.Throws<ArgumentOutOfRangeException>("offset", () => new MediaType("media", offset, 5)); 124Assert.Throws<ArgumentOutOfRangeException>("length", () => new MediaType("media", 0, -1));
Microsoft.AspNetCore.Razor.Test (2)
TagHelpers\ReadOnlyTagHelperAttributeListTest.cs (1)
115var exception = Assert.Throws<ArgumentOutOfRangeException>("index", () => attributes[index]);
TagHelpers\TagHelperAttributeListTest.cs (1)
86var exception = Assert.Throws<ArgumentOutOfRangeException>("index", () => attributes[index]);
Microsoft.AspNetCore.Server.HttpSys.FunctionalTests (6)
RequestBodyTests.cs (6)
129Assert.Throws<ArgumentNullException>("buffer", () => httpContext.Request.Body.Read(null, 0, 1)); 130Assert.Throws<ArgumentOutOfRangeException>("offset", () => httpContext.Request.Body.Read(input, -1, 1)); 131Assert.Throws<ArgumentOutOfRangeException>("count", () => httpContext.Request.Body.Read(input, input.Length + 1, 1)); 132Assert.Throws<ArgumentOutOfRangeException>("count", () => httpContext.Request.Body.Read(input, 10, -1)); 133Assert.Throws<ArgumentOutOfRangeException>("count", () => httpContext.Request.Body.Read(input, 1, input.Length)); 134Assert.Throws<ArgumentOutOfRangeException>("count", () => httpContext.Request.Body.Read(input, 0, input.Length + 1));
Microsoft.AspNetCore.WebUtilities.Tests (1)
QueryHelpersTests.cs (1)
107Assert.Throws<ArgumentNullException>("value", () => QueryHelpers.AddQueryString("http://contoso.com/", "hello", null!));
Microsoft.Build.Engine.UnitTests (9)
Evaluation\SimpleVersion_Tests.cs (9)
67Assert.Throws<ArgumentOutOfRangeException>("major", () => new SimpleVersion(-1, 0)); 68Assert.Throws<ArgumentOutOfRangeException>("major", () => new SimpleVersion(-1, 0, 0)); 69Assert.Throws<ArgumentOutOfRangeException>("major", () => new SimpleVersion(-1, 0, 0, 0)); 75Assert.Throws<ArgumentOutOfRangeException>("minor", () => new SimpleVersion(0, -1)); 76Assert.Throws<ArgumentOutOfRangeException>("minor", () => new SimpleVersion(0, -1, 0)); 77Assert.Throws<ArgumentOutOfRangeException>("minor", () => new SimpleVersion(0, -1, 0, 0)); 83Assert.Throws<ArgumentOutOfRangeException>("build", () => new SimpleVersion(0, 0, -1)); 84Assert.Throws<ArgumentOutOfRangeException>("build", () => new SimpleVersion(0, 0, -1, 0)); 90Assert.Throws<ArgumentOutOfRangeException>("revision", () => new SimpleVersion(0, 0, 0, -1));
Microsoft.CodeAnalysis.CSharp.IOperation.UnitTests (2)
IOperation\IOperationTests_ICompoundAssignmentOperation.cs (2)
24Assert.Throws<ArgumentNullException>("compoundAssignment", () => nullAssignment.GetInConversion()); 25Assert.Throws<ArgumentNullException>("compoundAssignment", () => nullAssignment.GetOutConversion());
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (12)
Compilation\CompilationAPITests.cs (7)
445Assert.Throws<ArgumentNullException>("peStream", () => comp.Emit(peStream: null)); 446Assert.Throws<ArgumentException>("peStream", () => comp.Emit(peStream: new TestStream(canRead: true, canWrite: false, canSeek: true))); 447Assert.Throws<ArgumentException>("pdbStream", () => comp.Emit(peStream: new MemoryStream(), pdbStream: new TestStream(canRead: true, canWrite: false, canSeek: true))); 456Assert.Throws<ArgumentException>("embeddedTexts", () => comp.Emit( 468Assert.Throws<ArgumentException>("win32Resources", () => comp.Emit( 472Assert.Throws<ArgumentException>("win32Resources", () => comp.Emit( 2960Assert.Throws<ArgumentException>(null, () => compilation.CreateBuiltinOperator(
Symbols\FunctionPointerTypeSymbolTests.cs (5)
1534Assert.Throws<ArgumentNullException>("returnType", () => comp.CreateFunctionPointerTypeSymbol(returnType: null!, returnRefKind: RefKind.None, parameterTypes: ImmutableArray<ITypeSymbol>.Empty, parameterRefKinds: ImmutableArray<RefKind>.Empty)); 1535Assert.Throws<ArgumentNullException>("parameterTypes", () => comp.CreateFunctionPointerTypeSymbol(returnType: @string, returnRefKind: RefKind.None, parameterTypes: default, parameterRefKinds: ImmutableArray<RefKind>.Empty)); 1536Assert.Throws<ArgumentNullException>("parameterTypes[0]", () => comp.CreateFunctionPointerTypeSymbol(returnType: @string, returnRefKind: RefKind.None, parameterTypes: ImmutableArray.Create((ITypeSymbol?)null)!, parameterRefKinds: ImmutableArray.Create(RefKind.None))); 1537Assert.Throws<ArgumentNullException>("parameterRefKinds", () => comp.CreateFunctionPointerTypeSymbol(returnType: @string, returnRefKind: RefKind.None, parameterTypes: ImmutableArray<ITypeSymbol>.Empty, parameterRefKinds: default)); 1538Assert.Throws<ArgumentNullException>("callingConventionTypes[0]", () => comp.CreateFunctionPointerTypeSymbol(returnType: @string, returnRefKind: RefKind.None, parameterTypes: ImmutableArray<ITypeSymbol>.Empty, parameterRefKinds: ImmutableArray<RefKind>.Empty, callingConvention: SignatureCallingConvention.Unmanaged, ImmutableArray.Create((INamedTypeSymbol)null!)));
Microsoft.CodeAnalysis.Scripting.UnitTests (39)
ScriptOptionsTests.cs (39)
41Assert.Throws<ArgumentNullException>("references", () => options.AddReferences((MetadataReference[])null)); 42Assert.Throws<ArgumentNullException>("references[0]", () => options.AddReferences(new MetadataReference[] { null })); 44Assert.Throws<ArgumentNullException>("references", () => options.AddReferences((IEnumerable<MetadataReference>)null)); 45Assert.Throws<ArgumentNullException>("references[0]", () => options.AddReferences((IEnumerable<MetadataReference>)new MetadataReference[] { null })); 47Assert.Throws<ArgumentNullException>("references", () => options.AddReferences((Assembly[])null)); 48Assert.Throws<ArgumentNullException>("references[0]", () => options.AddReferences(new Assembly[] { null })); 50Assert.Throws<ArgumentNullException>("references", () => options.AddReferences((IEnumerable<Assembly>)null)); 51Assert.Throws<ArgumentNullException>("references[0]", () => options.AddReferences((IEnumerable<Assembly>)new Assembly[] { null })); 53Assert.Throws<ArgumentNullException>("references", () => options.AddReferences((string[])null)); 54Assert.Throws<ArgumentNullException>("references[0]", () => options.AddReferences(new string[] { null })); 56Assert.Throws<ArgumentNullException>("references", () => options.AddReferences((IEnumerable<string>)null)); 57Assert.Throws<ArgumentNullException>("references[0]", () => options.AddReferences((IEnumerable<string>)new string[] { null })); 83Assert.Throws<ArgumentNullException>("references", () => options.WithReferences((MetadataReference[])null)); 84Assert.Throws<ArgumentNullException>("references", () => options.WithReferences((IEnumerable<MetadataReference>)null)); 85Assert.Throws<ArgumentNullException>("references", () => options.WithReferences(default(ImmutableArray<MetadataReference>))); 86Assert.Throws<ArgumentNullException>("references[0]", () => options.WithReferences(new MetadataReference[] { null })); 87Assert.Throws<ArgumentNullException>("references[0]", () => options.WithReferences(ImmutableArray.Create((MetadataReference)null))); 89Assert.Throws<ArgumentNullException>("references", () => options.WithReferences((Assembly[])null)); 90Assert.Throws<ArgumentNullException>("references", () => options.WithReferences((IEnumerable<Assembly>)null)); 91Assert.Throws<ArgumentNullException>("references", () => options.WithReferences(default(ImmutableArray<Assembly>))); 92Assert.Throws<ArgumentNullException>("references[0]", () => options.WithReferences(new Assembly[] { null })); 93Assert.Throws<ArgumentNullException>("references[0]", () => options.WithReferences(ImmutableArray.Create((Assembly)null))); 95Assert.Throws<ArgumentNullException>("references", () => options.WithReferences((string[])null)); 96Assert.Throws<ArgumentNullException>("references", () => options.WithReferences((IEnumerable<string>)null)); 97Assert.Throws<ArgumentNullException>("references", () => options.WithReferences(default(ImmutableArray<string>))); 98Assert.Throws<ArgumentNullException>("references[0]", () => options.WithReferences(new string[] { null })); 99Assert.Throws<ArgumentNullException>("references[0]", () => options.WithReferences(ImmutableArray.Create((string)null))); 122Assert.Throws<ArgumentNullException>("imports", () => options.AddImports((string[])null)); 123Assert.Throws<ArgumentNullException>("imports[0]", () => options.AddImports([null])); 125Assert.Throws<ArgumentNullException>("imports", () => options.AddImports((IEnumerable<string>)null)); 126Assert.Throws<ArgumentNullException>("imports[0]", () => options.AddImports((IEnumerable<string>)new string[] { null })); 128Assert.Throws<ArgumentNullException>("imports", () => options.AddImports(default(ImmutableArray<string>))); 129Assert.Throws<ArgumentNullException>("imports[0]", () => options.AddImports(ImmutableArray.Create((string)null))); 143Assert.Throws<ArgumentNullException>("imports", () => options.WithImports((string[])null)); 144Assert.Throws<ArgumentNullException>("imports[0]", () => options.WithImports([null])); 146Assert.Throws<ArgumentNullException>("imports", () => options.WithImports((IEnumerable<string>)null)); 147Assert.Throws<ArgumentNullException>("imports[0]", () => options.WithImports((IEnumerable<string>)new string[] { null })); 149Assert.Throws<ArgumentNullException>("imports", () => options.WithImports(default(ImmutableArray<string>))); 150Assert.Throws<ArgumentNullException>("imports[0]", () => options.WithImports(ImmutableArray.Create((string)null)));
Microsoft.CodeAnalysis.Test.Utilities (4)
Compilation\TestOperationVisitor.cs (4)
1179Assert.Throws<ArgumentException>("compoundAssignment", () => VisualBasic.VisualBasicExtensions.GetInConversion(operation)); 1180Assert.Throws<ArgumentException>("compoundAssignment", () => VisualBasic.VisualBasicExtensions.GetOutConversion(operation)); 1186Assert.Throws<ArgumentException>("compoundAssignment", () => CSharp.CSharpExtensions.GetInConversion(operation)); 1187Assert.Throws<ArgumentException>("compoundAssignment", () => CSharp.CSharpExtensions.GetOutConversion(operation));
Microsoft.CodeAnalysis.UnitTests (21)
Analyzers\AnalyzerFileReferenceTests.cs (1)
48Assert.Throws<ArgumentNullException>("assemblyLoader", () => new AnalyzerFileReference(TempRoot.Root, null!));
Collections\ImmutableDictionaryTestBase.cs (2)
288Assert.Throws<ArgumentException>(null, () => map1.Add(key, value2)); 289Assert.Throws<ArgumentException>(null, () => map2.Add(key, value1));
Collections\List\ICollection.Generic.Tests.cs (1)
468Assert.Throws<ArgumentNullException>("item", () => collection.Contains(default(T)!));
EmbeddedTextTests.cs (16)
25Assert.Throws<ArgumentNullException>("filePath", () => EmbeddedText.FromBytes(null, default(ArraySegment<byte>))); 26Assert.Throws<ArgumentException>("filePath", () => EmbeddedText.FromBytes("", default(ArraySegment<byte>))); 27Assert.Throws<ArgumentNullException>("bytes", () => EmbeddedText.FromBytes("path", default(ArraySegment<byte>))); 28Assert.Throws<ArgumentException>("checksumAlgorithm", () => EmbeddedText.FromBytes("path", new ArraySegment<byte>(new byte[0], 0, 0), SourceHashAlgorithm.None)); 34Assert.Throws<ArgumentNullException>("filePath", () => EmbeddedText.FromSource(null, null)); 35Assert.Throws<ArgumentException>("filePath", () => EmbeddedText.FromSource("", null)); 36Assert.Throws<ArgumentNullException>("text", () => EmbeddedText.FromSource("path", null)); 39Assert.Throws<ArgumentException>("text", () => EmbeddedText.FromSource("path", SourceText.From("source"))); 42Assert.Throws<ArgumentException>("text", () => EmbeddedText.FromSource("path", SourceText.From(new byte[0], 0, Encoding.UTF8, canBeEmbedded: false))); 43Assert.Throws<ArgumentException>("text", () => EmbeddedText.FromSource("path", SourceText.From(new MemoryStream(new byte[0]), Encoding.UTF8, canBeEmbedded: false))); 49Assert.Throws<ArgumentNullException>("filePath", () => EmbeddedText.FromStream(null, null)); 50Assert.Throws<ArgumentException>("filePath", () => EmbeddedText.FromStream("", null)); 51Assert.Throws<ArgumentNullException>("stream", () => EmbeddedText.FromStream("path", null)); 52Assert.Throws<ArgumentException>("stream", () => EmbeddedText.FromStream("path", new CannotReadStream())); 53Assert.Throws<ArgumentException>("stream", () => EmbeddedText.FromStream("path", new CannotSeekStream())); 54Assert.Throws<ArgumentException>("checksumAlgorithm", () => EmbeddedText.FromStream("path", new MemoryStream(), SourceHashAlgorithm.None));
Emit\SemanticEditTests.cs (1)
29Assert.Throws<ArgumentOutOfRangeException>("kind", () => new SemanticEdit(SemanticEditKind.None, oldSymbol: null, newSymbol: null));
Microsoft.CodeAnalysis.Workspaces.UnitTests (54)
Simplifier\SimplifierTests.cs (1)
53Assert.Throws<ArgumentNullException>("workspace", () => Simplifier.Expand(token: default, semanticModel: null!, workspace: null!));
SolutionTests\ProjectDependencyGraphTests.cs (2)
117Assert.Throws<ArgumentNullException>("projectId", 339Assert.Throws<ArgumentNullException>("projectId",
SolutionTests\ProjectInfoTests.cs (5)
39Assert.Throws<ArgumentException>("documents[1]", 45Assert.Throws<ArgumentException>("additionalDocuments[1]", 52Assert.Throws<ArgumentException>("projectReferences[1]", 55Assert.Throws<ArgumentNullException>("analyzerReferences[0]", () => ProjectInfo.Create(pid, VersionStamp.Default, name: "Goo", assemblyName: "Bar", language: "C#", 66Assert.Throws<ArgumentException>("metadataReferences[1]",
SolutionTests\SolutionTests.cs (46)
1447Assert.Throws<ArgumentNullException>("assemblyName", () => solution.WithProjectAssemblyName(projectId, null!)); 1448Assert.Throws<ArgumentNullException>("projectId", () => solution.WithProjectAssemblyName(null!, "x.dll")); 1471Assert.Throws<ArgumentNullException>("projectId", () => solution.WithProjectOutputFilePath(null!, "x.dll")); 1472Assert.Throws<ArgumentNullException>("projectId", () => solution.WithProjectOutputFilePath(null!, "x.dll")); 1526Assert.Throws<ArgumentNullException>("projectId", () => solution.WithProjectOutputRefFilePath(null!, "x.dll")); 1549Assert.Throws<ArgumentNullException>("projectId", () => solution.WithProjectCompilationOutputInfo(null!, info)); 1572Assert.Throws<ArgumentNullException>("projectId", () => solution.WithProjectDefaultNamespace(null!, "x")); 1686Assert.Throws<ArgumentNullException>("projectId", () => solution.WithProjectName(null!, "x")); 1709Assert.Throws<ArgumentNullException>("projectId", () => solution.WithProjectFilePath(null!, "x")); 1724Assert.Throws<ArgumentNullException>("projectId", () => solution.WithProjectCompilationOptions(null!, options)); 1725Assert.Throws<ArgumentNullException>("options", () => solution.WithProjectCompilationOptions(projectId, options: null!)); 1773Assert.Throws<ArgumentNullException>("projectId", () => solution.WithProjectParseOptions(null!, options)); 1774Assert.Throws<ArgumentNullException>("options", () => solution.WithProjectParseOptions(projectId, options: null!)); 1932Assert.Throws<ArgumentNullException>("projectId", () => solution.WithProjectReferences(null!, [projectRef])); 1984Assert.Throws<ArgumentNullException>("projectId", () => solution.AddProjectReferences(null!, [projectRef2])); 1985Assert.Throws<ArgumentNullException>("projectReferences", () => solution.AddProjectReferences(projectId, null!)); 1986Assert.Throws<ArgumentNullException>("projectReferences[0]", () => solution.AddProjectReferences(projectId, [null!])); 1987Assert.Throws<ArgumentException>("projectReferences[1]", () => solution.AddProjectReferences(projectId, [projectRef2, projectRef2])); 1988Assert.Throws<ArgumentException>("projectReferences[1]", () => solution.AddProjectReferences(projectId, [new ProjectReference(projectId2), new ProjectReference(projectId2)])); 2023Assert.Throws<ArgumentNullException>("projectId", () => solution.RemoveProjectReference(null!, projectRef2)); 2024Assert.Throws<ArgumentNullException>("projectReference", () => solution.RemoveProjectReference(projectId, null!)); 2027Assert.Throws<ArgumentException>("projectReference", () => solution.RemoveProjectReference(projectId, new ProjectReference(ProjectId.CreateNewId()))); 2083Assert.Throws<ArgumentNullException>("projectId", () => solution.WithProjectMetadataReferences(null!, [metadataRef])); 2103Assert.Throws<ArgumentNullException>("projectId", () => solution.AddMetadataReferences(null!, [metadataRef1])); 2104Assert.Throws<ArgumentNullException>("metadataReferences", () => solution.AddMetadataReferences(projectId, null!)); 2105Assert.Throws<ArgumentNullException>("metadataReferences[0]", () => solution.AddMetadataReferences(projectId, [null!])); 2106Assert.Throws<ArgumentException>("metadataReferences[1]", () => solution.AddMetadataReferences(projectId, [metadataRef1, metadataRef1])); 2129Assert.Throws<ArgumentNullException>("projectId", () => solution.RemoveMetadataReference(null!, metadataRef1)); 2130Assert.Throws<ArgumentNullException>("metadataReference", () => solution.RemoveMetadataReference(projectId, null!)); 2153Assert.Throws<ArgumentNullException>("projectId", () => solution.WithProjectAnalyzerReferences(null!, [analyzerRef])); 2177Assert.Throws<ArgumentNullException>("analyzerReferences", () => solution.AddAnalyzerReferences(projectId, null!)); 2178Assert.Throws<ArgumentNullException>("analyzerReferences[0]", () => solution.AddAnalyzerReferences(projectId, [null!])); 2203Assert.Throws<ArgumentNullException>("analyzerReference", () => solution.RemoveAnalyzerReference(projectId, null!)); 2244Assert.Throws<ArgumentNullException>("analyzerReferences", () => solution.AddAnalyzerReferences(null!)); 2245Assert.Throws<ArgumentNullException>("analyzerReferences[0]", () => solution.AddAnalyzerReferences([null!])); 2268Assert.Throws<ArgumentNullException>("analyzerReference", () => solution.RemoveAnalyzerReference(null!)); 2375Assert.Throws<ArgumentNullException>("loader", () => solution.AddDocument(documentId, "name", loader: null!)); 2404Assert.Throws<ArgumentNullException>("documentId", () => solution.AddDocument(documentId: null!, "name", "text")); 2405Assert.Throws<ArgumentNullException>("name", () => solution.AddDocument(documentId, name: null!, "text")); 2406Assert.Throws<ArgumentNullException>("text", () => solution.AddDocument(documentId, "name", text: (string)null!)); 2432Assert.Throws<ArgumentNullException>("documentId", () => solution.AddDocument(documentId: null!, "name", sourceText)); 2433Assert.Throws<ArgumentNullException>("name", () => solution.AddDocument(documentId, name: null!, sourceText)); 2434Assert.Throws<ArgumentNullException>("text", () => solution.AddDocument(documentId, "name", text: (SourceText)null!)); 2484Assert.Throws<ArgumentNullException>("documentId", () => solution.AddDocument(documentId: null!, "name", root)); 2485Assert.Throws<ArgumentNullException>("name", () => solution.AddDocument(documentId, name: null!, root)); 2486Assert.Throws<ArgumentNullException>("syntaxRoot", () => solution.AddDocument(documentId, "name", syntaxRoot: null!));
Microsoft.DotNet.XUnitAssert.Tests (22)
AsyncCollectionAssertsTests.cs (3)
1384 Assert.Throws<ArgumentNullException>("collection", () => Assert.Single(default(IAsyncEnumerable<object>)!)); 1469 Assert.Throws<ArgumentNullException>("collection", () => Assert.Single(default(IAsyncEnumerable<object>)!, _ => true)); 1470 Assert.Throws<ArgumentNullException>("predicate", () => Assert.Single(new object[0].ToAsyncEnumerable(), null!));
CollectionAssertsTests.cs (4)
2281 Assert.Throws<ArgumentNullException>("collection", () => Assert.Single(null!)); 2416 Assert.Throws<ArgumentNullException>("collection", () => Assert.Single(default(IEnumerable<object>)!)); 2501 Assert.Throws<ArgumentNullException>("collection", () => Assert.Single(default(IEnumerable<object>)!, _ => true)); 2502 Assert.Throws<ArgumentNullException>("predicate", () => Assert.Single(new object[0], null!));
ExceptionAssertsTests.cs (15)
18 Assert.Throws<ArgumentNullException>("exceptionType", () => Assert.Throws(null!, testCode)); 19 Assert.Throws<ArgumentNullException>("testCode", () => Assert.Throws(typeof(Exception), default(Action)!)); 90 Assert.Throws<ArgumentNullException>("exceptionType", () => Assert.Throws(null!, testCode)); 91 Assert.Throws<ArgumentNullException>("testCode", () => Assert.Throws(typeof(Exception), default(Func<object>)!)); 175 Assert.Throws<ArgumentNullException>("testCode", () => Assert.Throws<ArgumentException>(default(Action)!)); 244 Assert.Throws<ArgumentNullException>("testCode", () => Assert.Throws<ArgumentException>(default(Func<object>)!)); 327 Assert.Throws<ArgumentNullException>("testCode", () => Assert.Throws<ArgumentException>(default(Action)!)); 413 Assert.Throws<ArgumentNullException>("testCode", () => Assert.Throws<ArgumentException>(default(Func<object>)!)); 421 var ex = Record.Exception(() => Assert.Throws<ArgumentException>("paramName", testCode)); 437 Assert.Throws<ArgumentException>("paramName", testCode); 445 var ex = Record.Exception(() => Assert.Throws<ArgumentException>("paramName2", testCode)); 463 var ex = Record.Exception(() => Assert.Throws<ArgumentException>("paramName", testCode)); 481 var ex = Record.Exception(() => Assert.Throws<ArgumentException>("paramName", testCode)); 502 Assert.Throws<ArgumentNullException>("testCode", () => Assert.ThrowsAny<ArgumentException>(default(Action)!)); 561 Assert.Throws<ArgumentNullException>("testCode", () => Assert.ThrowsAny<ArgumentException>(default(Func<object>)!));
Microsoft.Extensions.AI.Abstractions.Tests (56)
ChatCompletion\ChatClientExtensionsTests.cs (4)
17Assert.Throws<ArgumentNullException>("client", () => ChatClientExtensions.GetService<object>(null!)); 23Assert.Throws<ArgumentNullException>("client", () => ChatClientExtensions.GetRequiredService(null!, typeof(string))); 24Assert.Throws<ArgumentNullException>("client", () => ChatClientExtensions.GetRequiredService<object>(null!)); 27Assert.Throws<ArgumentNullException>("serviceType", () => client.GetRequiredService(null!));
ChatCompletion\ChatFinishReasonTests.cs (2)
21Assert.Throws<ArgumentNullException>("value", () => new ChatFinishReason(null!)); 22Assert.Throws<ArgumentException>("value", () => new ChatFinishReason(" "));
ChatCompletion\ChatResponseFormatTests.cs (3)
24Assert.Throws<ArgumentException>("schemaName", () => new ChatResponseFormatJson(null, "name")); 25Assert.Throws<ArgumentException>("schemaDescription", () => new ChatResponseFormatJson(null, null, "description")); 26Assert.Throws<ArgumentException>("schemaName", () => new ChatResponseFormatJson(null, "name", "description"));
ChatCompletion\ChatResponseTests.cs (1)
27Assert.Throws<ArgumentNullException>("message", () => new ChatResponse((ChatMessage)null!));
ChatCompletion\ChatResponseUpdateExtensionsTests.cs (1)
21Assert.Throws<ArgumentNullException>("updates", () => ((List<ChatResponseUpdate>)null!).ToChatResponse());
ChatCompletion\ChatRoleTests.cs (2)
21Assert.Throws<ArgumentNullException>("value", () => new ChatRole(null!)); 22Assert.Throws<ArgumentException>("value", () => new ChatRole(" "));
ChatCompletion\DelegatingChatClientTests.cs (2)
17Assert.Throws<ArgumentNullException>("innerClient", () => new NoOpDelegatingChatClient(null!)); 95Assert.Throws<ArgumentNullException>("serviceType", () => delegating.GetService(null!));
Contents\DataContentTests.cs (1)
58Assert.Throws<ArgumentException>("mediaType", () => new DataContent("data:image/png;base64,aGVsbG8=", type));
Contents\FunctionCallContentTests..cs (4)
320Assert.Throws<ArgumentNullException>("encodedArguments", () => FunctionCallContent.CreateFromParsedArguments((string)null!, "callId", "functionName", _ => null)); 321Assert.Throws<ArgumentNullException>("callId", () => FunctionCallContent.CreateFromParsedArguments("{}", null!, "functionName", _ => null)); 322Assert.Throws<ArgumentNullException>("name", () => FunctionCallContent.CreateFromParsedArguments("{}", "callId", null!, _ => null)); 323Assert.Throws<ArgumentNullException>("argumentParser", () => FunctionCallContent.CreateFromParsedArguments("{}", "callId", "functionName", null!));
Contents\UriContentTests.cs (12)
15Assert.Throws<ArgumentNullException>("uri", () => new UriContent((string)null!, "image/png")); 16Assert.Throws<ArgumentNullException>("uri", () => new UriContent((Uri)null!, "image/png")); 19Assert.Throws<ArgumentNullException>("mediaType", () => new UriContent("data:image/png;base64,aGVsbG8=", null!)); 20Assert.Throws<ArgumentException>("mediaType", () => new UriContent("data:image/png;base64,aGVsbG8=", "")); 21Assert.Throws<ArgumentException>("mediaType", () => new UriContent("data:image/png;base64,aGVsbG8=", "image")); 23Assert.Throws<ArgumentNullException>("mediaType", () => new UriContent(new Uri("data:image/png;base64,aGVsbG8="), null!)); 24Assert.Throws<ArgumentException>("mediaType", () => new UriContent(new Uri("data:image/png;base64,aGVsbG8="), "")); 25Assert.Throws<ArgumentException>("mediaType", () => new UriContent(new Uri("data:image/png;base64,aGVsbG8="), "audio")); 28Assert.Throws<ArgumentNullException>("value", () => c.Uri = null!); 40Assert.Throws<ArgumentException>("mediaType", () => new UriContent("http://localhost/something", type)); 43Assert.Throws<ArgumentException>("value", () => c.MediaType = type); 44Assert.Throws<ArgumentNullException>("value", () => c.MediaType = null!);
Contents\UsageContentTests.cs (2)
14Assert.Throws<ArgumentNullException>("details", () => new UsageContent(null!)); 56Assert.Throws<ArgumentNullException>("value", () => c.Details = null!);
Embeddings\DelegatingEmbeddingGeneratorTests.cs (2)
17Assert.Throws<ArgumentNullException>("innerGenerator", () => new NoOpDelegatingEmbeddingGenerator(null!)); 56Assert.Throws<ArgumentNullException>("serviceType", () => delegating.GetService(null!));
Embeddings\EmbeddingGenerationOptionsTests.cs (2)
30Assert.Throws<ArgumentOutOfRangeException>("value", () => options.Dimensions = 0); 31Assert.Throws<ArgumentOutOfRangeException>("value", () => options.Dimensions = -1);
Embeddings\EmbeddingGeneratorExtensionsTests.cs (3)
16Assert.Throws<ArgumentNullException>("generator", () => EmbeddingGeneratorExtensions.GetService<object>(null!)); 22Assert.Throws<ArgumentNullException>("generator", () => EmbeddingGeneratorExtensions.GetRequiredService<object>(null!)); 25Assert.Throws<ArgumentNullException>("serviceType", () => generator.GetRequiredService(null!));
Embeddings\GeneratedEmbeddingsTests.cs (8)
20Assert.Throws<ArgumentNullException>("embeddings", () => new GeneratedEmbeddings<Embedding<float>>(null!)); 21Assert.Throws<ArgumentOutOfRangeException>("capacity", () => new GeneratedEmbeddings<Embedding<float>>(-1)); 50Assert.Throws<ArgumentOutOfRangeException>("index", () => instance[0]); 51Assert.Throws<ArgumentOutOfRangeException>("index", () => instance[-1]); 81Assert.Throws<ArgumentOutOfRangeException>("index", () => generatedEmbeddings[-1]); 82Assert.Throws<ArgumentOutOfRangeException>("index", () => generatedEmbeddings[2]); 244Assert.Throws<ArgumentOutOfRangeException>("index", () => embeddings[-1]); 245Assert.Throws<ArgumentOutOfRangeException>("index", () => embeddings[2]);
SpeechToText\DelegatingSpeechToTextClientTests.cs (2)
18Assert.Throws<ArgumentNullException>("innerClient", () => new NoOpDelegatingSpeechToTextClient(null!)); 96Assert.Throws<ArgumentNullException>("serviceType", () => delegating.GetService(null!));
SpeechToText\SpeechToTextResponseTests.cs (2)
17Assert.Throws<ArgumentNullException>("contents", () => new SpeechToTextResponse((IList<AIContent>)null!)); 64Assert.Throws<ArgumentNullException>("contents", () => new SpeechToTextResponse((IList<AIContent>)null!));
SpeechToText\SpeechToTextResponseUpdateExtensionsTests.cs (1)
38Assert.Throws<ArgumentNullException>("updates", () => ((List<SpeechToTextResponseUpdate>)null!).ToSpeechToTextResponse());
SpeechToText\SpeechToTextResponseUpdateKindTests.cs (2)
21Assert.Throws<ArgumentNullException>("value", () => new SpeechToTextResponseUpdateKind(null!)); 22Assert.Throws<ArgumentException>("value", () => new SpeechToTextResponseUpdateKind(" "));
Microsoft.Extensions.AI.AzureAIInference.Tests (6)
AzureAIInferenceChatClientTests.cs (2)
30Assert.Throws<ArgumentNullException>("chatCompletionsClient", () => ((ChatCompletionsClient)null!).AsIChatClient("model")); 33Assert.Throws<ArgumentException>("defaultModelId", () => client.AsIChatClient(" "));
AzureAIInferenceEmbeddingGeneratorTests.cs (2)
23Assert.Throws<ArgumentNullException>("embeddingsClient", () => ((EmbeddingsClient)null!).AsIEmbeddingGenerator()); 26Assert.Throws<ArgumentException>("defaultModelId", () => client.AsIEmbeddingGenerator(" "));
AzureAIInferenceImageEmbeddingGeneratorTests.cs (2)
23Assert.Throws<ArgumentNullException>("imageEmbeddingsClient", () => ((ImageEmbeddingsClient)null!).AsIEmbeddingGenerator()); 26Assert.Throws<ArgumentException>("defaultModelId", () => client.AsIEmbeddingGenerator(" "));
Microsoft.Extensions.AI.Ollama.Tests (5)
OllamaChatClientTests.cs (3)
26Assert.Throws<ArgumentNullException>("endpoint", () => new OllamaChatClient((Uri)null!)); 27Assert.Throws<ArgumentException>("modelId", () => new OllamaChatClient("http://localhost", " ")); 36Assert.Throws<ArgumentNullException>("value", () => client.ToolCallJsonSerializerOptions = null!);
OllamaEmbeddingGeneratorTests.cs (2)
20Assert.Throws<ArgumentNullException>("endpoint", () => new OllamaEmbeddingGenerator((string)null!)); 21Assert.Throws<ArgumentException>("modelId", () => new OllamaEmbeddingGenerator(new Uri("http://localhost"), " "));
Microsoft.Extensions.AI.OpenAI.Tests (6)
OpenAIAssistantChatClientTests.cs (2)
23Assert.Throws<ArgumentNullException>("assistantClient", () => ((AssistantClient)null!).AsIChatClient("assistantId")); 24Assert.Throws<ArgumentNullException>("assistantId", () => new AssistantClient("ignored").AsIChatClient(null!));
OpenAIChatClientTests.cs (1)
30Assert.Throws<ArgumentNullException>("chatClient", () => ((ChatClient)null!).AsIChatClient());
OpenAIEmbeddingGeneratorTests.cs (1)
25Assert.Throws<ArgumentNullException>("embeddingClient", () => ((EmbeddingClient)null!).AsIEmbeddingGenerator());
OpenAIResponseClientTests.cs (1)
29Assert.Throws<ArgumentNullException>("responseClient", () => ((OpenAIResponseClient)null!).AsIChatClient());
OpenAISpeechToTextClientTests.cs (1)
26Assert.Throws<ArgumentNullException>("audioClient", () => ((AudioClient)null!).AsISpeechToTextClient());
Microsoft.Extensions.AI.Tests (35)
ChatCompletion\ChatClientBuilderTest.cs (3)
61Assert.Throws<ArgumentNullException>("innerClient", () => new ChatClientBuilder((IChatClient)null!)); 62Assert.Throws<ArgumentNullException>("innerClient", () => ((IChatClient)null!).AsBuilder()); 68Assert.Throws<ArgumentNullException>("innerClientFactory", () => new ChatClientBuilder((Func<IServiceProvider, IChatClient>)null!));
ChatCompletion\ConfigureOptionsChatClientTests.cs (3)
18Assert.Throws<ArgumentNullException>("innerClient", () => new ConfigureOptionsChatClient(null!, _ => { })); 19Assert.Throws<ArgumentNullException>("configure", () => new ConfigureOptionsChatClient(new TestChatClient(), null!)); 27Assert.Throws<ArgumentNullException>("configure", () => builder.ConfigureOptions(null!));
ChatCompletion\FunctionInvocationContextTests.cs (3)
37Assert.Throws<ArgumentNullException>("value", () => ctx.CallContent = null!); 38Assert.Throws<ArgumentNullException>("value", () => ctx.Messages = null!); 39Assert.Throws<ArgumentNullException>("value", () => ctx.Function = null!);
ChatCompletion\FunctionInvokingChatClientTests.cs (2)
26Assert.Throws<ArgumentNullException>("innerClient", () => new FunctionInvokingChatClient(null!)); 27Assert.Throws<ArgumentNullException>("builder", () => ((ChatClientBuilder)null!).UseFunctionInvocation());
ChatCompletion\LoggingChatClientTests.cs (2)
20Assert.Throws<ArgumentNullException>("innerClient", () => new LoggingChatClient(null!, NullLogger.Instance)); 21Assert.Throws<ArgumentNullException>("logger", () => new LoggingChatClient(new TestChatClient(), null!));
ChatCompletion\UseDelegateChatClientTests.cs (1)
22Assert.Throws<ArgumentNullException>("getResponseFunc", () => builder.Use(null!, null!));
Embeddings\ConfigureOptionsEmbeddingGeneratorTests.cs (3)
16Assert.Throws<ArgumentNullException>("innerGenerator", () => new ConfigureOptionsEmbeddingGenerator<string, Embedding<float>>(null!, _ => { })); 17Assert.Throws<ArgumentNullException>("configure", () => new ConfigureOptionsEmbeddingGenerator<string, Embedding<float>>(new TestEmbeddingGenerator(), null!)); 25Assert.Throws<ArgumentNullException>("configure", () => builder.ConfigureOptions(null!));
Embeddings\EmbeddingGeneratorBuilderTests.cs (3)
60Assert.Throws<ArgumentNullException>("innerGenerator", () => new EmbeddingGeneratorBuilder<string, Embedding<float>>((IEmbeddingGenerator<string, Embedding<float>>)null!)); 61Assert.Throws<ArgumentNullException>("innerGenerator", () => ((IEmbeddingGenerator<string, Embedding<float>>)null!).AsBuilder()); 67Assert.Throws<ArgumentNullException>("innerGeneratorFactory",
Embeddings\LoggingEmbeddingGeneratorTests.cs (2)
19Assert.Throws<ArgumentNullException>("innerGenerator", () => new LoggingEmbeddingGenerator<string, Embedding<float>>(null!, NullLogger.Instance)); 20Assert.Throws<ArgumentNullException>("logger", () => new LoggingEmbeddingGenerator<string, Embedding<float>>(new TestEmbeddingGenerator(), null!));
Embeddings\UseDelegateEmbeddingGeneratorTests.cs (1)
20Assert.Throws<ArgumentNullException>("generateFunc", () =>
Functions\AIFunctionFactoryTest.cs (7)
28Assert.Throws<ArgumentNullException>("method", () => AIFunctionFactory.Create(method: null!)); 29Assert.Throws<ArgumentNullException>("method", () => AIFunctionFactory.Create(method: null!, target: new object())); 30Assert.Throws<ArgumentNullException>("method", () => AIFunctionFactory.Create(method: null!, target: new object(), name: "myAiFunk")); 31Assert.Throws<ArgumentNullException>("target", () => AIFunctionFactory.Create(typeof(AIFunctionFactoryTest).GetMethod(nameof(InvalidArguments_Throw))!, (object?)null)); 32Assert.Throws<ArgumentNullException>("createInstanceFunc", () => 34Assert.Throws<ArgumentException>("method", () => AIFunctionFactory.Create(typeof(List<>).GetMethod("Add")!, new List<int>())); 363Assert.Throws<ArgumentException>("method", () => AIFunctionFactory.Create(
SpeechToText\ConfigureOptionsSpeechToTextClientTests.cs (3)
19Assert.Throws<ArgumentNullException>("innerClient", () => new ConfigureOptionsSpeechToTextClient(null!, _ => { })); 20Assert.Throws<ArgumentNullException>("configure", () => new ConfigureOptionsSpeechToTextClient(new TestSpeechToTextClient(), null!)); 28Assert.Throws<ArgumentNullException>("configure", () => builder.ConfigureOptions(null!));
SpeechToText\LoggingSpeechToTextClientTests.cs (2)
22Assert.Throws<ArgumentNullException>("innerClient", () => new LoggingSpeechToTextClient(null!, NullLogger.Instance)); 23Assert.Throws<ArgumentNullException>("logger", () => new LoggingSpeechToTextClient(new TestSpeechToTextClient(), null!));
Microsoft.Extensions.TimeProvider.Testing.Tests (8)
TimerTests.cs (8)
141Assert.Throws<ArgumentOutOfRangeException>("dueTime", () => t.Change(TimeSpan.FromMilliseconds(-2), TimeSpan.FromMilliseconds(1))); 142Assert.Throws<ArgumentOutOfRangeException>("dueTime", () => t.Change(TimeSpan.FromMilliseconds(-2), TimeSpan.FromSeconds(1))); 143Assert.Throws<ArgumentOutOfRangeException>("dueTime", () => t.Change(TimeSpan.FromMilliseconds(0xFFFFFFFFL), TimeSpan.FromMilliseconds(1))); 144Assert.Throws<ArgumentOutOfRangeException>("dueTime", () => t.Change(TimeSpan.FromMilliseconds(0xFFFFFFFFL), TimeSpan.FromSeconds(1))); 153Assert.Throws<ArgumentOutOfRangeException>("period", () => t.Change(TimeSpan.FromMilliseconds(1), TimeSpan.FromMilliseconds(-2))); 154Assert.Throws<ArgumentOutOfRangeException>("period", () => t.Change(TimeSpan.FromSeconds(1), TimeSpan.FromMilliseconds(-2))); 155Assert.Throws<ArgumentOutOfRangeException>("period", () => t.Change(TimeSpan.FromMilliseconds(1), TimeSpan.FromMilliseconds(0xFFFFFFFFL))); 156Assert.Throws<ArgumentOutOfRangeException>("period", () => t.Change(TimeSpan.FromSeconds(1), TimeSpan.FromMilliseconds(0xFFFFFFFFL)));
System.Xaml.Tests (151)
System\Windows\Markup\ArrayExtensionTests.cs (2)
36Assert.Throws<ArgumentNullException>("arrayType", () => new ArrayExtension((Type)null!)); 64Assert.Throws<ArgumentNullException>("elements", () => new ArrayExtension((Array)null!));
System\Windows\Markup\NameReferenceConverterTests.cs (2)
70Assert.Throws<ArgumentNullException>("context", () => converter.ConvertFrom(null, CultureInfo.CurrentCulture, "name")); 162Assert.Throws<ArgumentNullException>("context", () => converter.ConvertTo(null, CultureInfo.CurrentCulture, "value", typeof(string)));
System\Windows\Markup\ReferenceTests.cs (1)
66Assert.Throws<ArgumentNullException>("serviceProvider", () => reference.ProvideValue(null));
System\Windows\Markup\StaticExtensionTests.cs (4)
35Assert.Throws<ArgumentNullException>("member", () => new StaticExtension(null)); 119Assert.Throws<ArgumentNullException>("serviceProvider", () => extension.ProvideValue(null)); 181Assert.Throws<ArgumentNullException>("value", () => extension.Member = null); 196Assert.Throws<ArgumentNullException>("value", () => extension.MemberType = null);
System\Windows\Markup\TypeExtensionTests.cs (5)
35Assert.Throws<ArgumentNullException>("typeName", () => new TypeExtension((string)null!)); 50Assert.Throws<ArgumentNullException>("type", () => new TypeExtension((Type)null!)); 90Assert.Throws<ArgumentNullException>("serviceProvider", () => extension.ProvideValue(null)); 141Assert.Throws<ArgumentNullException>("value", () => extension.TypeName = null); 157Assert.Throws<ArgumentNullException>("value", () => extension.Type = null);
System\Windows\Markup\ValueSerializerTests.cs (6)
206Assert.Throws<ArgumentNullException>("typeName", () => ValueSerializer.GetSerializerFor(typeof(ClassWithNullStringTypeConverterAttribute))); 207Assert.Throws<ArgumentNullException>("typeName", () => ValueSerializer.GetSerializerFor(typeof(ClassWithNullStringTypeConverterAttribute), null!)); 228Assert.Throws<ArgumentNullException>("type", () => ValueSerializer.GetSerializerFor((Type)null!)); 229Assert.Throws<ArgumentNullException>("type", () => ValueSerializer.GetSerializerFor((Type)null!, null)); 293Assert.Throws<ArgumentNullException>("descriptor", () => ValueSerializer.GetSerializerFor((PropertyDescriptor)null!)); 294Assert.Throws<ArgumentNullException>("descriptor", () => ValueSerializer.GetSerializerFor((PropertyDescriptor)null!, null));
System\Windows\Markup\XamlDeferLoadAttributeTests.cs (4)
26Assert.Throws<ArgumentNullException>("loaderType", () => new XamlDeferLoadAttribute(null!, typeof(int))); 32Assert.Throws<ArgumentNullException>("contentType", () => new XamlDeferLoadAttribute(typeof(int), null!)); 50Assert.Throws<ArgumentNullException>("loaderType", () => new XamlDeferLoadAttribute(null!, "contentType")); 56Assert.Throws<ArgumentNullException>("contentType", () => new XamlDeferLoadAttribute("loaderType", null!));
System\Windows\Markup\XDataTests.cs (2)
43Assert.Throws<ArgumentNullException>("s", () => data.XmlReader); 68Assert.Throws<ArgumentNullException>("s", () => data.XmlReader);
System\Windows\Markup\XmlnsCompatibleWithAttributeTests.cs (2)
23Assert.Throws<ArgumentNullException>("oldNamespace", () => new XmlnsCompatibleWithAttribute(null!, "newNamespace")); 29Assert.Throws<ArgumentNullException>("newNamespace", () => new XmlnsCompatibleWithAttribute("oldNamespace", null!));
System\Windows\Markup\XmlnsDefinitionAttributeTests.cs (2)
24Assert.Throws<ArgumentNullException>("xmlNamespace", () => new XmlnsDefinitionAttribute(null!, "clrNamespace")); 30Assert.Throws<ArgumentNullException>("clrNamespace", () => new XmlnsDefinitionAttribute("xmlNamespace", null!));
System\Windows\Markup\XmlnsPrefixAttributeTests.cs (2)
23Assert.Throws<ArgumentNullException>("xmlNamespace", () => new XmlnsPrefixAttribute(null!, "prefix")); 29Assert.Throws<ArgumentNullException>("prefix", () => new XmlnsPrefixAttribute("xmlNamespace", null!));
System\Xaml\Replacements\DateTimeConverter2Tests.cs (1)
112Assert.Throws<ArgumentNullException>("destinationType", () => converter.ConvertTo(DateTime.MinValue, null!));
System\Xaml\Replacements\DateTimeOffsetConverter2Tests.cs (1)
120Assert.Throws<ArgumentNullException>("destinationType", () => converter.ConvertTo(DateTimeOffset.MinValue, null!));
System\Xaml\Replacements\EventConverterTests.cs (1)
184Assert.Throws<ArgumentNullException>("destinationType", () => converter.ConvertTo(typeof(int), null!));
System\Xaml\Replacements\TypeListConverterTests.cs (1)
81Assert.Throws<ArgumentNullException>("destinationType", () => converter.ConvertTo(Array.Empty<Type>(), null!));
System\Xaml\Replacements\TypeTypeConverterTests.cs (1)
279Assert.Throws<ArgumentNullException>("destinationType", () => converter.ConvertTo(typeof(int), null!));
System\Xaml\Replacements\TypeUriConverterTests.cs (2)
60Assert.Throws<ArgumentNullException>("sourceType", () => converter.CanConvertFrom(null!)); 178Assert.Throws<ArgumentNullException>("destinationType", () => converter.ConvertTo(new Uri("http://google.com"), null!));
System\Xaml\Schema\XamlMemberInvokerTests.cs (2)
45Assert.Throws<ArgumentNullException>("member", () => new XamlMemberInvoker(null)); 91Assert.Throws<ArgumentNullException>("instance", () => XamlMemberInvoker.UnknownInvoker.GetValue(null));
System\Xaml\Schema\XamlTypeInvokerTests.cs (3)
36Assert.Throws<ArgumentNullException>("type", () => new XamlTypeInvoker(null)); 388Assert.Throws<ArgumentNullException>("contentType", () => invoker.GetAddMethod(null)); 521Assert.Throws<ArgumentNullException>("instance", () => invoker.GetItems(null));
System\Xaml\Schema\XamlTypeNameTests.cs (11)
78Assert.Throws<ArgumentNullException>("xamlType", () => new XamlTypeName(null)); 225Assert.Throws<ArgumentNullException>("typeNameList", () => XamlTypeName.ToString(null, new CustomNamespacePrefixLookup())); 231Assert.Throws<ArgumentNullException>("prefixLookup", () => XamlTypeName.ToString(Array.Empty<XamlTypeName>(), null)); 317Assert.Throws<ArgumentNullException>("typeName", () => XamlTypeName.Parse(null, new CustomXamlNamespaceResolver())); 320Assert.Throws<ArgumentNullException>("typeName", () => XamlTypeName.TryParse(null, new CustomXamlNamespaceResolver(), out result)); 327Assert.Throws<ArgumentNullException>("namespaceResolver", () => XamlTypeName.Parse("typeName", null)); 330Assert.Throws<ArgumentNullException>("namespaceResolver", () => XamlTypeName.TryParse("typeName", null, out result)); 440Assert.Throws<ArgumentNullException>("typeNameList", () => XamlTypeName.ParseList(null, new CustomXamlNamespaceResolver())); 443Assert.Throws<ArgumentNullException>("typeNameList", () => XamlTypeName.TryParseList(null, new CustomXamlNamespaceResolver(), out result)); 450Assert.Throws<ArgumentNullException>("namespaceResolver", () => XamlTypeName.ParseList("typeNameList", null)); 453Assert.Throws<ArgumentNullException>("namespaceResolver", () => XamlTypeName.TryParseList("typeNameList", null, out result));
System\Xaml\Schema\XamlTypeTypeConverterTests.cs (1)
277Assert.Throws<ArgumentNullException>("destinationType", () => converter.ConvertTo(type, null!));
System\Xaml\XamlBackgroundReaderTests.cs (2)
49Assert.Throws<ArgumentNullException>("wrappedReader", () => new XamlBackgroundReader(null)); 61Assert.Throws<ArgumentNullException>("schemaContext", () => new XamlBackgroundReader(new SubXamlReaderWithLineInfo()));
System\Xaml\XamlDirectiveTests.cs (4)
42Assert.Throws<ArgumentNullException>("xamlType", () => new XamlDirective(new string[] { "namespace"}, "name", null, null, AllowedMemberLocations.Any)); 49Assert.Throws<ArgumentNullException>("xamlNamespaces", () => new XamlDirective(null, "name", type, null, AllowedMemberLocations.Any)); 56Assert.Throws<ArgumentException>("xamlNamespaces", () => new XamlDirective(new string?[] { null }, "name", type, null, AllowedMemberLocations.Any)); 76Assert.Throws<ArgumentNullException>("xamlNamespace", () => new XamlDirective(null, "name"));
System\Xaml\XamlDuplicateMemberExceptionTests.cs (1)
85Assert.Throws<ArgumentNullException>("info", () => new SubXamlDuplicateMemberException(null!, new StreamingContext()));
System\Xaml\XamlExceptionTests.cs (1)
75Assert.Throws<ArgumentNullException>("info", () => new SubXamlException(null!, new StreamingContext()));
System\Xaml\XamlInternalExceptionTests.cs (1)
55Assert.Throws<ArgumentNullException>("info", () => new SubXamlInternalException(null!, new StreamingContext()));
System\Xaml\XamlMemberTests.cs (34)
37Assert.Throws<ArgumentNullException>("name", () => new XamlMember(null, type, false)); 43Assert.Throws<ArgumentNullException>("declaringType", () => new XamlMember("name", null, false)); 98Assert.Throws<ArgumentNullException>("propertyInfo", () => new XamlMember((PropertyInfo)null!, new XamlSchemaContext())); 99Assert.Throws<ArgumentNullException>("propertyInfo", () => new XamlMember((PropertyInfo)null!, new XamlSchemaContext(), XamlMemberInvoker.UnknownInvoker)); 154Assert.Throws<ArgumentNullException>("eventInfo", () => new XamlMember((EventInfo)null!, new XamlSchemaContext())); 155Assert.Throws<ArgumentNullException>("eventInfo", () => new XamlMember((EventInfo)null!, new XamlSchemaContext(), XamlMemberInvoker.UnknownInvoker)); 215Assert.Throws<ArgumentNullException>("attachablePropertyName", () => new XamlMember(null, getter, null, new XamlSchemaContext())); 216Assert.Throws<ArgumentNullException>("attachablePropertyName", () => new XamlMember(null, getter, null, new XamlSchemaContext(), XamlMemberInvoker.UnknownInvoker)); 233Assert.Throws<ArgumentException>("getter", () => new XamlMember("name", getter, null, new XamlSchemaContext())); 234Assert.Throws<ArgumentException>("getter", () => new XamlMember("name", getter, null, new XamlSchemaContext(), XamlMemberInvoker.UnknownInvoker)); 243Assert.Throws<ArgumentException>("setter", () => new XamlMember("name", null, setter, new XamlSchemaContext())); 244Assert.Throws<ArgumentException>("setter", () => new XamlMember("name", null, setter, new XamlSchemaContext(), XamlMemberInvoker.UnknownInvoker)); 300Assert.Throws<ArgumentNullException>("attachableEventName", () => new XamlMember(null, adder, new XamlSchemaContext())); 301Assert.Throws<ArgumentNullException>("attachableEventName", () => new XamlMember(null, adder, new XamlSchemaContext(), XamlMemberInvoker.UnknownInvoker)); 307Assert.Throws<ArgumentNullException>("adder", () => new XamlMember("name", null, new XamlSchemaContext())); 308Assert.Throws<ArgumentNullException>("adder", () => new XamlMember("name", null, new XamlSchemaContext(), XamlMemberInvoker.UnknownInvoker)); 317Assert.Throws<ArgumentException>("adder", () => new XamlMember("name", adder, new XamlSchemaContext())); 318Assert.Throws<ArgumentException>("adder", () => new XamlMember("name", adder, new XamlSchemaContext(), XamlMemberInvoker.UnknownInvoker)); 326Assert.Throws<ArgumentNullException>("schemaContext", () => new XamlMember(propertyInfo, null)); 327Assert.Throws<ArgumentNullException>("schemaContext", () => new XamlMember(eventInfo, null)); 328Assert.Throws<ArgumentNullException>("schemaContext", () => new XamlMember(propertyInfo, null, XamlMemberInvoker.UnknownInvoker)); 329Assert.Throws<ArgumentNullException>("schemaContext", () => new XamlMember(eventInfo, null, XamlMemberInvoker.UnknownInvoker)); 330Assert.Throws<ArgumentNullException>("schemaContext", () => new XamlMember(propertyInfo.Name, propertyInfo.GetGetMethod(), propertyInfo.GetSetMethod(), null)); 331Assert.Throws<ArgumentNullException>("schemaContext", () => new XamlMember(propertyInfo.Name, propertyInfo.GetGetMethod(), propertyInfo.GetSetMethod(), null, XamlMemberInvoker.UnknownInvoker)); 332Assert.Throws<ArgumentNullException>("schemaContext", () => new XamlMember(eventInfo.Name, eventInfo.GetAddMethod(), null)); 333Assert.Throws<ArgumentNullException>("schemaContext", () => new XamlMember(eventInfo.Name, eventInfo.GetAddMethod(), null, XamlMemberInvoker.UnknownInvoker)); 535Assert.Throws<ArgumentNullException>("typeName", () => member.LookupDeferringLoaderEntry()); 536Assert.Throws<ArgumentNullException>("typeName", () => member.DeferringLoader); 687Assert.Throws<ArgumentNullException>("key", () => member.LookupDependsOnEntry()); 688Assert.Throws<ArgumentNullException>("key", () => member.DependsOn); 1823Assert.Throws<ArgumentNullException>("typeName", () => member.LookupTypeConverterEntry()); 1824Assert.Throws<ArgumentNullException>("typeName", () => member.TypeConverter); 2172Assert.Throws<ArgumentNullException>("typeName", () => member.LookupValueSerializerEntry()); 2173Assert.Throws<ArgumentNullException>("typeName", () => member.ValueSerializer);
System\Xaml\XamlNodeListTests.cs (3)
33Assert.Throws<ArgumentNullException>("schemaContext", () => new XamlNodeList(null)); 34Assert.Throws<ArgumentNullException>("schemaContext", () => new XamlNodeList(null, 64)); 41Assert.Throws<ArgumentOutOfRangeException>("capacity", () => new XamlNodeList(context, -1));
System\Xaml\XamlNodeQueueTests.cs (1)
25Assert.Throws<ArgumentNullException>("schemaContext", () => new XamlNodeQueue(null));
System\Xaml\XamlObjectEventArgsTests.cs (1)
24Assert.Throws<ArgumentNullException>("instance", () => new XamlObjectEventArgs(null));
System\Xaml\XamlObjectReaderExceptionTests.cs (1)
55Assert.Throws<ArgumentNullException>("info", () => new SubXamlObjectReaderException(null!, new StreamingContext()));
System\Xaml\XamlObjectWriterExceptionTests.cs (1)
55Assert.Throws<ArgumentNullException>("info", () => new SubXamlObjectWriterException(null!, new StreamingContext()));
System\Xaml\XamlObjectWriterSettingsTests.cs (1)
73Assert.Throws<ArgumentNullException>("settings", () => new XamlObjectWriterSettings(null));
System\Xaml\XamlParseExceptionTests.cs (1)
55Assert.Throws<ArgumentNullException>("info", () => new SubXamlParseException(null!, new StreamingContext()));
System\Xaml\XamlSchemaContextTests.cs (7)
274Assert.Throws<ArgumentNullException>("xmlns", () => context.GetPreferredPrefix(null)); 950Assert.Throws<ArgumentNullException>("xamlNamespace", () => context.GetXamlDirective(null, "name")); 957Assert.Throws<ArgumentNullException>("name", () => context.GetXamlDirective("xamlNamespace", null)); 964Assert.Throws<ArgumentNullException>("xamlTypeName", () => context.GetXamlType((XamlTypeName)null!)); 971Assert.Throws<ArgumentException>("xamlTypeName", () => context.GetXamlType(new XamlTypeName(null, "name"))); 978Assert.Throws<ArgumentException>("xamlTypeName", () => context.GetXamlType(new XamlTypeName("xamlNamespace", null))); 1008Assert.Throws<ArgumentNullException>("type", () => context.GetXamlType((Type)null!));
System\Xaml\XamlSchemaExceptionTests.cs (1)
55Assert.Throws<ArgumentNullException>("info", () => new SubXamlSchemaException(null!, new StreamingContext()));
System\Xaml\XamlServicesTests.cs (6)
16Assert.Throws<ArgumentNullException>("xaml", () => XamlServices.Parse(null)); 22Assert.Throws<ArgumentNullException>("fileName", () => XamlServices.Load((string)null!)); 28Assert.Throws<ArgumentNullException>("stream", () => XamlServices.Load((Stream)null!)); 34Assert.Throws<ArgumentNullException>("textReader", () => XamlServices.Load((TextReader)null!)); 40Assert.Throws<ArgumentNullException>("xmlReader", () => XamlServices.Load((XmlReader)null!)); 46Assert.Throws<ArgumentNullException>("xamlReader", () => XamlServices.Load((XamlReader)null!));
System\Xaml\XamlTypeTests.cs (28)
46Assert.Throws<ArgumentNullException>("unknownTypeNamespace", () => new XamlType(null, "unknownTypeName", Array.Empty<XamlType>(), new XamlSchemaContext())); 52Assert.Throws<ArgumentNullException>("unknownTypeName", () => new XamlType("unknownTypeNamespace", null, Array.Empty<XamlType>(), new XamlSchemaContext())); 76Assert.Throws<ArgumentNullException>("typeName", () => new SubXamlType(null!, Array.Empty<XamlType>(), new XamlSchemaContext())); 130Assert.Throws<ArgumentNullException>("underlyingType", () => new XamlType(null, new XamlSchemaContext())); 131Assert.Throws<ArgumentNullException>("underlyingType", () => new XamlType(null, new XamlSchemaContext(), XamlTypeInvoker.UnknownInvoker)); 145Assert.Throws<ArgumentNullException>("schemaContext", () => new XamlType("unknownTypeNamespace", "unknownTypeName", Array.Empty<XamlType>(), null)); 146Assert.Throws<ArgumentNullException>("schemaContext", () => new XamlType(typeof(int), null)); 147Assert.Throws<ArgumentNullException>("schemaContext", () => new XamlType(typeof(int), null, XamlTypeInvoker.UnknownInvoker)); 148Assert.Throws<ArgumentNullException>("schemaContext", () => new SubXamlType("typeName", Array.Empty<XamlType>(), null)); 622Assert.Throws<ArgumentNullException>("key", () => type.LookupAliasedPropertyEntry(null!)); 623Assert.Throws<ArgumentNullException>("key", () => type.GetAliasedProperty(null)); 1437Assert.Throws<ArgumentNullException>("type", () => type.LookupAllowedContentTypesEntry()); 1438Assert.Throws<ArgumentNullException>("type", () => type.AllowedContentTypes); 1688Assert.Throws<ArgumentNullException>("key", () => type.GetAttachableMember(null)); 1696Assert.Throws<ArgumentNullException>("key", () => type.GetAttachableMember(null)); 2225Assert.Throws<ArgumentNullException>("type", () => type.LookupContentWrappersEntry()); 2226Assert.Throws<ArgumentNullException>("type", () => type.ContentWrappers); 2494Assert.Throws<ArgumentNullException>("typeName", () => type.LookupDeferringLoaderEntry()); 2495Assert.Throws<ArgumentNullException>("typeName", () => type.DeferringLoader); 3659Assert.Throws<ArgumentNullException>("name", () => type.LookupMemberEntry(null!, false)); 3660Assert.Throws<ArgumentNullException>("key", () => type.GetMember(null)); 3668Assert.Throws<ArgumentNullException>("key", () => type.GetMember(null)); 3892Assert.Throws<ArgumentException>("target", () => type.LookupSetMarkupExtensionHandlerEntry()); 4091Assert.Throws<ArgumentException>("target", () => type.LookupSetTypeConverterHandlerEntry()); 4388Assert.Throws<ArgumentNullException>("typeName", () => type.LookupTypeConverterEntry()); 4389Assert.Throws<ArgumentNullException>("typeName", () => type.TypeConverter); 4794Assert.Throws<ArgumentNullException>("typeName", () => type.LookupValueSerializerEntry()); 4795Assert.Throws<ArgumentNullException>("typeName", () => type.ValueSerializer);
System\Xaml\XamlXmlWriterExceptionTests.cs (1)
55Assert.Throws<ArgumentNullException>("info", () => new SubXamlXmlWriterException(null!, new StreamingContext()));
WindowsBase.Tests (166)
System\ComponentModel\DependencyPropertyDescriptorTests.cs (3)
30Assert.Throws<ArgumentNullException>("property", () => DependencyPropertyDescriptor.FromProperty(null)); 60Assert.Throws<ArgumentNullException>("dependencyProperty", () => DependencyPropertyDescriptor.FromProperty(null, typeof(object))); 67Assert.Throws<ArgumentNullException>("targetType", () => DependencyPropertyDescriptor.FromProperty(property, null));
System\ComponentModel\SortDescriptionCollectionTests.cs (2)
116Assert.Throws<ArgumentOutOfRangeException>("index", () => collection[index]); 127Assert.Throws<ArgumentOutOfRangeException>("index", () => collection[index] = description);
System\ComponentModel\SortDescriptionTests.cs (2)
35Assert.Throws<InvalidEnumArgumentException>("direction", () => new SortDescription("Name", direction)); 60Assert.Throws<InvalidEnumArgumentException>("value", () => description.Direction = value);
System\IO\Packaging\EncryptedPackageEnvelopeTests.cs (4)
13Assert.Throws<ArgumentNullException>("envelopeStream", () => EncryptedPackageEnvelope.Open((Stream)null!)); 33Assert.Throws<ArgumentNullException>("envelopeFileName", () => EncryptedPackageEnvelope.Open((string)null!)); 34Assert.Throws<ArgumentNullException>("envelopeFileName", () => EncryptedPackageEnvelope.Open(null!, FileAccess.Read)); 35Assert.Throws<ArgumentNullException>("envelopeFileName", () => EncryptedPackageEnvelope.Open(null!, FileAccess.Read, FileShare.Read));
System\IO\Packaging\PackageDigitalSignatureManagerTests.cs (11)
43Assert.Throws<ArgumentNullException>("package", () => new PackageDigitalSignatureManager(null)); 63Assert.Throws<ArgumentNullException>("certificate", () => PackageDigitalSignatureManager.VerifyCertificate(null)); 72Assert.Throws<ArgumentException>("handle", () => PackageDigitalSignatureManager.VerifyCertificate(c)); 101Assert.Throws<ArgumentOutOfRangeException>("value", () => manager.CertificateOption = value); 128Assert.Throws<ArgumentNullException>("value", () => manager.HashAlgorithm = null); 136Assert.Throws<ArgumentException>("value", () => manager.HashAlgorithm = string.Empty); 190Assert.Throws<ArgumentNullException>("value", () => manager.TimeFormat = null); 233Assert.Throws<ArgumentNullException>("certificate", () => manager.Countersign(null)); 234Assert.Throws<ArgumentNullException>("certificate", () => manager.Countersign(null, Array.Empty<Uri>())); 246Assert.Throws<ArgumentNullException>("signatures", () => manager.Countersign(c, null)); 262Assert.Throws<ArgumentNullException>("signatureUri", () => manager.GetSignature(null));
System\Security\RightsManagement\ContentGrantTests.cs (4)
69Assert.Throws<ArgumentNullException>("user", () => new ContentGrant(null, ContentRight.View)); 70Assert.Throws<ArgumentNullException>("user", () => new ContentGrant(null, ContentRight.View, DateTime.MinValue, DateTime.MaxValue)); 79Assert.Throws<ArgumentOutOfRangeException>("right", () => new ContentGrant(user, right)); 86Assert.Throws<ArgumentOutOfRangeException>("validFrom", () => new ContentGrant(user, ContentRight.View, new DateTime(2023, 01, 01), new DateTime(2023, 01, 01).AddTicks(-1)));
System\Security\RightsManagement\ContentUserTests.cs (4)
30Assert.Throws<ArgumentNullException>("name", () => new ContentUser(null!, AuthenticationType.Windows)); 38Assert.Throws<ArgumentOutOfRangeException>("name", () => new ContentUser(name, AuthenticationType.Windows)); 46Assert.Throws<ArgumentOutOfRangeException>("authenticationType", () => new ContentUser("name", authenticationType)); 55Assert.Throws<ArgumentOutOfRangeException>("name", () => new ContentUser(name, AuthenticationType.Internal));
System\Security\RightsManagement\PublishLicenseTests.cs (5)
100Assert.Throws<ArgumentNullException>("signedPublishLicense", () => new PublishLicense(null!)); 119Assert.Throws<ArgumentNullException>("uriString", () => new PublishLicense(PublishLicenseTemplate)); 327Assert.Throws<ArgumentNullException>("secureEnvironment", () => license.AcquireUseLicense(null)); 334Assert.Throws<ArgumentNullException>("secureEnvironment", () => license.AcquireUseLicenseNoUI(null)); 347Assert.Throws<ArgumentNullException>("cryptoProvider", () => license.DecryptUnsignedPublishLicense(null));
System\Security\RightsManagement\RightsManagementExceptionTests.cs (1)
233Assert.Throws<ArgumentNullException>("info", () => new SubRightsManagementException((SerializationInfo)null!, default));
System\Security\RightsManagement\SecureEnvironmentTests.cs (10)
32Assert.Throws<ArgumentNullException>("applicationManifest", () => SecureEnvironment.Create(null!, AuthenticationType.Windows, UserActivationMode.Permanent)); 33Assert.Throws<ArgumentNullException>("applicationManifest", () => SecureEnvironment.Create(null!, new ContentUser("name", AuthenticationType.Windows))); 60Assert.Throws<ArgumentOutOfRangeException>("authentication", () => SecureEnvironment.Create("manifest", authentication, UserActivationMode.Permanent)); 68Assert.Throws<ArgumentOutOfRangeException>("userActivationMode", () => SecureEnvironment.Create("manifest", AuthenticationType.Windows, userActivationMode)); 74Assert.Throws<ArgumentNullException>("user", () => SecureEnvironment.Create("manifest", null!)); 95Assert.Throws<ArgumentOutOfRangeException>("user", () => SecureEnvironment.Create("manifest", user)); 104Assert.Throws<ArgumentOutOfRangeException>("user", () => SecureEnvironment.Create("manifest", user)); 145Assert.Throws<ArgumentNullException>("user", () => SecureEnvironment.IsUserActivated(null!)); 152Assert.Throws<ArgumentOutOfRangeException>("user", () => SecureEnvironment.IsUserActivated(user)); 161Assert.Throws<ArgumentOutOfRangeException>("user", () => SecureEnvironment.IsUserActivated(user));
System\Security\RightsManagement\UnsignedPublishLicenseTests.cs (2)
35Assert.Throws<ArgumentNullException>("publishLicenseTemplate", () => new UnsignedPublishLicense(null)); 127Assert.Throws<ArgumentNullException>("secureEnvironment", () => license.Sign(null!, out useLicense));
System\Security\RightsManagement\UseLicenseTests.cs (1)
11Assert.Throws<ArgumentNullException>("useLicense", () => new UseLicense(null!));
System\Windows\AttachedPropertyBrowsableForTypeAttributeTests.cs (1)
23Assert.Throws<ArgumentNullException>("targetType", () => new AttachedPropertyBrowsableForTypeAttribute(null!));
System\Windows\AttachedPropertyBrowsableWhenAttributePresentAttributeTests.cs (1)
22Assert.Throws<ArgumentNullException>("attributeType", () => new AttachedPropertyBrowsableWhenAttributePresentAttribute(null!));
System\Windows\DependencyObjectTests.cs (2)
1603Assert.Throws<ArgumentNullException>("dp", () => obj.GetValue(null!)); 2014Assert.Throws<ArgumentNullException>("dp", () => obj.ReadLocalValue(null!));
System\Windows\DependencyObjectTypeTests.cs (1)
44Assert.Throws<ArgumentNullException>("systemType", () => DependencyObjectType.FromSystemType(null!));
System\Windows\DependencyPropertyTests.cs (36)
216Assert.Throws<ArgumentNullException>("name", () => DependencyProperty.Register(null, typeof(int), typeof(DependencyPropertyTests))); 222Assert.Throws<ArgumentException>("name", () => DependencyProperty.Register(string.Empty, typeof(int), typeof(DependencyPropertyTests))); 228Assert.Throws<ArgumentNullException>("propertyType", () => DependencyProperty.Register(MethodBase.GetCurrentMethod()!.Name, null!, typeof(DependencyPropertyTests))); 229Assert.Throws<ArgumentNullException>("propertyType", () => DependencyProperty.Register(MethodBase.GetCurrentMethod()!.Name, null!, typeof(DependencyPropertyTests), new PropertyMetadata())); 230Assert.Throws<ArgumentNullException>("propertyType", () => DependencyProperty.Register(MethodBase.GetCurrentMethod()!.Name, null!, typeof(DependencyPropertyTests), new PropertyMetadata(), value => true)); 256Assert.Throws<ArgumentNullException>("ownerType", () => DependencyProperty.Register(MethodBase.GetCurrentMethod()!.Name, typeof(int), null!)); 257Assert.Throws<ArgumentNullException>("ownerType", () => DependencyProperty.Register(MethodBase.GetCurrentMethod()!.Name, typeof(int), null!, new PropertyMetadata())); 258Assert.Throws<ArgumentNullException>("ownerType", () => DependencyProperty.Register(MethodBase.GetCurrentMethod()!.Name, typeof(int), null!, new PropertyMetadata(), value => true)); 529Assert.Throws<ArgumentNullException>("name", () => DependencyProperty.RegisterAttached(null, typeof(int), typeof(DependencyPropertyTests))); 530Assert.Throws<ArgumentNullException>("name", () => DependencyProperty.RegisterAttached(null, typeof(int), typeof(DependencyPropertyTests), new PropertyMetadata())); 531Assert.Throws<ArgumentNullException>("name", () => DependencyProperty.RegisterAttached(null, typeof(int), typeof(DependencyPropertyTests), new PropertyMetadata(), value => true)); 537Assert.Throws<ArgumentException>("name", () => DependencyProperty.RegisterAttached(string.Empty, typeof(int), typeof(DependencyPropertyTests))); 538Assert.Throws<ArgumentException>("name", () => DependencyProperty.RegisterAttached(string.Empty, typeof(int), typeof(DependencyPropertyTests), new PropertyMetadata())); 539Assert.Throws<ArgumentException>("name", () => DependencyProperty.RegisterAttached(string.Empty, typeof(int), typeof(DependencyPropertyTests), new PropertyMetadata(), value => true)); 545Assert.Throws<ArgumentNullException>("propertyType", () => DependencyProperty.RegisterAttached(MethodBase.GetCurrentMethod()!.Name, null!, typeof(DependencyPropertyTests))); 546Assert.Throws<ArgumentNullException>("propertyType", () => DependencyProperty.RegisterAttached(MethodBase.GetCurrentMethod()!.Name, null!, typeof(DependencyPropertyTests), new PropertyMetadata())); 547Assert.Throws<ArgumentNullException>("propertyType", () => DependencyProperty.RegisterAttached(MethodBase.GetCurrentMethod()!.Name, null!, typeof(DependencyPropertyTests), new PropertyMetadata(), value => true)); 573Assert.Throws<ArgumentNullException>("ownerType", () => DependencyProperty.RegisterAttached(MethodBase.GetCurrentMethod()!.Name, typeof(int), null!)); 574Assert.Throws<ArgumentNullException>("ownerType", () => DependencyProperty.RegisterAttached(MethodBase.GetCurrentMethod()!.Name, typeof(int), null!, new PropertyMetadata())); 575Assert.Throws<ArgumentNullException>("ownerType", () => DependencyProperty.RegisterAttached(MethodBase.GetCurrentMethod()!.Name, typeof(int), null!, new PropertyMetadata(), value => true)); 815Assert.Throws<ArgumentNullException>("name", () => DependencyProperty.RegisterReadOnly(null, typeof(int), typeof(DependencyObject), new PropertyMetadata())); 816Assert.Throws<ArgumentNullException>("name", () => DependencyProperty.RegisterReadOnly(null, typeof(int), typeof(DependencyObject), new PropertyMetadata(), value => true)); 822Assert.Throws<ArgumentException>("name", () => DependencyProperty.RegisterReadOnly(string.Empty, typeof(int), typeof(DependencyObject), new PropertyMetadata())); 823Assert.Throws<ArgumentException>("name", () => DependencyProperty.RegisterReadOnly(string.Empty, typeof(int), typeof(DependencyObject), new PropertyMetadata(), value => true)); 829Assert.Throws<ArgumentNullException>("propertyType", () => DependencyProperty.RegisterReadOnly(MethodBase.GetCurrentMethod()!.Name, null!, typeof(DependencyProperty), new PropertyMetadata())); 830Assert.Throws<ArgumentNullException>("propertyType", () => DependencyProperty.RegisterReadOnly(MethodBase.GetCurrentMethod()!.Name, null!, typeof(DependencyProperty), new PropertyMetadata(), value => true)); 855Assert.Throws<ArgumentNullException>("ownerType", () => DependencyProperty.RegisterReadOnly(MethodBase.GetCurrentMethod()!.Name, typeof(int), null!, new PropertyMetadata())); 856Assert.Throws<ArgumentNullException>("ownerType", () => DependencyProperty.RegisterReadOnly(MethodBase.GetCurrentMethod()!.Name, typeof(int), null!, new PropertyMetadata(), value => true)); 1110Assert.Throws<ArgumentNullException>("name", () => DependencyProperty.RegisterAttachedReadOnly(null, typeof(int), typeof(DependencyPropertyTests), new PropertyMetadata())); 1111Assert.Throws<ArgumentNullException>("name", () => DependencyProperty.RegisterAttachedReadOnly(null, typeof(int), typeof(DependencyPropertyTests), new PropertyMetadata(), value => true)); 1117Assert.Throws<ArgumentException>("name", () => DependencyProperty.RegisterAttachedReadOnly(string.Empty, typeof(int), typeof(DependencyPropertyTests), new PropertyMetadata())); 1118Assert.Throws<ArgumentException>("name", () => DependencyProperty.RegisterAttachedReadOnly(string.Empty, typeof(int), typeof(DependencyPropertyTests), new PropertyMetadata(), value => true)); 1124Assert.Throws<ArgumentNullException>("propertyType", () => DependencyProperty.RegisterAttachedReadOnly(MethodBase.GetCurrentMethod()!.Name, null!, typeof(DependencyPropertyTests), new PropertyMetadata())); 1125Assert.Throws<ArgumentNullException>("propertyType", () => DependencyProperty.RegisterAttachedReadOnly(MethodBase.GetCurrentMethod()!.Name, null!, typeof(DependencyPropertyTests), new PropertyMetadata(), value => true)); 1150Assert.Throws<ArgumentNullException>("ownerType", () => DependencyProperty.RegisterAttachedReadOnly(MethodBase.GetCurrentMethod()!.Name, typeof(int), null!, new PropertyMetadata())); 1151Assert.Throws<ArgumentNullException>("ownerType", () => DependencyProperty.RegisterAttachedReadOnly(MethodBase.GetCurrentMethod()!.Name, typeof(int), null!, new PropertyMetadata(), value => true));
System\Windows\FreezableTests.cs (1)
6164Assert.Throws<ArgumentNullException>("dp", () => obj.GetValue(null!));
System\Windows\Input\KeyConverterTests.cs (3)
223Assert.Throws<ArgumentNullException>("destinationType", () => converter.ConvertTo(value, null!)); 224Assert.Throws<ArgumentNullException>("destinationType", () => converter.ConvertTo(null, null, Key.None, null!)); 225Assert.Throws<ArgumentNullException>("destinationType", () => converter.ConvertTo(new CustomTypeDescriptorContext(), CultureInfo.InvariantCulture, Key.None, null!));
System\Windows\Input\ModifierKeysConverterTests.cs (6)
116Assert.Throws<InvalidEnumArgumentException>("value", () => converter.ConvertTo(value, typeof(string))); 117Assert.Throws<InvalidEnumArgumentException>("value", () => converter.ConvertTo(new CustomTypeDescriptorContext(), null, value, typeof(string))); 118Assert.Throws<InvalidEnumArgumentException>("value", () => converter.ConvertTo(new CustomTypeDescriptorContext(), CultureInfo.InvariantCulture, value, typeof(string))); 189Assert.Throws<ArgumentNullException>("destinationType", () => converter.ConvertTo(value, null!)); 190Assert.Throws<ArgumentNullException>("destinationType", () => converter.ConvertTo(null, null, Key.None, null!)); 191Assert.Throws<ArgumentNullException>("destinationType", () => converter.ConvertTo(new CustomTypeDescriptorContext(), CultureInfo.InvariantCulture, Key.None, null!));
System\Windows\Input\ModifierKeysValueSerializerTests.cs (2)
48Assert.Throws<InvalidEnumArgumentException>("value", () => serializer.ConvertToString(key, null)); 49Assert.Throws<InvalidEnumArgumentException>("value", () => serializer.ConvertToString(key, new CustomValueSerializerContext()));
System\Windows\Input\TraversalRequestTests.cs (1)
31Assert.Throws<InvalidEnumArgumentException>("focusNavigationDirection", () => new TraversalRequest(focusNavigationDirection));
System\Windows\Int32RectConverterTests.cs (3)
99Assert.Throws<ArgumentNullException>("destinationType", () => converter.ConvertTo(value, null!)); 100Assert.Throws<ArgumentNullException>("destinationType", () => converter.ConvertTo(null, null, new Int32Rect(), null!)); 101Assert.Throws<ArgumentNullException>("destinationType", () => converter.ConvertTo(new CustomTypeDescriptorContext(), CultureInfo.InvariantCulture, new Int32Rect(), null!));
System\Windows\Markup\ServiceProvidersTests.cs (2)
71Assert.Throws<ArgumentNullException>("key", () => serviceProviders.GetService(null)); 81Assert.Throws<ArgumentNullException>("key", () => serviceProviders.GetService(null));
System\Windows\Media\MatrixConverterTests.cs (3)
99Assert.Throws<ArgumentNullException>("destinationType", () => converter.ConvertTo(value, null!)); 100Assert.Throws<ArgumentNullException>("destinationType", () => converter.ConvertTo(null, null, new Matrix(), null!)); 101Assert.Throws<ArgumentNullException>("destinationType", () => converter.ConvertTo(new CustomTypeDescriptorContext(), CultureInfo.InvariantCulture, new Matrix(), null!));
System\Windows\NameScopeTests.cs (9)
35Assert.Throws<ArgumentNullException>("dependencyObject", () => NameScope.GetNameScope(null)); 114Assert.Throws<ArgumentNullException>("key", () => nameScope[null]); 208Assert.Throws<ArgumentNullException>("value", () => nameScope["name"] = null); 614Assert.Throws<ArgumentException>("item", () => nameScope.Contains(new KeyValuePair<string, object>(null!, new object()))); 615Assert.Throws<ArgumentException>("item", () => nameScope.Contains(default)); 673Assert.Throws<ArgumentNullException>("key", () => nameScope.ContainsKey(null!)); 958Assert.Throws<ArgumentNullException>("key", () => nameScope.Remove(null)); 1018Assert.Throws<ArgumentException>("item", () => nameScope.Remove(new KeyValuePair<string, object>(null!, new object()))); 1122Assert.Throws<ArgumentNullException>("key", () => nameScope.TryGetValue(null, out object value));
System\Windows\PointConverterTests.cs (3)
99Assert.Throws<ArgumentNullException>("destinationType", () => converter.ConvertTo(value, null!)); 100Assert.Throws<ArgumentNullException>("destinationType", () => converter.ConvertTo(null, null, new Point(), null!)); 101Assert.Throws<ArgumentNullException>("destinationType", () => converter.ConvertTo(new CustomTypeDescriptorContext(), CultureInfo.InvariantCulture, new Point(), null!));
System\Windows\RectConverterTests.cs (3)
99Assert.Throws<ArgumentNullException>("destinationType", () => converter.ConvertTo(value, null!)); 100Assert.Throws<ArgumentNullException>("destinationType", () => converter.ConvertTo(null, null, new Rect(), null!)); 101Assert.Throws<ArgumentNullException>("destinationType", () => converter.ConvertTo(new CustomTypeDescriptorContext(), CultureInfo.InvariantCulture, new Rect(), null!));
System\Windows\SizeConverterTests.cs (3)
99Assert.Throws<ArgumentNullException>("destinationType", () => converter.ConvertTo(value, null!)); 100Assert.Throws<ArgumentNullException>("destinationType", () => converter.ConvertTo(null, null, new Size(), null!)); 101Assert.Throws<ArgumentNullException>("destinationType", () => converter.ConvertTo(new CustomTypeDescriptorContext(), CultureInfo.InvariantCulture, new Size(), null!));
System\Windows\SplashScreenTests.cs (5)
39Assert.Throws<ArgumentNullException>("resourceName", () => new SplashScreen(null)); 40Assert.Throws<ArgumentNullException>("resourceName", () => new SplashScreen(Assembly.GetEntryAssembly(), null)); 46Assert.Throws<ArgumentNullException>("resourceName", () => new SplashScreen(string.Empty)); 47Assert.Throws<ArgumentNullException>("resourceName", () => new SplashScreen(Assembly.GetEntryAssembly(), string.Empty)); 53Assert.Throws<ArgumentNullException>("resourceAssembly", () => new SplashScreen(null!, "resourceName"));
System\Windows\Threading\DispatcherOperationTests.cs (1)
99Assert.Throws<InvalidEnumArgumentException>("value", () => operation.Priority = value);
System\Windows\Threading\DispatcherSynchronizationContextTests.cs (3)
42Assert.Throws<ArgumentNullException>("dispatcher", () => new DispatcherSynchronizationContext(null)); 43Assert.Throws<ArgumentNullException>("dispatcher", () => new DispatcherSynchronizationContext(null, DispatcherPriority.Normal)); 52Assert.Throws<InvalidEnumArgumentException>("priority", () => new DispatcherSynchronizationContext(Dispatcher.CurrentDispatcher, priority));
System\Windows\Threading\DispatcherTests.cs (5)
120Assert.Throws<InvalidEnumArgumentException>("priority", () => Dispatcher.Yield(priority)); 144Assert.Throws<InvalidEnumArgumentException>("priority", () => dispatcher.BeginInvoke(priority, (Action)(() => { }))); 145Assert.Throws<InvalidEnumArgumentException>("priority", () => dispatcher.BeginInvoke(priority, (Action<object>)((arg) => { }), new object())); 146Assert.Throws<InvalidEnumArgumentException>("priority", () => dispatcher.BeginInvoke(priority, (Action<object, object>)((arg1, arg2) => { }), new object(), new object[] { new object() })); 147Assert.Throws<InvalidEnumArgumentException>("priority", () => dispatcher.BeginInvoke(priority, (Action<object, object>)((arg1, arg2) => { }), new object[] { new object(), new object() }));
System\Windows\Threading\DispatcherTimerTests.cs (11)
92Assert.Throws<InvalidEnumArgumentException>("priority", () => new DispatcherTimer(priority)); 93Assert.Throws<InvalidEnumArgumentException>("priority", () => new DispatcherTimer(priority, Dispatcher.CurrentDispatcher)); 94Assert.Throws<InvalidEnumArgumentException>("priority", () => new DispatcherTimer(TimeSpan.Zero, priority, (s, e) => {}, Dispatcher.CurrentDispatcher)); 100Assert.Throws<ArgumentException>("priority", () => new DispatcherTimer(DispatcherPriority.Inactive)); 101Assert.Throws<ArgumentException>("priority", () => new DispatcherTimer(DispatcherPriority.Inactive, Dispatcher.CurrentDispatcher)); 102Assert.Throws<ArgumentException>("priority", () => new DispatcherTimer(TimeSpan.Zero, DispatcherPriority.Inactive, (s, e) => {}, Dispatcher.CurrentDispatcher)); 108Assert.Throws<ArgumentNullException>("dispatcher", () => new DispatcherTimer(DispatcherPriority.Normal, null)); 109Assert.Throws<ArgumentNullException>("dispatcher", () => new DispatcherTimer(TimeSpan.Zero, DispatcherPriority.Normal, (s, e) => {}, null)); 124Assert.Throws<ArgumentOutOfRangeException>("interval", () => new DispatcherTimer(interval, DispatcherPriority.Normal, (s, e) => {}, Dispatcher.CurrentDispatcher)); 130Assert.Throws<ArgumentNullException>("callback", () => new DispatcherTimer(TimeSpan.Zero, DispatcherPriority.Normal, null, Dispatcher.CurrentDispatcher)); 198Assert.Throws<ArgumentOutOfRangeException>("value", () => timer.Interval = value);
System\Windows\VectorConverterTests.cs (3)
99Assert.Throws<ArgumentNullException>("destinationType", () => converter.ConvertTo(value, null!)); 100Assert.Throws<ArgumentNullException>("destinationType", () => converter.ConvertTo(null, null, new Vector(), null!)); 101Assert.Throws<ArgumentNullException>("destinationType", () => converter.ConvertTo(new CustomTypeDescriptorContext(), CultureInfo.InvariantCulture, new Vector(), null!));
System\Windows\WeakEventManagerTests.cs (9)
750Assert.Throws<ArgumentNullException>("key", () => SubWeakEventManager.GetCurrentManager(null!)); 3379Assert.Throws<ArgumentOutOfRangeException>("index", () => list[index]); 3395Assert.Throws<ArgumentOutOfRangeException>("index", () => list[-1]); 3396Assert.Throws<ArgumentOutOfRangeException>("index", () => list[0]); 3397Assert.Throws<ArgumentOutOfRangeException>("index", () => list[1]); 3408Assert.Throws<ArgumentOutOfRangeException>("index", () => list[index]); 3425Assert.Throws<ArgumentOutOfRangeException>("index", () => list[-1]); 3426Assert.Throws<ArgumentOutOfRangeException>("index", () => list[1]); 3427Assert.Throws<ArgumentOutOfRangeException>("index", () => list[2]);