Пример #1
0
        public void GetAppUserByName()
        {
            IAppUserService service  = new AppUserService();
            const int       userId   = 0;
            const string    userName = "******"; //Hardcoded user in DB //todo replace with a mock

            Assert.Equal(userId, service.GetAppUserId(userName));
        }
Пример #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);
        }
Пример #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);
        }
Пример #4
0
        public void DeleteAppUserByIdTrue()
        {
            IAppUserService service  = new AppUserService();
            const string    userName = "******";

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

            Assert.True(creationBool);
            Assert.True(existBeforeDeletion);
            Assert.True(deletionBool);
            Assert.False(service.AppUserExist(userName));
            Assert.False(service.AppUserExist(userId));
        }
Пример #5
0
        public void DeleteAppUserByIdFalse()
        {
            IAppUserService service  = new AppUserService();
            const string    userName = "******";
            const int       falseId  = -2;

            bool creationBool        = service.CreateAppUser(userName, Password, Salt);
            int  userId              = service.GetAppUserId(userName);
            bool existBeforeDeletion = service.AppUserExist(userId);
            bool deletionBool        = service.DeleteAppUser(falseId);

            Assert.True(creationBool);
            Assert.True(existBeforeDeletion);
            Assert.False(deletionBool);
            Assert.True(service.AppUserExist(userName));
            Assert.True(service.AppUserExist(userId));

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