Skip to content

Commit 381ac51

Browse files
Fix nullable warning in IntegrationTestBase (#22487)
1 parent d8733c2 commit 381ac51

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common/Language/IntegrationTests/IntegrationTestBase.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// Copyright (c) .NET Foundation. All rights reserved.
22
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
33

4+
#nullable enable
5+
46
using System;
57
using System.Collections.Generic;
68
using System.IO;
@@ -117,7 +119,7 @@ protected virtual void ConfigureProjectEngine(RazorProjectEngineBuilder builder)
117119
{
118120
}
119121

120-
protected CSharpSyntaxTree AddCSharpSyntaxTree(string text, string filePath = null)
122+
protected CSharpSyntaxTree AddCSharpSyntaxTree(string text, string? filePath = null)
121123
{
122124
var syntaxTree = (CSharpSyntaxTree)CSharpSyntaxTree.ParseText(text, CSharpParseOptions, path: filePath);
123125
CSharpSyntaxTrees.Add(syntaxTree);
@@ -164,7 +166,7 @@ private RazorProjectItem CreateProjectItemFromText(string text, string filePath)
164166
return projectItem;
165167
}
166168

167-
protected RazorProjectItem CreateProjectItemFromFile(string filePath = null, string fileKind = null)
169+
protected RazorProjectItem CreateProjectItemFromFile(string? filePath = null, string? fileKind = null)
168170
{
169171
if (FileName == null)
170172
{
@@ -297,14 +299,14 @@ private CSharpCompilation CreateCompilation()
297299
return compilation;
298300
}
299301

300-
protected RazorProjectEngine CreateProjectEngine(Action<RazorProjectEngineBuilder> configure = null)
302+
protected RazorProjectEngine CreateProjectEngine(Action<RazorProjectEngineBuilder>? configure = null)
301303
{
302304
var compilation = CreateCompilation();
303305
var references = compilation.References.Concat(new[] { compilation.ToMetadataReference(), }).ToArray();
304306
return CreateProjectEngine(Configuration, references, configure);
305307
}
306308

307-
private RazorProjectEngine CreateProjectEngine(RazorConfiguration configuration, MetadataReference[] references, Action<RazorProjectEngineBuilder> configure)
309+
private RazorProjectEngine CreateProjectEngine(RazorConfiguration configuration, MetadataReference[] references, Action<RazorProjectEngineBuilder>? configure)
308310
{
309311
return RazorProjectEngine.Create(configuration, FileSystem, b =>
310312
{

0 commit comments

Comments
 (0)