BooCompiler.Tests.LocalizationTestCase.AssertCultureDependentMessage C# (CSharp) Method

AssertCultureDependentMessage() private method

private AssertCultureDependentMessage ( string message, CultureInfo culture ) : void
message string
culture System.Globalization.CultureInfo
return void
        void AssertCultureDependentMessage(string message, CultureInfo culture)
        {
            CultureInfo savedCulture = Thread.CurrentThread.CurrentUICulture;
            Thread.CurrentThread.CurrentUICulture = culture;

            try
            {
                Boo.Lang.Compiler.BooCompiler compiler = new Boo.Lang.Compiler.BooCompiler();
                CompilerParameters options = compiler.Parameters;
                options.Input.Add(new Boo.Lang.Compiler.IO.StringInput("testcase", TestCase));
                options.Pipeline = new Boo.Lang.Compiler.Pipelines.Parse();

                CompilerErrorCollection errors = compiler.Run().Errors;

                Assert.AreEqual(1, errors.Count);
                Assert.AreEqual(message, errors[0].Message);
            }
            finally
            {
                Thread.CurrentThread.CurrentUICulture = savedCulture;
            }
        }