public void OpenToMapTransition() { _roles = new List <string> { "User" }; MyTestInitialize(); _workflow = Wrapper(); _workflow.Move(ProjectWorkflow.Trigger.FillInformation); Assert.IsTrue(_repository.GetOne <Project>(p => p._id == _currentProject._id).WorkflowState.CurrentState == ProjectWorkflow.State.OnMap); }
private ProjectStateManager(Project currentProject, string currentUser, IList <string> roles) { _currentUser = currentUser; _roles = roles; _investorNotificate = new InvestorNotification(); _adminNotificate = new AdminNotification(); _userNotificationl = new UserNotification(); _repository = RepositoryContext.Current; _currentProject = _repository.GetOne <Project>(p => p._id == currentProject._id); _unitsOfWork = new UnitsOfWorkContainer(_currentProject, _repository, _userNotificationl, _adminNotificate, _investorNotificate, _currentUser, _roles); if (_currentProject == null) { _currentProject = currentProject; } if (string.IsNullOrEmpty(_currentProject._id)) { _currentProject._id = ObjectId.GenerateNewId().ToString(); } if (_currentProject.WorkflowState == null) { _currentProject.WorkflowState = new Workflow { CurrentState = ProjectWorkflow.State.Open }; } _workflow = new ProjectWorkflowWrapper(new ProjectWorkflow(_currentProject.WorkflowState.CurrentState), _unitsOfWork); /*var context = new ProjectStateContext * { * UserName = currentUser, * CurrentProject = currentProject, * Roles = roles, * InvestorNotification = _investorNotificate, * UserNotification = _userNotificationl, * AdminNotification = _adminNotificate, * Repository = _repository * }; * var builder = new AttributeStateMachineBuilder(); * _workflow = new ProjectWorkflowWrapper( * new ProjectWorkflow( * builder.BuilStateMachine<ProjectWorkflow.State,ProjectWorkflow.Trigger>("test", context,_currentProject.WorkflowState.CurrentState)));*/ }