Esempio n. 1
0
        public void TestDeleteWorkflow()
        {
            var candidate = new Candidate {
                Id = Guid.NewGuid(), Status = CandidateStatus.AvailableNow
            };

            _candidatesCommand.CreateCandidate(candidate);

            var workflowId = Guid.NewGuid();

            _candidatesWorkflowCommand.AddStatusWorkflow(candidate.Id, workflowId);
            _candidatesWorkflowCommand.DeleteStatusWorkflow(candidate.Id);

            Assert.IsNull(_candidatesWorkflowCommand.GetStatusWorkflowId(candidate.Id));
            var without = _candidatesWorkflowQuery.GetCandidatesWithoutStatusWorkflow();

            Assert.AreEqual(1, without.Count);
            Assert.AreEqual(candidate.Id, without[0].Item1);
            Assert.AreEqual(candidate.Status, without[0].Item2);
        }
Esempio n. 2
0
        void IDataExchange.CompleteWorkflow(Guid candidateId)
        {
            #region Log
            const string method = "CompleteWorkflow";
            EventSource.Raise(Event.Flow, method, Event.Arg("candidateId", candidateId));
            #endregion

            try
            {
                _candidatesWorkflowCommand.DeleteStatusWorkflow(candidateId);
            }
            catch (Exception e)
            {
                #region Log
                EventSource.Raise(Event.Error, method, e, null, Event.Arg("candidateId", candidateId));
                #endregion
                throw;
            }
        }
Esempio n. 3
0
        void IService.DeleteWorkflow(Guid candidateId)
        {
            #region Log
            const string method = "DeleteWorkflow";
            EventSource.Raise(Event.FlowEnter, method, Event.Arg("candidateId", candidateId));
            #endregion

            try
            {
                lock (GetLock(candidateId))
                {
                    var workflowId = _candidatesWorkflowCommand.GetStatusWorkflowId(candidateId);
                    if (workflowId.HasValue)
                    {
                        // Create new workflow instance.

                        DeleteWorkflow(workflowId.Value);

                        // Record workflow instance in LinkMe database.

                        _candidatesWorkflowCommand.DeleteStatusWorkflow(candidateId);
                    }
                }
            }
            catch (Exception e)
            {
                #region Log
                EventSource.Raise(Event.Error, method, e, null, Event.Arg("candidateId", candidateId));
                #endregion
                throw;
            }

            #region Log
            EventSource.Raise(Event.FlowExit, method, Event.Arg("candidateId", candidateId));
            #endregion
        }