示例#1
0
        public async void IndexTest()
        {
            //Arrange
            var dbContext = MockDb.CreateMockDb();
            var sc        = new VisitorsController(dbContext);
            //Act
            var r = await sc.Index();

            //Assert
            var result = Assert.IsType <ViewResult>(r);
            var model  = Assert.IsAssignableFrom <List <Visitor> >(result.ViewData.Model);

            Assert.Single(model);
        }
    public void DoesReturnViewItem()
    {
        var result = controller.Index() as ViewResult;

        Assert.AreEqual("Index", result.ViewName);
    }