コード例 #1
0
ファイル: UserServiceUT.cs プロジェクト: bbare/SSO
        public void Create_User_Success()
        {
            // Arrange
            newUser = tu.CreateUserObject();
            var expected = newUser;

            using (_db = tu.CreateDataBaseContext())
            {
                // Act
                var response = us.CreateUser(_db, newUser);
                _db.SaveChanges();

                //Assert
                Assert.IsNotNull(response);
                Assert.AreSame(response, expected);
            }
        }
コード例 #2
0
ファイル: ResetPasswordUT.cs プロジェクト: bbare/SSO
        public void CreatePasswordReset_Pass()
        {
            //Arrange
            var newUser = tu.CreateUserObject();

            newPasswordReset = tu.CreatePasswordResetObject(newUser);
            var expected = newPasswordReset;

            //Act
            using (_db = tu.CreateDataBaseContext())
            {
                var response = rs.CreatePasswordReset(_db, newPasswordReset);
                _db.SaveChanges();

                //Assert
                Assert.IsNotNull(response);
                Assert.AreEqual(response.ResetToken, expected.ResetToken);
            }
        }
コード例 #3
0
ファイル: UserServiceUT.cs プロジェクト: cf2080/SSO
        public void Create_User_Success()
        {
            // Arrange
            User newUser  = tu.CreateUserObject();
            User expected = newUser;

            using (var _db = tu.CreateDataBaseContext())
            {
                // Act
                UserService _us      = new UserService(_db);
                User        response = _us.CreateUser(newUser);
                _db.SaveChanges();

                //Assert
                Assert.IsNotNull(response);
                Assert.AreSame(response, expected);
            }
        }
コード例 #4
0
        public void Create_Session_Success()
        {
            // Arrange
            newUser    = tu.CreateUserObject();
            newSession = tu.CreateSessionObject(newUser);
            var expected = newSession;

            using (_db = tu.CreateDataBaseContext())
            {
                // Act
                var response = ss.CreateSession(_db, newSession);
                _db.SaveChanges();

                //Assert
                Assert.IsNotNull(response);
                Assert.AreEqual(response.Id, expected.Id);
            }
        }
コード例 #5
0
ファイル: ApiKeyServiceUT.cs プロジェクト: cf2080/SSO
        public void CreateKey_Pass_ReturnKey()
        {
            // Arrange
            newKey = tu.CreateApiKeyObject();
            var expected = newKey;

            using (_db = tu.CreateDataBaseContext())
            {
                IApiKeyService      _apiKeyService      = new ApiKeyService(_db);
                IApplicationService _applicationService = new ApplicationService(_db);

                // Act
                var response = _apiKeyService.CreateKey(newKey);
                _db.SaveChanges();

                // Assert
                Assert.IsNotNull(response);
                Assert.AreEqual(response.Id, expected.Id);

                _applicationService.DeleteApplication(newKey.ApplicationId);
                _db.SaveChanges();
            }
        }
コード例 #6
0
ファイル: ApplicationServiceUT.cs プロジェクト: cf2080/SSO
        public void CreateApplication_Pass_ReturnApp()
        {
            // Arrange
            newApp = tu.CreateApplicationObject();
            var expected = newApp;

            using (var _db = tu.CreateDataBaseContext())
            {
                IApplicationService _applicationService = new ApplicationService(_db);;

                // Act
                var response = _applicationService.CreateApplication(newApp);
                _db.SaveChanges();

                // Assert
                Assert.IsNotNull(response);
                Assert.AreEqual(response.Id, expected.Id);

                _applicationService.DeleteApplication(response.Id);
                _db.SaveChanges();
            }
        }
コード例 #7
0
        public void CreatePasswordReset_Pass()
        {
            //Arrange
            var newUser = tu.CreateUserObject();

            tu.CreateUserInDb(newUser);
            //Act
            using (_db = tu.CreateDataBaseContext())
            {
                PasswordManager pm       = new PasswordManager(_db);
                var             response = pm.CreatePasswordReset(newUser.Id);
                //Assert
                Assert.IsNotNull(response);
            }
        }
コード例 #8
0
ファイル: LoginManagerUT.cs プロジェクト: cf2080/SSO
        public void LoginCheckUserExists_Success_ReturnTrue()
        {
            // Arrange
            User newUser = tu.CreateUserInDbManager();
            bool result;

            request.email    = newUser.Email;
            request.password = "******";

            using (var _db = tu.CreateDataBaseContext())
            {
                // Act
                result = lm.LoginCheckUserExists(request.email);

                // Assert
                Assert.AreEqual(true, result);
                um.DeleteUser(newUser.Id);
                _db.SaveChanges();
            }
        }