Skip to content
This repository has been archived by the owner on Nov 27, 2018. It is now read-only.

Adding DataTokens Support. #88

Closed
wants to merge 3 commits into from
Closed

Adding DataTokens Support. #88

wants to merge 3 commits into from

Conversation

harshgMSFT
Copy link
Contributor

Does not contain anything specific for attribute routing.

{
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};
Copy link
Member

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.

Copy link
Member

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).

Copy link
Contributor Author

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????

@rynowak
Copy link
Member

rynowak commented Aug 4, 2014

Is there a good scenario we can come up with for a sample or functional test?

@harshgMSFT
Copy link
Contributor Author

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)
Copy link
Contributor

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?

@javiercn
Copy link
Member

javiercn commented Aug 8, 2014

Add a funcitonal test to validate everything E2E

@harshgMSFT
Copy link
Contributor Author

Functional test is in the mvc pr

@harshgMSFT
Copy link
Contributor Author

Branch updated.

@harshgMSFT
Copy link
Contributor Author

@rynowak ping ..

@rynowak
Copy link
Member

rynowak commented Aug 11, 2014

:shipit:

var templateRoute = (TemplateRoute)routeBuilder.Routes[0];

// Assert
Assert.Equal(expectedDictionary.Count, templateRoute.DataTokens.Count);
Copy link
Contributor

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

Copy link
Member

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.

@harshgMSFT harshgMSFT closed this Aug 11, 2014
@harshgMSFT harshgMSFT deleted the DataTokens branch August 11, 2014 19:16
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants