title: How to write unit test for custom model binder in ASP.net core
body: <p>I have written custom model binder for a property. Now I am trying to write unit test for the same but not able to create object for model binder. Can anyone help me ? Below is the code for which I have to write test.</p>
  
  <pre><code>public class JourneyTypesModelBinder : IModelBinder
  {
      public Task BindModelAsync(ModelBindingContext bindingContext)
      {
          bool IsSingleWay = Convert.ToBoolean((bindingContext.ValueProvider.GetValue("IsSingleWay")).FirstValue);
          bool IsMultiWay = Convert.ToBoolean((bindingContext.ValueProvider.GetValue("IsMultiWay")).FirstValue);
  
          JourneyTypes journeyType = JourneyTypes.None;
          bool hasJourneyType = Enum.TryParse((bindingContext.ValueProvider.GetValue("JourneyType")).FirstValue, out journeyType);
          if (!hasJourneyType)
          {
              if (IsSingleWay)
                  journeyType = JourneyTypes.Single;
              else journeyType = JourneyTypes.MultiWay;
          }
  
          bindingContext.Result = ModelBindingResult.Success(journeyType);
          return Task.CompletedTask;
      } }  
  </code></pre>