Exemple #1
0
        public void GetAppUserById()
        {
            IAppUserService service  = new AppUserService();
            const int       userId   = 0;
            const string    userName = "******"; //Hardcoded user in DB //todo replace with a mock

            Assert.Equal(userName, service.GetAppUserName(userId));
        }
Exemple #2
0
        public void CreateAppUser()
        {
            IAppUserService service  = new AppUserService();
            const string    userName = "******";

            bool creationBool = service.CreateAppUser(userName, Password, Salt);
            int  userId       = service.GetAppUserId(userName);

            Assert.True(creationBool);
            Assert.Equal(userName, service.GetAppUserName(userId));

            //clean up todo delete when mock is working
            service.DeleteAppUser(userId);
        }
Exemple #3
0
        public void UpdateAppUserNameValidUser()
        {
            IAppUserService service     = new AppUserService();
            const string    userNameOne = "Ms. donald docker";
            const string    userNameTwo = "Ms. donald ducker";

            bool creationBool = service.CreateAppUser(userNameOne, Password, Salt);
            int  userIdOne    = service.GetAppUserId(userNameOne);
            bool updateBool   = service.UpdateAppUserName(userNameOne, userNameTwo);
            int  userIdTwo    = service.GetAppUserId(userNameTwo);

            Assert.True(creationBool);
            Assert.True(updateBool);

            Assert.Equal(userIdOne, userIdTwo);

            Assert.NotEqual(userNameOne, service.GetAppUserName(userIdOne));
            Assert.Equal(userNameTwo, service.GetAppUserName(userIdOne));

            //clean up todo delete when mock is working
            service.DeleteAppUser(userIdOne);
            service.DeleteAppUser(userIdTwo);
        }