コード例 #1
0
        public void Exists_When_CultureCode_Exists_Returns_True()
        {
            // Arrange
            var expected = new CultureStub();

            // Act & Assert
            new List <ICulture> {
                expected
            }.Exists(expected.Code).ShouldBeTrue();
        }
コード例 #2
0
        public void ToCultureInfo_Returns_Mapped_CultureInfo()
        {
            // Arrange
            var expected = new CultureStub();

            // Act
            var result = expected.ToCultureInfo();

            // Assert
            result.ShouldNotBeNull();
            result.Name.ShouldBe(expected.Code);
        }
コード例 #3
0
        public void CultureCodes_Given_Custom_Delimiter_Returns_Custom_Delimited_Codes(string expectedDelimiter)
        {
            // Arrange
            var expectedCode = new CultureStub().Code;

            // Act
            var result = LocalizationUtils.CultureCodes(expectedDelimiter);

            // Assert
            result.ShouldNotBeNull();
            result.ShouldContain(expectedCode);
            result.ShouldContain(expectedDelimiter);
        }
コード例 #4
0
        public void CultureCodes_Without_Arguments_Returns_Comma_Delimited_Codes()
        {
            // Arrange
            var expected = new CultureStub().Code;

            // Act
            var result = LocalizationUtils.CultureCodes();

            // Assert
            result.ShouldNotBeNull();
            result.ShouldContain(expected);
            result.ShouldContain(", ");
        }
コード例 #5
0
        public void CultureByCode_Given_CultureCode_Exists_Returns_Culture()
        {
            // Arrange
            var expected = new CultureStub().Code;

            // Act
            var result = LocalizationUtils.CultureByCode(expected);

            // Assert
            result.ShouldNotBeNull();
            result.ShouldBeOfType <CultureStub>();
            result.Code.ShouldBe(expected);
        }
コード例 #6
0
        public void ToCultureCodes_Given_Delimiter_IsValid_Returns_Custom_Delimited_Codes(string expectedDelimiter)
        {
            // Arrange
            var expectedCode = new CultureStub().Code;

            // Act
            var result = new List <ICulture> {
                new CultureStub(), new EnglishUnitedStates()
            }.ToCultureCodes(expectedDelimiter);

            // Assert
            result.ShouldNotBeNull();
            result.ShouldContain(expectedCode);
            result.ShouldContain(expectedDelimiter);
        }
コード例 #7
0
        public void ToCultureInfos_Returns_ListOf_Mapped_CultureInfos()
        {
            // Arrange
            var expected  = new CultureStub();
            var expected2 = new EnglishUnitedStates();
            var cultures  = new List <ICulture> {
                expected, expected2
            };

            // Act
            var results = cultures.ToCultureInfos();

            // Assert
            results.ShouldNotBeEmpty();
            results.ShouldContain(e => e.Name == expected.Code);
            results.ShouldContain(e => e.Name == expected2.Code);
        }
コード例 #8
0
        public void ToCultureCodes_Without_Arguments_Returns_ListOf_CultureCodes()
        {
            // Arrange
            var expected  = new CultureStub();
            var expected2 = new EnglishUnitedStates();
            var cultures  = new List <ICulture> {
                expected, expected2
            };

            // Act
            var result = cultures.ToCultureCodes();

            // Assert
            result.ShouldNotBeNull();
            result.ShouldContain(expected.Code);
            result.ShouldContain(expected2.Code);
        }