Inheritance: BaseController
Ejemplo n.º 1
0
        public void SearchByLocationAction_Should_Return_Json()
        {
            // Arrange
            var controller = new SearchController(Session, new NhDinnerRepository(Session));
            // Act
            var result = controller.SearchByLocation(99, -99);

            // Assert
            Assert.IsInstanceOf(typeof(JsonResult), result);
        }
        SearchController CreateSearchControllerAs(string userName)
        {
            var mock = new Mock<ControllerContext>();
            var nerdIdentity = FakeIdentity.CreateIdentity(userName);
            mock.SetupGet(p => p.HttpContext.User.Identity).Returns(nerdIdentity);

            var controller = new SearchController(new DinnerRepository(new NerdDinners()));
            controller.ControllerContext = mock.Object;

            return controller;
        }