public void Should_return_null_if_no_cookie_populated()
        {
            //Given
            var context = CreateContextRequest("/");

            //When
            var culture = BuiltInCultureConventions.CookieCulture(context);

            //Then
            culture.ShouldBeNull();
        }
Ejemplo n.º 2
0
        public void Should_return_null_if_no_cookie_populated()
        {
            //Given
            var context = CreateContextRequest("/");

            //When
            var culture = BuiltInCultureConventions.CookieCulture(context, context.Environment.GetValue <GlobalizationConfiguration>());

            //Then
            culture.ShouldBeNull();
        }
        public void Should_return_culture_if_cookie_populate()
        {
            // Given
            const string cookieName = "CurrentCulture";
            const string cookieData = "en-GB";

            var headers = new Dictionary <string, IEnumerable <string> >
            {
                { "cookie", new[] { string.Format("{0}={1}", cookieName, cookieData) } }
            };

            var context = CreateContextRequest("/", headers);

            //When
            var culture = BuiltInCultureConventions.CookieCulture(context);

            // Then
            culture.Name.ShouldEqual("en-GB");
        }
        public void Should_return_null_if_invalid_culture_in_cookie(string cultureName)
        {
            // Given
            const string cookieName = "CurrentCulture";
            string       cookieData = cultureName;

            var headers = new Dictionary <string, IEnumerable <string> >
            {
                { "cookie", new[] { string.Format("{0}={1}", cookieName, cookieData) } }
            };

            var context = CreateContextRequest("/", headers);

            //When
            var culture = BuiltInCultureConventions.CookieCulture(context);

            //Then
            culture.ShouldBeNull();
        }