Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removing Moq as a dependency for mock unit tests #168

Merged
merged 6 commits into from
Aug 14, 2023
Merged

Conversation

shacharPash
Copy link
Contributor

No description provided.

@codecov-commenter
Copy link

codecov-commenter commented Aug 10, 2023

Codecov Report

Patch coverage has no change and project coverage change: +0.03% 🎉

Comparison is base (244ebbf) 93.99% compared to head (27a69c0) 94.03%.

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #168      +/-   ##
==========================================
+ Coverage   93.99%   94.03%   +0.03%     
==========================================
  Files          82       82              
  Lines        5080     5080              
  Branches      479      479              
==========================================
+ Hits         4775     4777       +2     
+ Misses        177      176       -1     
+ Partials      128      127       -1     

see 1 file with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@haysch haysch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a minor inconsistency in variable declaration.

//arrange
var conn = redisFixture.Redis;
var db = conn.GetDatabase();
IJsonCommands commands = new JsonCommands(db);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistent use of var/type declaration - intended?

//arrange
var conn = redisFixture.Redis;
var db = conn.GetDatabase();
IJsonCommandsAsync commands = new JsonCommands(db);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistent use of var/type declaration. Same as above.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we use var then commands will be of type JsonCommands and not IJsonCommands.

Copy link
Contributor

@haysch haysch Aug 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about using the JsonCommandsAsync constructor instead of casting?
That would make it a bit more explicit.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just tested locally and it works properly even when using var, I changed it in all the tests in jsonTests.cs.
Now it is consistent. What do you think?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!
As the implementation is (almost) based upon the same approach as StackExchange.Redis, where the *Commands inherits from *CommandsAsync, I do not have a strong opinion on using one or the other as long as the method matches the scenario 👍

One could also use the extension methods to get the same result, i.e., db.JSON().

Copy link
Contributor

@haysch haysch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@chayim chayim changed the title Remove Moq Removing Moq as a dependency for mock unit tests Aug 14, 2023
@shacharPash shacharPash merged commit f5cce98 into master Aug 14, 2023
7 checks passed
@shacharPash shacharPash deleted the DeleteMoq branch August 14, 2023 14:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants