Tuesday, August 16, 2011

faking a FormCollection for testing seems easy enough

using System.Web.Mvc;

using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace AMD.Avalanche.Web.UI.Tests.Model

{

   [TestClass]

   public class Foo

   {

      [TestMethod]

      public void Bar()

      {

         FormCollection formCollection = new FormCollection();

         formCollection["FilterTimeRange"] = "FilterTimeRange";

         string somethingBackFromTheFormCollection = formCollection["FilterTimeRange"];

         Assert.AreEqual(somethingBackFromTheFormCollection, "FilterTimeRange");

      }

   }

}

No comments:

Post a Comment