Пример #1
0
        public void CreateAppUserTwice()
        {
            IAppUserService service  = new AppUserService();
            const string    userName = "******";

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

            Assert.True(creationBoolOne);
            Assert.False(creationBoolTwo);
            Assert.Equal(userName, service.GetAppUserName(userId));

            //clean up todo delete when mock is working
            service.DeleteAppUser(userId);
        }
Пример #2
0
        public void DeleteAppUserByNameTrue()
        {
            IAppUserService service  = new AppUserService();
            const string    userName = "******";

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

            Assert.True(creationBool);
            Assert.True(existBeforeDeletion);
            Assert.True(deletionBool);
            Assert.False(service.AppUserExist(userName));
        }
Пример #3
0
        public void DeleteAppUserByNameFalse()
        {
            IAppUserService service   = new AppUserService();
            const string    userName  = "******";
            const string    falseName = "not docker";

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

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

            //clean up todo delete when mock is working
            service.DeleteAppUser(userName);
        }
Пример #4
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);
        }
Пример #5
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);
        }