public void Smoke() { //arrange var users = new Mock<IUsersRepository>(); var path = new Mock<IPathHelper>(); var dashboard = new DashboardController(users.Object, path.Object); //act/post Assert.That(dashboard, Is.Not.Null); }
public void Index_Get_Initialize_Api_Token() { // arrange var users = new Mock<IUsersRepository>(); var path = new Mock<IPathHelper>(); var dashboard = new DashboardController(users.Object, path.Object); users.Setup(u => u.Users).Returns((new List<User> { new User { Id = 100, Email = "*****@*****.**", ApiToken = "111222" } }).AsQueryable()); // act var result = dashboard.Index("*****@*****.**") as ViewResult; // post Assert.That(result.ViewData["ApiToken"], Is.EqualTo("111222")); }
public void Index_Get_Initialize_Api_Path() { // arrange var users = new Mock<IUsersRepository>(); var path = new Mock<IPathHelper>(); var dashboard = new DashboardController(users.Object, path.Object); users.Setup(u => u.Users).Returns((new List<User> { new User { Id = 100, Email = "*****@*****.**" } }).AsQueryable()); path.Setup(p => p.VirtualToAbsolute(It.IsAny<string>())).Returns((string v) => v); //act var result = dashboard.Index("*****@*****.**") as ViewResult; //post Assert.That(result.ViewData["Api"], Is.EqualTo("~/API/v1.1/")); }