public void Testnull() { AutherService AuthersService = new AutherService(Context, LDAPService.Object, RunningNoService.Object, EncryptionService.Object); TokenDTO result = AuthersService.Login("", ""); Assert.AreEqual("Data is null", result.Message); }
public void TestPasswordnull() { AutherService AuthersService = new AutherService(Context, LDAPService.Object, RunningNoService.Object, EncryptionService.Object); TokenDTO ressult = AuthersService.Login("Test", ""); Assert.AreEqual("The username or password is incorrect. Please Try again", ressult.Message); }
public void TestUsernamefail() { EncryptionService.Setup(e => e.HashToMD5(It.IsAny <string>())).Returns("test"); AutherService AuthersService = new AutherService(Context, LDAPService.Object, RunningNoService.Object, EncryptionService.Object); TokenDTO result = AuthersService.Login("asd", "test"); Assert.AreEqual("Data is null", result.Message); }
public void TestPasswordfail() { EncryptionService.Setup(e => e.HashToMD5(It.IsAny <string>())).Returns("sdfsdf"); AutherService AuthersService = new AutherService(Context, LDAPService.Object, RunningNoService.Object, EncryptionService.Object); TokenDTO result = AuthersService.Login("Test", "sdfsdf"); Assert.AreEqual("The username or password is incorrect. Please Try again", result.Message); }
public void TestSuccess() { EncryptionService.Setup(e => e.HashToMD5(It.IsAny <string>())).Returns("05a671c66aefea124cc08b76ea6d30bb"); AutherService AuthersService = new AutherService(Context, LDAPService.Object, RunningNoService.Object, EncryptionService.Object); TokenDTO result = AuthersService.Login("Test", "test"); Assert.AreEqual("Login Success", result.Message); }
public void TestCreatedUser() { RunningNoDTO Running = new RunningNoDTO(); Running.Code = "US00000002"; RunningNoService.Setup(r => r.GenerateRunningNo()).ReturnsAsync(Running); EncryptionService.Setup(e => e.HashToMD5(It.IsAny <string>())).Returns("05a671c66aefea124cc08b76ea6d30bb"); EncryptionService.Setup(e => e.GeneratePasswordSalt()).Returns("sdfsef23e32"); Authentication Authers = new Authentication() { Username = "******", Firstname = "test", Lastname = "test", Email = "*****@*****.**", }; AutherService AuthersService = new AutherService(Context, LDAPService.Object, RunningNoService.Object, EncryptionService.Object); Assert.AreEqual(Running.Code, AuthersService.CreateNewUserAsync(Authers).Result); }