public void Get_WidthParameters_IncorrectID_ReturnsErroredString() { var container = new LanguageContainer(SystemLanguage.English, GetLanguageFile()); var text = container.Get("wrongtext", "param"); Assert.That(text, Is.EqualTo("**!wrongtext!**")); }
/// <summary> /// Adds a language container to this manager /// </summary> /// <param name="container">The container to add</param> public void AddLanguage(LanguageContainer container) { if (_containers.ContainsKey(container.Language)) { throw new InvalidOperationException("The language (" + container.Language.ToString() + ") have alread been added"); } _containers.Add(container.Language, container); }
/// <summary> /// Constructor /// </summary> /// <param name="fallbackLanguageContainer">The container of the language to fallback to if an identifier is not found in current language</param> public LanguageManager(LanguageContainer fallbackLanguageContainer) { if (fallbackLanguageContainer == null) { throw new ArgumentNullException("fallbackLanguageContainer"); } _fallbackLanguage = fallbackLanguageContainer; _containers = new Dictionary <SystemLanguage, LanguageContainer>(); AddLanguage(_fallbackLanguage); }
public void Get_WithOneParameter_ReturnsParameterizedString() { var container = new LanguageContainer(SystemLanguage.English, GetLanguageFile()); Assert.That(container.Get("test4", "awesome"), Is.EqualTo("Text with one awesome parameter.")); }
public string Get_IncorrectID_ReturnsErroredString(string id) { var container = new LanguageContainer(SystemLanguage.English, GetLanguageFile()); return(container.Get(id)); }
public bool Contains_ReturnsCorrect(string id) { var container = new LanguageContainer(SystemLanguage.English, GetLanguageFile()); return(container.Contains(id)); }
public void Count_Correct() { var container = new LanguageContainer(SystemLanguage.English, GetLanguageFile()); Assert.That(container.Count, Is.EqualTo(8)); }
public void UsedCharacters_Correct() { var container = new LanguageContainer(SystemLanguage.English, GetLanguageFile()); Assert.That(container.UsedCharacters.Length, Is.EqualTo(30)); }
public void Language_Correct(SystemLanguage language) { var container = new LanguageContainer(language, GetLanguageFile()); Assert.That(container.Language, Is.EqualTo(language)); }
public int HighestParameter_ReturnsCorrectNumber(string id) { var container = new LanguageContainer(SystemLanguage.English, GetLanguageFile()); return(container.HighestParameter(id)); }
public bool HasParameter_ReturnsCorrect(string id) { var container = new LanguageContainer(SystemLanguage.English, GetLanguageFile()); return(container.HasParameter(id)); }
public void Get_WithWrongNumberOfParamters_FormatException() { var container = new LanguageContainer(SystemLanguage.English, GetLanguageFile()); container.Get("test1", "wrongparam"); }
public void Get_WithHighParameter_ReturnsParameterizedString() { var container = new LanguageContainer(SystemLanguage.English, GetLanguageFile()); Assert.That(container.Get("test8", "icy", "sweet", "and pretty"), Is.EqualTo("Text with high and pretty parameter.")); }
public void Get_WithMixedParameters_ReturnsParameterizedString() { var container = new LanguageContainer(SystemLanguage.English, GetLanguageFile()); Assert.That(container.Get("test7", "icy", "sweet", "and pretty"), Is.EqualTo("Text with mixed sweet, and pretty, icy parameters.")); }
public void Get_WithTwoParameters_ReturnsParameterizedString() { var container = new LanguageContainer(SystemLanguage.English, GetLanguageFile()); Assert.That(container.Get("test5", "cool", "and great"), Is.EqualTo("Text with two cool, and great parameters.")); }