public void TestLanguageWildcard() { var controller = new ProgramsController(InitRepo()); controller.SetHeaders(new Dictionary <string, string> { { "ACCEPT-LANGUAGE", "*" } }); // Act var program = controller.Get(3); // Assert Assert.AreEqual("Test 3", program.Label); }
public void TestFrench() { var controller = new ProgramsController(InitRepo()); controller.SetHeaders(new Dictionary <string, string> { { "ACCEPT-LANGUAGE", "fr" } }); // Act var program = controller.Get(1); // Assert Assert.AreEqual("Test fr", program.Label); Assert.IsNull(program.Labels); }
public void TestLanguageQuality() { var controller = new ProgramsController(InitRepo()); controller.SetHeaders(new List <KeyValuePair <string, string> > { new KeyValuePair <string, string>("ACCEPT-LANGUAGE", "es"), new KeyValuePair <string, string>("ACCEPT-LANGUAGE", "fr-CA;q=0.8"), new KeyValuePair <string, string>("ACCEPT-LANGUAGE", "en;q=0.5"), new KeyValuePair <string, string>("ACCEPT-LANGUAGE", "*;q=0.4") }); // Act var program = controller.Get(3); // Assert Assert.AreEqual("Test 3 FR", program.Label); }
public void TestGetOne() { // Arrange var controller = new ProgramsController(InitRepo()); controller.SetHeaders(new Dictionary <string, string> { { "ACCEPT-LANGUAGE", "en" } }); // Act var program = controller.Get(2); // Assert Assert.IsNotNull(program); Assert.AreEqual("Test 2", program.Label); Assert.IsNotNull(program.Forms); Assert.AreEqual(2, program.Forms.Count); }