-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Added consistent model property to view result variants #4901
Conversation
Hi @cjqian, I'm your friendly neighborhood .NET Foundation Pull Request Bot (You can call me DNFBOT). Thanks for your contribution! The agreement was validated by .NET Foundation and real humans are currently evaluating your PR. TTYL, DNFBOT; |
Assert.Same(model, viewResult.ViewData.Model); | ||
Assert.Same(controller.ViewData, viewResult.ViewData); | ||
Assert.Same(controller.TempData, viewResult.TempData); | ||
|
||
if (model != null) | ||
{ | ||
Assert.IsType(model.GetType(), viewResult.Model); | ||
Assert.NotNull(viewResult.Model); | ||
|
||
Assert.IsType(model.GetType(), viewResult.ViewData.Model); | ||
Assert.NotNull(viewResult.ViewData.Model); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not really sure what the purpose of this block is.. this is already covered by L38 in the existing code, and L37-38 - suggest deleting this
I'm not sure what happened with your gits and commits, but there's plenty of them showing up in the history for this PR. Have someone look over your shoulder when this is ready to merge ⌚ |
…t, ViewComponentResult. This resolves #4813.
🆙 📅 |
@@ -34,6 +34,7 @@ public void ControllerView_InvokedInUnitTests(object model, string viewName) | |||
var viewResult = Assert.IsType<ViewResult>(result); | |||
Assert.Equal(viewName, viewResult.ViewName); | |||
Assert.NotNull(viewResult.ViewData); | |||
Assert.Same(model, viewResult.Model); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please also remove the useless block at lines 42-46. Same for the other test you're changing. This is going to come up every time someone looks at these tests.
🆙 📅 (Removed redundant lines, created issue #4906.) |
So #4901 (comment) ??? |
ViewResult, PartialViewResult, ViewComponentResult.
This resolves #4813.