Coder Social home page Coder Social logo

Comments (4)

Meir017 avatar Meir017 commented on August 25, 2024 1

ok, so, for now, I will just add support for a smarter analyzer without a code fix

from fluentassertions.analyzers.

Meir017 avatar Meir017 commented on August 25, 2024

So basically using a null conditional expression together with the Should method should trigger the analyzer?

I was thinking about adding a code-fix that will recommend removing the null conditional expression, does this make sense?

from fluentassertions.analyzers.

jnyrup avatar jnyrup commented on August 25, 2024

I think using conditional expressions on the left hand side of Should should trigger the analyzer.
The conditional expression makes the assertion unclear - at least to me.

I had a unit test the other day like this

actual?.Property.Should().NotBeNull();

where I think the intention was to check that both actual and Property should not be null.

So I rewrote it into

actual.Should().NotBeNull();
actual.Property.Should().NotBeNull();

So I can't come up with a good code-fix, I guess it depends whether you would just remove the ?, split it into two assertions or something else.

from fluentassertions.analyzers.

Meir017 avatar Meir017 commented on August 25, 2024

added more tests for NullConditionalAssertionAnalyzer 6b87da0

from fluentassertions.analyzers.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.