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

Obsolete CollectionContainsConstraint Constructors #2360

Closed
ChrisMaddock opened this Issue Aug 13, 2017 · 11 comments

Comments

Projects
None yet
4 participants
@ChrisMaddock
Member

ChrisMaddock commented Aug 13, 2017

At some point, #2239 is going to be merged and remove CollectionContainsConstraint. The only breaking change should be where anyone is explicitly using the code new CollectionContainsConstraint() - all the other methods will be changed internally to use a SomeItemsConstraint instead.

I think it would be good if we can obsolete the CollectionContainsConstraint constructor in v3.8, and then merge the actual constraint removal in v3.9. It should only be the constructor itself that is obsoleted - any other public methods which make use of the class will be refactored. The obsoletion message should state that SomeItemsConstraint is the appropriate replacement.

@ChrisMaddock ChrisMaddock added this to the 3.8 milestone Aug 13, 2017

@mikkelbu mikkelbu self-assigned this Aug 13, 2017

@ChrisMaddock

This comment has been minimized.

Show comment
Hide comment
@ChrisMaddock

ChrisMaddock Aug 14, 2017

Member

D'oh - sorry @mikkelbu - I meant to tag you in this and ask if you wanted to do it!

Member

ChrisMaddock commented Aug 14, 2017

D'oh - sorry @mikkelbu - I meant to tag you in this and ask if you wanted to do it!

@mikkelbu

This comment has been minimized.

Show comment
Hide comment
@mikkelbu

mikkelbu Aug 14, 2017

Member

No problem 😄. I just needed a simple task after my vacation.

Member

mikkelbu commented Aug 14, 2017

No problem 😄. I just needed a simple task after my vacation.

@mikkelbu mikkelbu removed the help wanted label Aug 14, 2017

@mikkelbu

This comment has been minimized.

Show comment
Hide comment
@mikkelbu

mikkelbu Aug 14, 2017

Member

