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 6341395
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T20:01:32+00:00 2026-05-24T20:01:32+00:00

I have a test project in visual studio 2010. I have a TestMethod. Inside

  • 0

I have a test project in visual studio 2010. I have a TestMethod. Inside of this, I want to iterate over a list of things and test each. So, I have 1 test and want to assert N times (once for each item in the list).

However, I don’t want to stop if one fails. I want to continue and then report all failures together.

Example:

[TestMethod]
public void Test()
{
   foreach (item in list)
   {
      // if fail, continue on with the rest
      Assert(if fail, add to output list);
   }

   output_failures_all_at_once;
}
  • 1 1 Answer
  • 0 Views
  • 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-24T20:01:33+00:00Added an answer on May 24, 2026 at 8:01 pm

    I would do something like this:

    // Assert that each item name is fewer than 8 characters.
    [TestMethod]
    public void Test()
    {
       List<string> failures = new List<string>();
    
       // However you get your list in the first place
       List<Item> itemsToTest = GetItems(); 
    
       foreach (Item item in itemsToTest )
       {
          // if fail, continue on with the rest
          if (item.Name.Length > 8 )
          {
             failures.Add(item.Name);
          }
       }
    
       foreach (string failure in failures)
       {
          Console.WriteLine(failure);
       }
    
       Assert.AreEqual(0, failures.Count);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this Visual Studio 2010 Setup Project for installing my application. On (clean)
For some reason, my visual studio 2008 installation doesn't have the Create Test Project
In visual studio 2010 I have setup a Project Visual Studio Installer it includes
Hi, I have done the following : Start Visual Studio 2010 New Project >
I have configured Visual Studio 2010 to debug xUnit.net tests by setting the Project
I have a Unit test project for my Application using DUnit framework. This project
I have this simple test project just to test the IncludeExceptionDetailInFaults behavior. public class
I have 2 projects each one with its own unit test project, and one
HI, I want to have set configuration settings for a unit test project that
I have to test some things on a project which has been developed by

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.