Skip to content
This repository has been archived by the owner on Dec 13, 2021. It is now read-only.

Testing IPublishedContent with IsEnumerableOfType extension method #138

Merged
merged 1 commit into from Nov 13, 2015

Conversation

leekelleher
Copy link
Collaborator

Hey @JimBobSquarePants, here's one for you 馃樇

Whilst experimenting with returning collections of a custom IPublishedContent class, Ditto wouldn't attempt to cast/map them any further.

I set up a quick unit-test to see if this was the case... (where PublishedContentMock is a custom implementation of IPublishedContent)

typeof(IEnumerable<Mocks.PublishedContentMock>).IsEnumerableOfType(typeof(IPublishedContent))

Should this be true or false?


I've added in a fix that swaps around the params for the IsAssignableFrom check.

Whilst experimenting with returning collections of a custom `IPublishedContent` class, Ditto wouldn't attempt to cast/map them any further.

I set up a quick unit-test to see if this was the case...

```
typeof(IEnumerable<Mocks.PublishedContentMock>).IsEnumerableOfType(typeof(IPublishedContent))
```

Should this be true or false?

---

I've added in a fix that swaps around the params for the `IsAssignableFrom` check.
@JimBobSquarePants
Copy link

Yeah, in my mind that should return true. I'll double check against the tests etc to make sure your fix doesn't have any unforseen side effects.

@leekelleher
Copy link
Collaborator Author

Thanks @JimBobSquarePants!

This came about when I was reviewing a Merchello/Ditto workshop implementation. Merchello has an IProductContent which derives from IPublishedContent, which "should" play nicely with Ditto, but it wasn't. 馃槉

The other unit-tests all pass, which either means the patch is cool... or we're missing test scenarios 馃槈 (gotta test 'em all!)

@leekelleher
Copy link
Collaborator Author

@JimBobSquarePants No pressure, just curious if you've had chance to look this one?

@JimBobSquarePants
Copy link

Sorry... Yeah, looks good to me!

leekelleher added a commit that referenced this pull request Nov 13, 2015
Testing IPublishedContent with IsEnumerableOfType extension method
@leekelleher leekelleher merged commit 245c542 into develop Nov 13, 2015
@leekelleher
Copy link
Collaborator Author

Cool, merged in!

@leekelleher leekelleher deleted the question/enumerable-type branch November 13, 2015 10:06
@leekelleher leekelleher added this to the 0.9.0 milestone Nov 13, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Development

Successfully merging this pull request may close these issues.

None yet

2 participants