Skip to content

Commit c6382d8

Browse files
ModelDirectiveTest: Fix incorrect test assertions
Both of the design-time tests fail after being updated to use code documents from the project engine. The reason is that the test was initially buggy. Previously, the design-time tests created a RazorProjectEngine with options configured for design-time. However, the RazorCodeDocument was created without those options. So, DocumentIntermediateNode.Options.DesignTime wouldn't be set, and ModelDirective.Pass.ExecuteCore(...) would follow a runtime code path. Now that the RazorCodeDocument is correctly configured, it takes the correct design-time code path and the assertions need to be updated. IOW, the test was wrong and now it's correct.
1 parent 5e1cd9d commit c6382d8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/ModelDirectiveTest.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ @inherits BaseType<TModel>
227227
var baseType = @class.BaseType;
228228

229229
Assert.Equal("BaseType", baseType.BaseType.Content);
230-
Assert.NotNull(baseType.BaseType.Source);
230+
Assert.Null(baseType.BaseType.Source);
231231

232232
Assert.NotNull(baseType.ModelType);
233233
Assert.Equal("dynamic", baseType.ModelType.Content);
@@ -265,7 +265,7 @@ @model SomeType
265265
var baseType = @class.BaseType;
266266

267267
Assert.Equal("BaseType", baseType.BaseType.Content);
268-
Assert.NotNull(baseType.BaseType.Source);
268+
Assert.Null(baseType.BaseType.Source);
269269

270270
Assert.NotNull(baseType.ModelType);
271271
Assert.Equal("SomeType", baseType.ModelType.Content);

0 commit comments

Comments
 (0)