[TestMethod, Ignore] //Not sure how to fake it out public void TestRecentActivityReturnsPartialView1() { #region Arrange Controller.ControllerContext.HttpContext = new MockHttpContext(0, new[] { "" }, "Me"); var orderTrackingHistory = new List <OrderTrackingHistory>(); for (int i = 0; i < 5; i++) { orderTrackingHistory.Add(CreateValidEntities.OrderTrackingHistory(i + 1)); orderTrackingHistory[i].AccessUserId = "Me"; orderTrackingHistory[i].DateCreated = DateTime.UtcNow.ToPacificTime().Date; } orderTrackingHistory[3].DateCreated = DateTime.UtcNow.ToPacificTime().AddDays(3); orderTrackingHistory[4].DateCreated = DateTime.UtcNow.ToPacificTime().AddDays(3); orderTrackingHistory[4].AccessUserId = "NotMe"; new FakeOrderTrackingHistory(0, QueryRepositoryFactory.OrderTrackingHistoryRepository, orderTrackingHistory); #endregion Arrange #region Act var results = Controller.RecentActivity() .AssertPartialViewRendered() .WithViewData <OrderTrackingHistory>(); #endregion Act #region Assert Assert.IsNotNull(results); Assert.AreEqual("CreatedBy4", results.CreatedBy); #endregion Assert }