Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 460777
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T22:54:28+00:00 2026-05-12T22:54:28+00:00

Some of NUnit ‘s Assert methods are overloaded to use ICollection but not ICollection<T>

  • 0

Some of NUnit‘s Assert methods are overloaded to use ICollection but not ICollection<T> and thus you can’t use them.

Is there anyway around this? Heck, am I doing something stupid?

I’m having to drop back to using Assert.AreEqual rather than specialised methods and its making my tests ugly.

Any advice?

Edit:

Thanks for the responses. The That method of NUnit seems interesting so I’ll look into it at a later date.

Mark correctly mentioned this, but NUnit Collection Asserts are excellent. I’ve recently used them on some new tests and found them excellent to work with.

  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T22:54:29+00:00Added an answer on May 12, 2026 at 10:54 pm

    ICollection and ICollection<T> are different contracts – one does not inherit the other.

    http://msdn.microsoft.com/en-us/library/system.collections.icollection_members.aspx
    http://msdn.microsoft.com/en-us/library/y2fx0ty0.aspx

    If you have a generic collection you can call ToList() on it and get a List<T>, which happens to implement the non-generic ICollection as well. Then use that List in the NUnit Assert method.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to get Gallio running some existing NUnit tests but they're not showing
I am executing If statement based on some vales but Nunit executes all statements
I use NUnit for Mono/C# on my Mac, but I need to use Microsoft.VisualStudio.TestTools.UnitTesting
We've implemented a CollectionConstraint for Nunit in version 2.4.3 in C#. Some of our
I am using C# 2.0 with Nunit Test. I have some object that needs
I've setup some Nunit tests for validating my statistical formulas within my .net v2
I'd like to run some NUnit unit tests against a class in a .Net
I'm setting up a MSBuild project to run some NUnit test, using the MSBuild
Using Visual Studio / C#, I've been debugging some nunit tests recently, and am
Say you have some boiler plate using statements. Say something like this: #if !NUNIT

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.