Exemplo n.º 1
0
        public void Localization_GermanError()
        {
            Exception exDefault = GetNotFoundError();
            Exception exGerman;
            Exception exSpanish;
            Exception exEnglish;

            SvnClient.EnableSubversionLocalization();

            Thread      thread          = Thread.CurrentThread;
            CultureInfo previousCulture = CultureInfo.CurrentUICulture;

            try
            {
                thread.CurrentUICulture = new CultureInfo("de-de");

                exGerman = GetNotFoundError();
            }
            finally
            {
                thread.CurrentUICulture = previousCulture;
            }

            try
            {
                thread.CurrentUICulture = new CultureInfo("es-es");

                exSpanish = GetNotFoundError();
            }
            finally
            {
                thread.CurrentUICulture = previousCulture;
            }

            try
            {
                thread.CurrentUICulture = new CultureInfo("en-us");

                exEnglish = GetNotFoundError();
            }
            finally
            {
                thread.CurrentUICulture = previousCulture;
            }

            Assert.That(exDefault, Is.Not.Null);
            Assert.That(exGerman, Is.Not.Null);
            Assert.That(exSpanish, Is.Not.Null);
            Assert.That(exEnglish, Is.Not.Null);

            Assert.That(exEnglish.Message, Is.EqualTo(exDefault.Message));
            Assert.That(exGerman.Message, Is.Not.EqualTo(exDefault.Message));
            Assert.That(exSpanish.Message, Is.Not.EqualTo(exDefault.Message));
            Assert.That(exSpanish.Message, Is.Not.EqualTo(exGerman.Message));

            Assert.That(exDefault.Message.Contains("does\\not"));
            Assert.That(exGerman.Message.Contains("does\\not"));
            Assert.That(exSpanish.Message.Contains("does\\not"));
        }