Gremlin.Net.CosmosDb icon indicating copy to clipboard operation
Gremlin.Net.CosmosDb copied to clipboard

IGraphClient class is not Mockable

Open devanshgoenka97 opened this issue 5 years ago • 12 comments

The GraphResult class is not available publicly and hence IGraphClient is not Mockable, thus disabling the case to create Unit Tests for the same

devanshgoenka97 avatar Aug 22 '19 18:08 devanshgoenka97

Meh, the whole thing should really just be interfaced. I don't know why it wasn't in the first place (probably laziness). I don't really have time to work on this, but I guess it's always good to have more tests. I'll review a pr if you would care to interface the thing.

BenjaBobs avatar Aug 22 '19 21:08 BenjaBobs

@devanshgoenka97 and @BenjaBobs - The IGraphClient returns the concrete object of GraphResult (link) so not sure how interfacing the GraphResult would work here to mock. The GraphResult constructor should be made public so that it can be mocked by inheriting it to MockClass.

amigup avatar Aug 23 '19 03:08 amigup

The code's been merged. I do have a question though, why would interfacing it not make it mockable? Both Moq and NSubstitute support creating mocks for interfaces. Since IGraphClient is an interface, it could be mocked to return a mocked IGraphResult which can then be setup to do whatever the test needs. Am I missing something?

BenjaBobs avatar Aug 23 '19 06:08 BenjaBobs

The issue isn't to mock IGraphClient. It is more about creating an object of GraphResult.

Also could you build the project so that I can use the latest version on Nuget?

devanshgoenka97 avatar Aug 23 '19 06:08 devanshgoenka97

I have zero experience, and right now I don't have time. I might have time to look at it this weekend. We really should get some ci/cd running. Do any of you have any experience with Azure Pipelines or other similar projects?

BenjaBobs avatar Aug 23 '19 07:08 BenjaBobs

Yes, @amigup and myself have experience with Azure Pipleline, and CI/CD in general

devanshgoenka97 avatar Aug 23 '19 07:08 devanshgoenka97

Nice! So where does one start with getting that setup? I heard Azure Pipelines is free for open source so that seems like the obvious choice to me.

BenjaBobs avatar Aug 23 '19 07:08 BenjaBobs

You can setup a new Organization and start a new Project here

devanshgoenka97 avatar Aug 23 '19 07:08 devanshgoenka97

Even though it's free, it still requires me to have my credit card hooked up, which I'm not too fond of since this is not even my repo. @evo-terren Any chance you can set this up?

BenjaBobs avatar Aug 25 '19 08:08 BenjaBobs

Sorry, guys. My company has completely pulled out of supporting this project and I also feel wary of throwing my personal credit card in there for a project I likely won't be working on (at least for the foreseeable future).

evo-terren avatar Aug 26 '19 15:08 evo-terren

Unfortunately, my company is also not very invested in this right now.

BenjaBobs avatar Aug 27 '19 08:08 BenjaBobs

@BenjaBobs and @evo-terren - If you can grant me access on this repository then I can try creating the build definition using my account. Please grant access to github user - amigup and microsoft live account - [email protected]. Also please grant access on published nuget.org package

amigup avatar Aug 30 '19 11:08 amigup