fluentassertions.json icon indicating copy to clipboard operation
fluentassertions.json copied to clipboard

Namespace - Just FluentAssertions

Open cheng93 opened this issue 6 years ago • 7 comments

https://github.com/fluentassertions/fluentassertions.json/blob/master/Src/FluentAssertions.Json/JsonAssertionExtensions.cs#L5

Should the namespace for that file be just FluentAssertions ?

Then we won't even need this message in the docs

Be sure to include using FluentAssertions.Json; otherwise false positives may occur.

cheng93 avatar Apr 15 '19 14:04 cheng93

I'm not sure. If we do, you might end up have collisions with the main assembly. Either way, changing this now is going to be a breaking change. cc @jnyrup

dennisdoomen avatar Apr 23 '19 17:04 dennisdoomen

I believe collisions would only occur if the main library has a conflicting overload

In this case JToken/Value/Object

Or classname

cheng93 avatar Apr 26 '19 09:04 cheng93

Some observations:

All FluentAssertions extensions currently use a sub namespace, e.g. FluentAssertions.Json, FluentAssertions.Mvc, etc.

Currently without using FluentAssertions.Json

((JToken)null).Should(); // GenericCollectionAssertions<JToken>
((JValue)null).Should(); // Ambiguous between `ObjectAssertions`, `GenericCollectionAssertions<JToken>` and `ComparableTypeAssertions<JToken>`
((JObject)null).Should(); // `GenericDictionaryAssertions<string, JToken>`

I don't think it would harm to unnest the namespace as a breaking change.

jnyrup avatar Apr 26 '19 13:04 jnyrup

I don't think it would harm to unnest the namespace as a breaking change.

Not sure what you're saying

dennisdoomen avatar Apr 26 '19 18:04 dennisdoomen

@dennisdoomen No, that sentence didn't make an sense. I don't think moving this extension from FluentAssertions.Json to FluentAssertions would cause major problems, as none of the three types extended on are from BCL and JTokenAssertions extends ReferenceTypeAssertions. On the other hand, all other FA extensions are in sub namespaces, so I assume they "suffer" from the same problem.

jnyrup avatar Apr 26 '19 19:04 jnyrup

I think the other repos could also be moved to FluentAssertions namespace.

Note that this is only the extension class containing the Should() methods

cheng93 avatar Apr 26 '19 20:04 cheng93

Yeah, but changing namespace FluentAssertions.Json to FluentAssertions will most definitely cause breaking changes to existing users of this extension library.

dennisdoomen avatar Apr 27 '19 08:04 dennisdoomen