Ejemplo n.º 1
0
        public void UsesSuppliedCultureAndUICulture()
        {
            // Arrange
            var culture = "de-DE";
            var uiCulture = "fr-CA";

            // Act
            var replaceCulture = new ReplaceCultureAttribute(culture, uiCulture);

            // Assert
            Assert.Equal(new CultureInfo(culture), replaceCulture.Culture);
            Assert.Equal(new CultureInfo(uiCulture), replaceCulture.UICulture);
        }
Ejemplo n.º 2
0
        public void DefaultsTo_EnGB_EnUS()
        {
            // Arrange
            var culture = new CultureInfo("en-GB");
            var uiCulture = new CultureInfo("en-US");

            // Act
            var replaceCulture = new ReplaceCultureAttribute();

            // Assert
            Assert.Equal(culture, replaceCulture.Culture);
            Assert.Equal(uiCulture, replaceCulture.UICulture);
        }
Ejemplo n.º 3
0
        public void BeforeAndAfterTest_ReplacesCulture()
        {
            // Arrange
            var originalCulture = CultureInfo.CurrentCulture;
            var originalUICulture = CultureInfo.CurrentUICulture;
            var culture = "de-DE";
            var uiCulture = "fr-CA";
            var replaceCulture = new ReplaceCultureAttribute(culture, uiCulture);

            // Act
            replaceCulture.Before(methodUnderTest: null);

            // Assert
            Assert.Equal(new CultureInfo(culture), CultureInfo.CurrentCulture);
            Assert.Equal(new CultureInfo(uiCulture), CultureInfo.CurrentUICulture);

            // Act
            replaceCulture.After(methodUnderTest: null);

            // Assert
            Assert.Equal(originalCulture, CultureInfo.CurrentCulture);
            Assert.Equal(originalUICulture, CultureInfo.CurrentUICulture);
        }
Ejemplo n.º 4
0
        public void BeforeAndAfterTest_ReplacesCulture()
        {
            // Arrange
            var originalCulture   = CultureInfo.CurrentCulture;
            var originalUICulture = CultureInfo.CurrentUICulture;
            var culture           = "de-DE";
            var uiCulture         = "fr-CA";
            var replaceCulture    = new ReplaceCultureAttribute(culture, uiCulture);

            // Act
            replaceCulture.Before(methodUnderTest: null);

            // Assert
            Assert.Equal(new CultureInfo(culture), CultureInfo.CurrentCulture);
            Assert.Equal(new CultureInfo(uiCulture), CultureInfo.CurrentUICulture);

            // Act
            replaceCulture.After(methodUnderTest: null);

            // Assert
            Assert.Equal(originalCulture, CultureInfo.CurrentCulture);
            Assert.Equal(originalUICulture, CultureInfo.CurrentUICulture);
        }