question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Feature]: Extract the object graph comparison engine to a separate package

See original GitHub issue

Background and motivation

  1. Sometimes with Moq or NSubstitute I need the following call verification logic:

someServiceMock.Verify(s => s.DoSomething(It.Is<object>(o => ObjectComparer.Equals(o, expected))));

I understand and prefer the way with callbacks, as it gives more detailed error messages:

//Arrange
object actual = null;
someServiceMock.Setup(s => s.DoSomething(It.IsAny<object>()))
               .Callback<object>(o => actual = o);

// Act ...

// Assert
expected.Should().BeEquivalentTo(actual);

But sometimes it looks overcomplicated. So It would be perfect to have the comparison logic available without assertion.

  1. Sometimes the fluent assertion approach or library is not approved by the dev team, but the developer who is familiar with fluent assertions would be able to use the comparison feature without referencing the fluent assertion package with a lot of unnecessary extension methods.

PS. I know about the Compare-Net-Objects and ObjectComparer libraries.

Alternative Concerns

No response

Could you help with a pull-request?

No

Issue Analytics

  • State:closed
  • Created a month ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
jnyrupcommented, Aug 21, 2023

Test-engine integration code which throws compatible with specific test engine exceptions.

Just to be clear, upon test failure we detect which testing framework you’re using and throw the appropriate exception. This is done without having a dependency on the testing framework. You can see the dependencies on nuget.org

0reactions
dennisdoomencommented, Aug 20, 2023

I know it’s weird but it’s a fact when the team decides to use only built-in to test framework assertions. And the team doesn’t want to mix the approaches.

If you work in a team with such dogmatic believes, you should consider finding a new job. You’re literally stealing from your employer if one refuses to use great tools. And I’m not talking about Fluent Assertions only.

I would like to have the second one as a separate reusable unit.

2 and 3 are just there to make 1 better. So this is not something I see any value in. I recommend you check out other examples or fork our code base.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Extract compare() into separate package · Issue #447
I'm not sure if diffobj is always a good choice because it'll compare character string representations of objects. But that might be flexible...
Read more >
Feature Extraction Techniques
An end to end guide on how to reduce a dataset dimensionality using Feature Extraction Techniques such as: PCA, ICA, LDA, LLE, t-SNE...
Read more >
What is Feature Extraction? Feature Extraction in Image ...
In this process they extract the words or the features from a sentence, document, website, etc. and then they classify them into the...
Read more >
Image Feature Extraction | Feature Extraction Using Python
Image feature extraction: Learn the process of feature extraction in image processing using different image extraction methods.
Read more >
Neo4j - OGM Object Graph Mapper - Developer Guides
Object graph mapping of annotated node- and relationship-entities. Fast class metadata scanning. Optimized management of data loading and change tracking for ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found