@ChrisMaddock Just a question (I forgot about @CharliePoole's #1324 (comment)). Adding the ObsoleteAttribute to the constructor gives the the following errors when compiling, so I'll need to do most of the same changes as in #2239 (except removing the class) in order to be able to compile the solution.

Has.cs(218,20): error CS0618: 'CollectionContainsConstraint.CollectionContainsConstraint(object)' is obsolete: 'Deprecated, use 'new SomeItemsConstraint(new EqualConstraint(expected))' or 'Has.Some.EqualTo(expected)' instead.' [C:\src\NUnit\nunit\src\NUnitFramework\framework\nunit.framework-4.5.csproj]
Does.cs(68,20): error CS0618: 'CollectionContainsConstraint.CollectionContainsConstraint(object)' is obsolete: 'Deprecated, use 'new SomeItemsConstraint(new EqualConstraint(expected))' or 'Has.Some.EqualTo(expected)' instead.' [C:\src\NUnit\nunit\src\NUnitFramework\framework\nunit.framework-4.5.csproj]
Contains.cs(44,20): error CS0618: 'CollectionContainsConstraint.CollectionContainsConstraint(object)' is obsolete: 'Deprecated, use 'new SomeItemsConstraint(new EqualConstraint(expected))' or 'Has.Some.EqualTo(expected)' instead.' [C:\src\NUnit\nunit\src\NUnitFramework\framework\nunit.framework-4.5.csproj]
Assert.cs(301,33): error CS0618: 'CollectionContainsConstraint.CollectionContainsConstraint(object)' is obsolete: 'Deprecated, use 'new SomeItemsConstraint(new EqualConstraint(expected))' or 'Has.Some.EqualTo(expected)' instead.' [C:\src\NUnit\nunit\src\NUnitFramework\framework\nunit.framework-4.5.csproj]
Assert.cs(311,33): error CS0618: 'CollectionContainsConstraint.CollectionContainsConstraint(object)' is obsolete: 'Deprecated, use 'new SomeItemsConstraint(new EqualConstraint(expected))' or 'Has.Some.EqualTo(expected)' instead.' [C:\src\NUnit\nunit\src\NUnitFramework\framework\nunit.framework-4.5.csproj]
Constraints\DictionaryContainsValueConstraint.cs(40,13): error CS0618: 'CollectionContainsConstraint.CollectionContainsConstraint(object)' is obsolete: 'Deprecated,use 'new SomeItemsConstraint(new EqualConstraint(expected))' or 'Has.Some.EqualTo(expected)' instead.' [C:\src\NUnit\nunit\src\NUnitFramework\framework\nunit.framework-4.5.csproj]
Constraints\DictionaryContainsKeyConstraint.cs(40,13): error CS0618: 'CollectionContainsConstraint.CollectionContainsConstraint(object)' is obsolete: 'Deprecated, use 'new SomeItemsConstraint(new EqualConstraint(expected))' or 'Has.Some.EqualTo(expected)' instead.' [C:\src\NUnit\nunit\src\NUnitFramework\framework\nunit.framework-4.5.csproj]
Constraints\ContainsConstraint.cs(84,35): error CS0618: 'CollectionContainsConstraint.CollectionContainsConstraint(object)' is obsolete: 'Deprecated, use 'new SomeItemsConstraint(new EqualConstraint(expected))' or 'Has.Some.EqualTo(expected)' instead.' [C:\src\NUnit\nunit\src\NUnitFramework\framework\nunit.framework-4.5.csproj]
Constraints\ConstraintExpression.cs(729,62): error CS0618: 'CollectionContainsConstraint.CollectionContainsConstraint(object)' is obsolete: 'Deprecated, use 'new SomeItemsConstraint(new EqualConstraint(expected))' or 'Has.Some.EqualTo(expected)' instead.' [C:\src\NUnit\nunit\src\NUnitFramework\framework\nunit.framework-4.5.csproj]
Constraints\ConstraintExpression.cs(742,62): error CS0618: 'CollectionContainsConstraint.CollectionContainsConstraint(object)' is obsolete: 'Deprecated, use 'new SomeItemsConstraint(new EqualConstraint(expected))' or 'Has.Some.EqualTo(expected)' instead.' [C:\src\NUnit\nunit\src\NUnitFramework\framework\nunit.framework-4.5.csproj]
An error occurred when executing task 'Build45'.
Member

mikkelbu commented Aug 14, 2017

@ChrisMaddock Just a question (I forgot about @CharliePoole's #1324 (comment)). Adding the ObsoleteAttribute to the constructor gives the the following errors when compiling, so I'll need to do most of the same changes as in #2239 (except removing the class) in order to be able to compile the solution.

Has.cs(218,20): error CS0618: 'CollectionContainsConstraint.CollectionContainsConstraint(object)' is obsolete: 'Deprecated, use 'new SomeItemsConstraint(new EqualConstraint(expected))' or 'Has.Some.EqualTo(expected)' instead.' [C:\src\NUnit\nunit\src\NUnitFramework\framework\nunit.framework-4.5.csproj]
Does.cs(68,20): error CS0618: 'CollectionContainsConstraint.CollectionContainsConstraint(object)' is obsolete: 'Deprecated, use 'new SomeItemsConstraint(new EqualConstraint(expected))' or 'Has.Some.EqualTo(expected)' instead.' [C:\src\NUnit\nunit\src\NUnitFramework\framework\nunit.framework-4.5.csproj]
Contains.cs(44,20): error CS0618: 'CollectionContainsConstraint.CollectionContainsConstraint(object)' is obsolete: 'Deprecated, use 'new SomeItemsConstraint(new EqualConstraint(expected))' or 'Has.Some.EqualTo(expected)' instead.' [C:\src\NUnit\nunit\src\NUnitFramework\framework\nunit.framework-4.5.csproj]
Assert.cs(301,33): error CS0618: 'CollectionContainsConstraint.CollectionContainsConstraint(object)' is obsolete: 'Deprecated, use 'new SomeItemsConstraint(new EqualConstraint(expected))' or 'Has.Some.EqualTo(expected)' instead.' [C:\src\NUnit\nunit\src\NUnitFramework\framework\nunit.framework-4.5.csproj]
Assert.cs(311,33): error CS0618: 'CollectionContainsConstraint.CollectionContainsConstraint(object)' is obsolete: 'Deprecated, use 'new SomeItemsConstraint(new EqualConstraint(expected))' or 'Has.Some.EqualTo(expected)' instead.' [C:\src\NUnit\nunit\src\NUnitFramework\framework\nunit.framework-4.5.csproj]
Constraints\DictionaryContainsValueConstraint.cs(40,13): error CS0618: 'CollectionContainsConstraint.CollectionContainsConstraint(object)' is obsolete: 'Deprecated,use 'new SomeItemsConstraint(new EqualConstraint(expected))' or 'Has.Some.EqualTo(expected)' instead.' [C:\src\NUnit\nunit\src\NUnitFramework\framework\nunit.framework-4.5.csproj]
Constraints\DictionaryContainsKeyConstraint.cs(40,13): error CS0618: 'CollectionContainsConstraint.CollectionContainsConstraint(object)' is obsolete: 'Deprecated, use 'new SomeItemsConstraint(new EqualConstraint(expected))' or 'Has.Some.EqualTo(expected)' instead.' [C:\src\NUnit\nunit\src\NUnitFramework\framework\nunit.framework-4.5.csproj]
Constraints\ContainsConstraint.cs(84,35): error CS0618: 'CollectionContainsConstraint.CollectionContainsConstraint(object)' is obsolete: 'Deprecated, use 'new SomeItemsConstraint(new EqualConstraint(expected))' or 'Has.Some.EqualTo(expected)' instead.' [C:\src\NUnit\nunit\src\NUnitFramework\framework\nunit.framework-4.5.csproj]
Constraints\ConstraintExpression.cs(729,62): error CS0618: 'CollectionContainsConstraint.CollectionContainsConstraint(object)' is obsolete: 'Deprecated, use 'new SomeItemsConstraint(new EqualConstraint(expected))' or 'Has.Some.EqualTo(expected)' instead.' [C:\src\NUnit\nunit\src\NUnitFramework\framework\nunit.framework-4.5.csproj]
Constraints\ConstraintExpression.cs(742,62): error CS0618: 'CollectionContainsConstraint.CollectionContainsConstraint(object)' is obsolete: 'Deprecated, use 'new SomeItemsConstraint(new EqualConstraint(expected))' or 'Has.Some.EqualTo(expected)' instead.' [C:\src\NUnit\nunit\src\NUnitFramework\framework\nunit.framework-4.5.csproj]
An error occurred when executing task 'Build45'.
@ChrisMaddock

This comment has been minimized.

Show comment
Hide comment
@ChrisMaddock

ChrisMaddock Aug 14, 2017

Member

Is it possible to disable the warnings with pragma's around the relevant lines?

i.e.

#pragma warning disable 618
new CollectionContainsConstraint()
#pragma warning restore 618
Member

ChrisMaddock commented Aug 14, 2017

Is it possible to disable the warnings with pragma's around the relevant lines?

i.e.

#pragma warning disable 618
new CollectionContainsConstraint()
#pragma warning restore 618
@ChrisMaddock

This comment has been minimized.

Show comment
Hide comment
@ChrisMaddock

ChrisMaddock Aug 14, 2017

Member

If not, maybe a solution is to merge #2239 - just without the classes removed, and the constructors obsoleted instead. Then in 3.9, it will just be a matter of deleting an unused class. 😄

Member

ChrisMaddock commented Aug 14, 2017

If not, maybe a solution is to merge #2239 - just without the classes removed, and the constructors obsoleted instead. Then in 3.9, it will just be a matter of deleting an unused class. 😄

@CharliePoole

This comment has been minimized.

Show comment
Hide comment
@CharliePoole

CharliePoole Aug 14, 2017

Member

@ChrisMaddock Sounds like a plan.

Member

CharliePoole commented Aug 14, 2017

@ChrisMaddock Sounds like a plan.

@mikkelbu

This comment has been minimized.

Show comment
Hide comment
@mikkelbu

mikkelbu Aug 22, 2017

Member

@ChrisMaddock I think that I will go for the second approach (reintroducing the classes in #2239 and mark the constructors as obsolete). Hopefully, I will have time for it this week.

Member

mikkelbu commented Aug 22, 2017

@ChrisMaddock I think that I will go for the second approach (reintroducing the classes in #2239 and mark the constructors as obsolete). Hopefully, I will have time for it this week.

@ChrisMaddock

This comment has been minimized.

Show comment
Hide comment
@ChrisMaddock

ChrisMaddock Aug 22, 2017

Member

Great! 😀 3.8's come up quick - I need to carve some time out to sort the issues I was going to too! 😆

Member

ChrisMaddock commented Aug 22, 2017

Great! 😀 3.8's come up quick - I need to carve some time out to sort the issues I was going to too! 😆

@rprouse

This comment has been minimized.

Show comment
Hide comment
@rprouse

rprouse Aug 26, 2017

Member

@mikkelbu I am starting to prepare the 3.8 release. Should I expect a PR for this soon or should I move it out of the release milestone?

Member

rprouse commented Aug 26, 2017

@mikkelbu I am starting to prepare the 3.8 release. Should I expect a PR for this soon or should I move it out of the release milestone?

@rprouse

This comment has been minimized.

Show comment
Hide comment
@rprouse

rprouse Aug 26, 2017

Member

This was done along with #2239. Sorry for not noticing earlier @mikkelbu. I am closing this as complete.

Member

rprouse commented Aug 26, 2017

This was done along with #2239. Sorry for not noticing earlier @mikkelbu. I am closing this as complete.

@rprouse rprouse closed this Aug 26, 2017

@rprouse rprouse added the closed:done label Aug 26, 2017

@mikkelbu

This comment has been minimized.

Show comment
Hide comment
@mikkelbu

mikkelbu Aug 26, 2017

Member

No need to be sorry. I should have closed the issue myself (I was actually planning to do it tonight :)).

Member

mikkelbu commented Aug 26, 2017

No need to be sorry. I should have closed the issue myself (I was actually planning to do it tonight :)).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment