public void op_Negotiate_HttpRequestBase_Type()
        {
            var obj = AcceptLanguage.FromString("da, en-gb;q=0.8, en;q=0.7");

            var request = new Mock <HttpRequestBase>(MockBehavior.Strict);

            request
            .SetupGet(x => x.Path)
            .Returns("/test")
            .Verifiable();
            request
            .SetupGet(x => x.RawUrl)
            .Returns("http://example.com/test")
            .Verifiable();

            const string expected = "/test.en";

            // ReSharper disable PossibleNullReferenceException
            var actual = (obj.Negotiate(request.Object, typeof(DummyController)) as SeeOtherResult).Location;

            // ReSharper restore PossibleNullReferenceException
            Assert.Equal(expected, actual);

            request.VerifyAll();
        }
        public void op_FromString_string()
        {
            const string expected = "en";
            var          actual   = AcceptLanguage.FromString(expected).Languages[0];

            Assert.Equal <Language>(expected, actual);
        }
        public void op_FromString_stringAcceptLanguage()
        {
            const string value = "da, en-gb;q=0.8, en;q=0.7";
            var          obj   = AcceptLanguage.FromString(value);

            Assert.Equal(3, obj.Languages.Count);

            Assert.Equal <Language>("da", obj.Languages[0]);
            Assert.Equal <Language>("en-gb", obj.Languages[1]);
            Assert.Equal <Language>("en", obj.Languages[2]);
        }
        public void op_FromString_stringAcceptLanguageDisordered()
        {
            const string value = "*, en, en-gb;q=0.4, en-us";
            var          obj   = AcceptLanguage.FromString(value);

            Assert.Equal(4, obj.Languages.Count);

            Assert.Equal <Language>("en-us", obj.Languages[0]);
            Assert.Equal <Language>("en", obj.Languages[1]);
            Assert.Equal <Language>("en-gb", obj.Languages[2]);
            Assert.Equal <Language>("*", obj.Languages[3]);
        }