public void AddUserToProject_ProjectNotFoundThrowsException()
 {
     var pm = new ProjectManager { DocumentStore = _embeddedDocStore };
     var notExistingProjectName = "notExistingProject";
     string exceptionMessage = string.Format("Could not find Project {0}.", notExistingProjectName);
     Assert.That(() => pm.AddUserToProject(notExistingProjectName, _newActiveUser.Username, _existingUser.Username), Throws.ArgumentException.With.Message.EqualTo(exceptionMessage));
 }
 public void AddNonExistentUserToProjectThrowsException()
 {
     var pm = new ProjectManager { DocumentStore = _embeddedDocStore };
     const string userToAdd = "doesntexist";
     var exceptionMessage = string.Format("Could not find UserAccount {0}.", userToAdd);
     Assert.That(() => pm.AddUserToProject(_existingProject.Name, userToAdd, _existingUser.Username), Throws.ArgumentException.With.Message.EqualTo(exceptionMessage));
 }
 public void AddUserToProjectSuccess()
 {
     var pm = new ProjectManager { DocumentStore = _embeddedDocStore };
     pm.AddUserToProject(_existingProject.Name, _newActiveUser.Username, _existingUser.Username);
     var session = _embeddedDocStore.OpenSession();
     var updatedProject = session.Query<Project>().Where(p => p.Name == _existingProject.Name).First();
     Assert.IsTrue(updatedProject.Users.Contains(_newActiveUser.Username));
 }
 public void AddUserToProjectAlreadyExistingSuccess()
 {
     var pm = new ProjectManager { Session = _embeddedDocStore.OpenSession() };
     pm.AddUserToProject(_existingProjectWithExtraUser.Name, _existingUserAlreadyAddedToProject.Username, _existingUser.Username);
     var session = _embeddedDocStore.OpenSession();
     var updatedProject = session.Query<Project>().Where(p => p.Name == _existingProjectWithExtraUser.Name).First();
     Assert.IsTrue(updatedProject.Users.Contains(_existingUserAlreadyAddedToProject.Username));
 }
 public void AddUserToProjectActingUserNotInProjectThrowsException()
 {
     var pm = new ProjectManager { DocumentStore = _embeddedDocStore };
     string exceptionMessage = string.Format("{0} is not authorised to add new users to Project {1}.", _notInProjectUser.Username, _existingProject.Name);
     Assert.That(() => pm.AddUserToProject(_existingProject.Name, _newActiveUser.Username, _notInProjectUser.Username), Throws.ArgumentException.With.Message.EqualTo(exceptionMessage));
 }
 public void AddInactiveUserToProjectThrowsException()
 {
     var pm = new ProjectManager { DocumentStore = _embeddedDocStore };
     var exceptionMessage = string.Format("{0} is not currently an active user, please reactivate and try again", _newInactiveUser.Username);
     Assert.That(() => pm.AddUserToProject(_existingProject.Name, _newInactiveUser.Username, _existingUser.Username), Throws.ArgumentException.With.Message.EqualTo(exceptionMessage));
 }