-
Notifications
You must be signed in to change notification settings - Fork 122
Conversation
{ | ||
yield return new object[] { new Dictionary<string, object> { { "key1", "data1" }, { "key2", 13 } }, 2 }; | ||
yield return new object[] { new RouteValueDictionary { { "key1", "data1" }, { "key2", 13 } }, 2 }; | ||
yield return new object[] { new object(), 0}; |
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.
Add a test with an anonymous object here - that's the primary scenario we expect so there should be a test for it.
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.
Also, add a test for when you have an object that is part of a class hierachy (B extends A and has extra properties) and pass an instance of B as dataTokens. (Verifies that both, properties defined in A and properties defined in B are added to the DataTokens dictionary).
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.
@javiercn Why is that interesting????
Is there a good scenario we can come up with for a sample or functional test? |
One scenario could be that a data token like ControllerAssemblyPath be set and IControllerAssemblyProvider looks assemblies only in that folder. |
@@ -24,7 +25,7 @@ public class TemplateRoute : INamedRouter | |||
private ILogger _constraintLogger; | |||
|
|||
public TemplateRoute(IRouter target, string routeTemplate, IInlineConstraintResolver inlineConstraintResolver) | |||
: this(target, routeTemplate, null, null, inlineConstraintResolver) | |||
: this(target, routeTemplate, null, null, null, inlineConstraintResolver) |
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.
Could you use named parameters here?
Add a funcitonal test to validate everything E2E |
Functional test is in the mvc pr |
Branch updated. |
@rynowak ping .. |
var templateRoute = (TemplateRoute)routeBuilder.Routes[0]; | ||
|
||
// Assert | ||
Assert.Equal(expectedDictionary.Count, templateRoute.DataTokens.Count); |
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.
Not super sure, but this might be equivalent to Assert.Equal(expectedDictionary, templateRoute.DataTokens)
. This = the 4 lines of comparison
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.
It's not. The applicable Assert.Equal(...)
overload is for IEnumerable<KeyValuePair<string, object>>
which does an ordered comparison. We should just add this code to our testing library.
Does not contain anything specific for attribute routing.