예제 #1
0
        public void UsesSuppliedCultureAndUICulture()
        {
            // Arrange
            var culture   = "de-DE";
            var uiCulture = "fr-CA";

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

            // Assert
            Assert.Equal(new CultureInfo(culture), replaceCulture.Culture);
            Assert.Equal(new CultureInfo(uiCulture), replaceCulture.UICulture);
        }
예제 #2
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 UseCultureAttribute(culture, uiCulture);

            // Act
            replaceCulture.Before(null);

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

            // Act
            replaceCulture.After(null);

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