コード例 #1
0
        public void GetCultureInfo_EmptyString_ThrowsCultureNotFoundException(bool withBrackets)
        {
            //Arrange
            var culture = string.Empty;

            //Act //Assert
            Assert.ThrowsException <CultureNotFoundException>(() =>
                                                              CultureInfoUtil.GetCultureInfo(culture, false));
        }
コード例 #2
0
        public void GetCultureInfo_StringIsNotValidCulture_ThrowsCultureNotFoundException(bool withBrackets)
        {
            //Arrange
            var culture = withBrackets ? "(llllll)" : "llllll";

            //Act //Assert
            Assert.ThrowsException <CultureNotFoundException>(() =>
                                                              CultureInfoUtil.GetCultureInfo(culture, false));
        }
コード例 #3
0
        public void GetCultureInfo_NullString_ThrowsArgumentNullException(bool withBrackets)
        {
            //Arrange
            string culture = null;

            //Act //Assert
            Assert.ThrowsException <ArgumentNullException>(() =>
                                                           CultureInfoUtil.GetCultureInfo(culture, false));
        }
コード例 #4
0
        public void GetCultureInfo_ValidCultureWithBracketsNotMatchingCall_ThrowsCultureNotFoundException()
        {
            //Arrange
            var culture       = new CultureInfo("de-DE");
            var cultureString = $"({culture.Name})";

            //Act //Assert
            Assert.ThrowsException <CultureNotFoundException>(() =>
                                                              CultureInfoUtil.GetCultureInfo(cultureString, false));
        }
コード例 #5
0
        public void GetCultureInfo_ValidCultureWithoutBracketsNotMatchingCall_ReturnsCorrespondingCultureInfo()
        {
            //Arrange
            var culture       = new CultureInfo("de-DE");
            var cultureString = culture.Name;

            //Act
            var returnCulture = CultureInfoUtil.GetCultureInfo(cultureString, true);

            //Assert
            Assert.AreEqual(culture, returnCulture);
        }