public void Convert_InappropriateType_ReturnsEmptyString() { //Arrange var converter = new CultureInfoStringConverter(); var language = "I am a CultureInfo object"; //Act var converted = converter.Convert( language, typeof(string), null, CultureInfo.InvariantCulture); var convertedAsTargetType = converted as string; //Assert Assert.IsInstanceOfType(converted, typeof(string)); Assert.AreEqual(string.Empty, convertedAsTargetType); }
public void Convert_InvariantCultureInfo_ReturnsCorrespondingString() { //Arrange var converter = new CultureInfoStringConverter(); var language = CultureInfo.InvariantCulture; var expectedConverted = language.DisplayName + " (" + language.Name + ")"; //Act var converted = converter.Convert( language, typeof(string), null, CultureInfo.InvariantCulture); var convertedAsTargetType = converted as string; //Assert Assert.IsInstanceOfType(converted, typeof(string)); Assert.AreEqual(expectedConverted, convertedAsTargetType); }