public void InfrastructureController_AddPropertyWarningTest() { //Arrange var userService = new Mock <IUserService>(); var adwService = new Mock <IAdwService>(); var target = new TestPagedGridController(userService.Object, adwService.Object); Assert.IsNotNull(target); //Act ActionResult result = target.DisplayPropertyWarning(); //Assert Assert.IsNotNull(result); Assert.IsNotNull(target.TempData); Assert.IsTrue(target.TempData.Count == 1); var td = target.TempData["Warning"]; Assert.IsNotNull(td); var d = ((Dictionary <string, List <string> >)td).First(); Assert.AreEqual("AProperty", d.Key); var t = (((Dictionary <string, List <string> >)(td))).Values; Assert.IsNotNull(t); Assert.IsTrue(t.Count == 1); var w = t.First(); Assert.AreEqual("Unit Test Property Warning Message", w[0]); }