public void ReturnsPlayersSortParams() { // Arrange var binder = new PlayersSortParamsBinder(); HttpActionContext actionContext = null; var modelName = "myModelName"; var mockValueProvider = new Mock<IValueProvider>(); mockValueProvider.Setup(v => v.GetValue("myModelName")).ReturnsValueProviderResult("id"); var valueProvider = mockValueProvider.Object; var data = new DataAnnotationsModelMetadataProvider(); var modelMetadata = data.GetMetadataForType(null, typeof(PlayersSortParams)); var bindingContext = new ModelBindingContext { ModelName = modelName, ValueProvider = valueProvider, ModelMetadata = modelMetadata, }; // Act binder.BindModel(actionContext, bindingContext); // Assert var model = bindingContext.Model; Assert.IsAssignableFrom<PlayersSortParams>(model); }
public void ReturnsPlayersSortParamsBinder() { // Arrange -> Act var binder = new PlayersSortParamsBinder(); // Assert Assert.IsAssignableFrom<PlayersSortParamsBinder>(binder); }