예제 #1
0
        public void Get_WhenUserNotExists_ExpectedResultIsNull()
        {
            //Arrange
            var DALStub = new AdminUserDALStub();

            //Act
            var result = DALStub.Get("tor");

            //Assert
            Assert.IsNull(result);
        }
예제 #2
0
        public void Get_WhenOnExistingUser_ExpectedResultAreEqual()
        {
            //Arrange
            var DALStub = new AdminUserDALStub();
            var initial = new AdminUserModelDAL
            {
                Username       = "******",
                HashedPassword = PasswordHelperTool.PasswordSHA256Hasher("1234")
            };

            //Act
            var result = DALStub.Get("admin");

            //Assert
            Assert.AreEqual(initial.Username, result.Username);
        }
예제 #3
0
        public void Create_WhenAllOK_ExpectedResultTrueAreEqual()
        {
            //Arrange
            var DALStub = new AdminUserDALStub();
            var input   = new AdminUserModelDAL
            {
                Username       = "******",
                HashedPassword = PasswordHelperTool.PasswordSHA256Hasher("password")
            };

            //Act
            bool test   = DALStub.Create(input);
            var  result = DALStub.Get("newadmin");

            //Assert
            Assert.IsTrue(test);
            Assert.AreEqual(input, result);
        }