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

  • SEARCH
  • Home
  • 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 317875
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T08:31:04+00:00 2026-05-12T08:31:04+00:00

MbUnit has a great attribute: MultipleCultureAttribute . I am wondering if there is an

  • 0

MbUnit has a great attribute: MultipleCultureAttribute.

I am wondering if there is an easy way to do this in MSTest? So far, the best I can come up with is:

  • Externalizating the actual test code to a private method
  • Saving the current culture
  • Setting the culture and calling the private method (repeated for each culture)
  • And finally, reverting to the original culture

At best, it can be described as ugly … and verbose.

  • 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-12T08:31:04+00:00Added an answer on May 12, 2026 at 8:31 am

    The simplest approach may be to use an anonymous delegate, however keep in mind that MSTest will treat this as a single test so it may be difficult to distinguish results for different cultures.

    eg. Rough code for anonymous delegate approach.

    public static class MultipleCultures
    {
        public static void Do(Action action, params CultureInfo[] cultures)
        {
            CultureInfo originalCulture = Thread.CurrentCulture;
    
            try
            {
                foreach (CultureInfo culture in cultures)
                {
                    Thread.CurrentCulture = culture;
    
                    try
                    {
                        action();
                    }
                    catch
                    {
                        Console.WriteLine("Failed while running test with culture '{0}'.", culture.Name);
                        throw;
                    }
                }
            }
            finally
            {
                Thread.CurrentCulture = originalCulture;
            }
        }
    }
    
    [TestClass]
    public class Fixture
    {
        [TestMethod]
        public void Test()
        {
            MultipleCultures.Do(() =>
            {
                // test code...
            }, CultureInfo.InvariantCulture, CultureInfo.GetCulture("en-GB"));
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Our team is looking to switch from using mbunit to mstest, but there appears
Is there a way in MBUnit to have the same test called multiple times
What distinguishes xUnit, nUnit,and mbUnit from each other? So far from what I can
In MbUnit one can do something like this: [Test] [TestCategory(Bad Arguments)] [TestCategory(Fast)] [ExpectedException(typeof(ArgumentNullException))] public
(C#, Rhino Mocks, MbUnit). I have a class called AccountManager that has a RegisterUser()
I've been using MSTest so far for my unit-tests, and found that it would
I have earlier used mbunit 2 and with this plugin I could get my
I'm using Resharper 4.5 with Visual Studio 2008 and MBUnit testing, and there seems
I am using gallio to integrate mbunit's test runner with the mstest test runner
Can anyone tell me how get mbunit to run more than one test at

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.