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

Remove usage of shouldly #420

Closed
davidfowl opened this issue Sep 1, 2015 · 8 comments
Closed

Remove usage of shouldly #420

davidfowl opened this issue Sep 1, 2015 · 8 comments
Assignees
Milestone

Comments

@davidfowl
Copy link
Member

We should just be using xunit

@Eilon
Copy link
Member

Eilon commented Sep 1, 2015

And Shouldly doesn't run on DNXCore, either.

@jmloeffler
Copy link

If it's ok with everyone, I think that I might be able to tackle this. I'm looking for ways to contribute and this one seems low-risk.

@Eilon
Copy link
Member

Eilon commented Sep 15, 2015

@jmloeffler go for it. Removing Shoudly is mostly a matter of writing clever regex's in VS search & replace to convert to a regular xUnit assert.

Here's an example where I've previously done it: aspnet/StaticFiles@9c5e78b

That should show the general pattern of conversions.

@jmloeffler
Copy link

Yep, that was my plan. Thanks for the cheat sheet @Eilon!

@Eilon
Copy link
Member

Eilon commented Sep 15, 2015

And BTW most important is changing the project.json to of course remove Shouldly, but more importantly, to add dnxcore50.

@jmloeffler
Copy link

@Eilon It appears that Moq is also a blocker for targeting dnxcore50. Do we have a replacement for Moq (different version or mocking framework) or is that as far as I can take this?

@jmloeffler
Copy link

FYI - in case we have to do this again somewhere, the following regex replacements in VS2015 converted most (but not all) of the statements for me. I'll submit a PR with the changes after I spend some time looking into the Moq thing.

(\s*)(.*)\.ShouldBe\(null\) => $1Assert.Null($2)
(\s*)(.*)\.ShouldNotBe\(null\) => $1Assert.NotNull($2)
(\s*)(.*)\.ShouldBe\((.*)\) => $1Assert.Equal($3, $2)
(\s*)(.*)\.ShouldContain\((.*)\) => $1Assert.Contains($3, $2)
(\s*)(.*)\.ShouldNotContain\((.*)\) => $1Assert.DoesNotContain($3, $2)

@Eilon
Copy link
Member

Eilon commented Sep 15, 2015

No Moq on CoreCLR yet. If the usage of Moq is trivial, you could just remove it. If it's more involved, just leave it and don't enabled CoreCLR.

We're working on Moq for CoreCLR so once that's available we can enable dnxcore50 for this project.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants