public void Sets_Culture_Form_Value_From_Header_If_Not_Provided_In_Query() { // Arrange ModelBindingContext bindingContext = CreateBindingContext("?foo=bar&baz=buzz"); var binder = new HttpQueryStringModelBinder(); // Act binder.BindModelAsync(bindingContext); // Assert Assert.True(bindingContext.Result.IsModelSet); var typedModel = bindingContext.Result.Model as FormCollection; Assert.IsNotNull(typedModel); Assert.AreEqual(typedModel["culture"], "en-gb"); }
public void Binds_Query_To_FormCollection() { // Arrange ModelBindingContext bindingContext = CreateBindingContext("?foo=bar&baz=buzz"); var binder = new HttpQueryStringModelBinder(); // Act binder.BindModelAsync(bindingContext); // Assert Assert.True(bindingContext.Result.IsModelSet); var typedModel = bindingContext.Result.Model as FormCollection; Assert.IsNotNull(typedModel); Assert.AreEqual(typedModel["foo"], "bar"); Assert.AreEqual(typedModel["baz"], "buzz"); }