public void LoginTestFail() { Mock <IConfiguration> config = new Mock <IConfiguration>(); config.Setup(p => p["Jwt:Key"]).Returns("ThisismySecretKey"); var controller = new TokenValidateController(config.Object, usercontextmock.Object); var auth = controller.LoginResult(new User { UserName = "******", Password = "******" }) as OkObjectResult; Assert.IsNull(auth); }
public void LoginTestPass() { Mock <IConfiguration> config = new Mock <IConfiguration>(); config.Setup(p => p["Jwt:Key"]).Returns("ThisismySecretKey"); var controller = new TokenValidateController(config.Object, usercontextmock.Object); var auth = controller.LoginResult(new Usercheck { Id = 1, UserName = "******", Password = "******" }) as OkObjectResult; Assert.AreEqual(200, auth.StatusCode); }