Ejemplo n.º 1
0
        public void TestIndex()
        {
            //Arrange
            dashRepo.Setup(m => m.orgName()).Returns<String>(t => "Student Government");
            dashRepo.Setup(i => i.initialize(1));
            DashboardController x = new DashboardController(dashRepo.Object, authRepo.Object);

            //Act
            ViewResult result = (ViewResult)x.Index("sgfresh",1);
            //Assert
            Assert.AreEqual(result.ViewBag.organizationId, 1);
            Assert.AreEqual(result.ViewBag.organizationName, "Student Government");
        }
Ejemplo n.º 2
0
 public void IndexOutputBadUser()
 {
     //Arrange
     //Arrange
     dashRepo.Setup(m => m.orgName()).Returns(orgName);
     dashRepo.Setup(i => i.initialize(orgid));
     authRepo.Setup(i => i.userCanManageOrg(It.IsAny<string>(), It.IsAny<int>())).Returns((string n, int i) => false);
     siteRepo.Setup(e => e.emailEnding()).Returns("@rit.edu");
     DashboardController x = new DashboardController(dashRepo.Object, authRepo.Object, siteRepo.Object);
     //Act
     RedirectToRouteResult result = (RedirectToRouteResult)x.Index(user, orgid);
     //Assert
     Assert.IsInstanceOfType(typeof(RedirectToRouteResult), result);
 }
Ejemplo n.º 3
0
        public void IndexOutputHappyPath()
        {
            //Arrange
            dashRepo.Setup(m => m.orgName()).Returns(orgName);
            dashRepo.Setup(i => i.initialize(orgid));
            authRepo.Setup(i => i.userCanManageOrg(It.IsAny<string>(), It.IsAny<int>())).Returns((string n, int i) => true);
            siteRepo.Setup(e => e.emailEnding()).Returns("@rit.edu");
            DashboardController x = new DashboardController(dashRepo.Object, authRepo.Object, siteRepo.Object);

            //Act
            ViewResult result = (ViewResult)x.Index(user,1);
            //Assert
            Assert.AreEqual(result.ViewBag.organizationId, orgid.ToString());
            Assert.AreEqual(result.ViewBag.organizationName, "Student Government");
        }