示例#1
0
        public void InfrastructureController_AddPropertySuccessTest()
        {
            //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.DisplayPropertySuccess();

            //Assert
            Assert.IsNotNull(result);
            Assert.IsNotNull(target.TempData);
            Assert.IsTrue(target.TempData.Count == 1);
            var td = target.TempData["Success"];

            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 success", w[0]);
        }