title: Unit Testing a RedirectToAction with parameter
body: <p>I have an MVC Controller Class that I am trying to Unit Test.</p>
  
  <p>The particular ActionResult is like this</p>
  
  <pre><code>public ActionResult Create(Shipment newShipment)
  {
     do some stuff to create a shipmentID
  ...
     return RedirectToAction("AddUnit",newShipment.ShipmentID);
  }
  </code></pre>
  
  <p>I have mocked up the controller context etc and now I want to test that the newShipment.ShipmentID passed to the RedirectToAction call is what I expect.</p>
  
  <p>I have a test (with lots of mocking of things in the setup phase)</p>
  
  <pre><code>    [Test]
      public void CreateSuccess()
      {
          //Arrange
          var shipment = new Shipment();
          shipment.Widgets = 2; //Make sure it a valid shipment otherwise
          //Act
          var result = controller.Create(shipment) as RedirectToRouteResult;
          //Assert
          Assert.IsNotNull(result);
          Assert.AreEqual("AddUnits", result.RouteValues["action"]);
          Assert.IsNull(result.RouteValues["controller"]);
          ...
  </code></pre>
  
  <p>And now I want to find an Assert to check that the shipmentID I pass to RedirectToAction is the right one.  How do I retrieve its value?</p>
  
  <p>(I believe this code works for real (ie the actual view gets the correct shipmentID) but I want to write  a unit test ).</p>