public void ThrowsWithExplicitErrorHandlingAndCulture(TranslationThrowSource.ErrorData data) { Translator.Culture = null; Translator.ErrorHandling = ErrorHandling.ReturnErrorInfo; var actual = Assert.Throws <ArgumentOutOfRangeException>(() => Translator <Properties.Resources> .Translate(data.Key !, data.Culture !, data.ErrorHandling)); Assert.AreEqual(data.ExpectedMessage, actual.Message); }
public void ThrowsWithExplicitErrorHandlingAndCulture(TranslationThrowSource.ErrorData data) { Translator.Culture = null; Translator.ErrorHandling = ErrorHandling.ReturnErrorInfo; var actual = Assert.Throws <ArgumentOutOfRangeException>(() => Translator.Translate(Properties.Resources.ResourceManager, data.Key, data.Culture, data.ErrorHandling)); #if DEBUG Console.Write(actual.Message); #endif Assert.AreEqual(data.ExpectedMessage, actual.Message); }
public void ThrowsWithExplicitErrorhandling(TranslationThrowSource.ErrorData data) { if (!Translator.ContainsCulture(data.Culture)) { Assert.Pass("nop"); } Translator.Culture = data.Culture; Translator.ErrorHandling = ErrorHandling.ReturnErrorInfo; var actual = Assert.Throws <ArgumentOutOfRangeException>(() => Translator <Properties.Resources> .Translate(data.Key, data.ErrorHandling)); Assert.AreEqual(data.ExpectedMessage, actual.Message); }
public void ThrowsWithGlobalErrorHandling(TranslationThrowSource.ErrorData data) { if (!Translator.ContainsCulture(data.Culture !)) { Assert.Pass("nop"); } Translator.Culture = data.Culture; Translator.ErrorHandling = data.ErrorHandling; var actual = Assert.Throws <ArgumentOutOfRangeException>(() => Translator <Properties.Resources> .Translate(data.Key !)); Assert.AreEqual(data.ExpectedMessage, actual.Message); actual = Assert.Throws <ArgumentOutOfRangeException>(() => Translator <Properties.Resources> .Translate(data.Key !, ErrorHandling.Inherit)); Assert.AreEqual(data.ExpectedMessage, actual.Message); }
public static void ThrowsWithExplicitErrorHandling(TranslationThrowSource.ErrorData data) { if (!Translator.ContainsCulture(data.Culture !)) { Assert.Pass("nop"); } Translator.Culture = data.Culture; Translator.ErrorHandling = ErrorHandling.ReturnErrorInfo; var actual = Assert.Throws <ArgumentOutOfRangeException>(() => Translator.Translate(Properties.Resources.ResourceManager, data.Key !, data.ErrorHandling)); #if DEBUG Console.Write(actual.Message); #endif Assert.AreEqual(data.ExpectedMessage, actual.Message); }