MbUnit has a decorator that enables you to run you tests against different cultures, i.e. to test that your code is correctly globalized. This is done by taggin the test methods with a MultipleCultureAttribute decorator. This attribute takes a comma separated list of culture names and it will run the test for each of the culture.
MultipleCultureAttribute
The example below shows how this decorator can test methods that are not correctly globalized.
[TestFixture] public class MultipleCultureAttributeTest { [Test] [ExpectedException(typeof(AssertionException))] [MultipleCulture("en-US,de-DE")] public void TestConvertFromString() { string input="2.2"; double output = double.Parse(input); Assert.AreEqual(2.2, output); }
[Test] [ExpectedException(typeof(AssertionException))] [MultipleCulture("en-US,de-DE")] public void TestConvertToString() { double input = 2.2; string output= string.Format("{0}",input); Assert.AreEqual("2.2",output); } }
Page rendered at Sunday, September 07, 2008 9:58:57 PM UTC
Disclaimer The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.