Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
        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);
        }
Exemplo n.º 5
0
        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);
        }
Exemplo n.º 6
0
        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);
        }