Untitled

mail@pastecode.io avatar
unknown
plain_text
2 months ago
710 B
1
Indexable
Never
 [Test]
        [TestCase("1234","1234@123")]
        public async Task TestException(string Username,string Password){
            var mockrepo = new Mock<IRepo>();
            var Invaild = new Login {AdminId = 3,Username = "1234" , Password = "1234@123" , AdminAccess = false };
            mockrepo.Setup(repo =>repo.ValidateUser(Invaild.Username,Invaild.Password)).Throws(new Exception("error occured"));
            var LoginController = new LoginController(mockrepo.Object);
            var creds = new Logincheck {UserName = Username , Password = Password};
            var error = Assert.Throws<Exception>(() => LoginController.Post(creds));
            Console.WriteLine(error);
        }
Leave a Comment