public async Task TestForUserAuthenticationinServiceLayer() { ServiceLayer.DataContract.User user = new ServiceLayer.DataContract.User() { Email = "dverma", Password = "******" }; User Buser = new User() { Email = "dverma", Password = "******" }; Mock <IUserAuthenticationManager> manager = new Mock <IUserAuthenticationManager>(); manager.Setup(x => x.AuthenticateUser(It.IsAny <User>())).Returns(true); UserAuthenticationService service = new UserAuthenticationService(manager.Object); var expectedOutput = service.AuthenticateUser(user); Assert.IsTrue(expectedOutput); }
public void TestForChangePassword() { ServiceLayer.DataContract.User user = new ServiceLayer.DataContract.User() { Email = "dverma", Password = "******" }; User Buser = new User() { Email = "dverma", Password = "******" }; Mock <IUserAuthenticationManager> manager = new Mock <IUserAuthenticationManager>(); manager.Setup(x => x.ChangePassword(Buser, "abcdefgh")).Returns(true); UserAuthenticationService service = new UserAuthenticationService(manager.Object); var expectedOutput = service.ChangePassword(user, "abcdefgh"); Assert.IsTrue(expectedOutput); }