public void Constructor_HaveBrowserLanguageAndSettingIsEnabledCase2_LanguageSetFromHeader() { // Assign _settings.SetupGet(x => x.AcceptBrowserLanguage).Returns(true); var header = new HeaderDictionary(new Dictionary<string, string[]>()); header.Append("Accept-Language", "ru-RU;q=0.5"); _context.SetupGet(x => x.Request.Headers).Returns(header); // Act _languageManager = new LanguageManager(_settings.Object, _context.Object); // Assert Assert.AreEqual("ru", _languageManager.Language); }
public void Constructor_HaveBrowserLanguageAndCookieLanguage_LanguageSetFromCookie() { // Assign var cookies = new Dictionary<string, string> { { LanguageManager.CookieLanguageFieldName, "fr" } }; _context.SetupGet(x => x.Request.Cookies).Returns(new RequestCookieCollection(cookies)); _settings.SetupGet(x => x.AcceptBrowserLanguage).Returns(true); var header = new HeaderDictionary(new Dictionary<string, string[]>()); header.Append("Accept-Language", "ru-RU"); _context.SetupGet(x => x.Request.Headers).Returns(header); // Act _languageManager = new LanguageManager(_settings.Object, _context.Object); // Assert Assert.AreEqual("fr", _languageManager.Language); }