示例#1
0
        public void Approve_JobIdNotSupplied_ArgumentExceptionThrown()
        {
            var id         = Guid.Empty;
            var customerId = Guid.NewGuid();
            var typeId     = Guid.NewGuid();

            var jobRepository = MockRepository.GenerateMock <IJobRepository>();

            _jobService = JobServiceFactory.CreateForApproval(jobRepository, id, typeId, customerId,
                                                              TestUserContext.Create("*****@*****.**", "Test User", "Operations Manager", UserRole.JobApprover));
            ApproveJob(id);
        }
示例#2
0
        public void Approve_UserHasInsufficientSecurityClearance_DomainValidationExceptionThrown()
        {
            var id         = Guid.NewGuid();
            var customerId = Guid.NewGuid();
            var typeId     = Guid.NewGuid();

            var jobRepository = MockRepository.GenerateMock <IJobRepository>();

            _jobService = JobServiceFactory.CreateForApproval(jobRepository, id, typeId, customerId,
                                                              TestUserContext.Create("*****@*****.**", "Test User", "Operations Manager", UserRole.Member));
            ApproveJob(id);
            Assert.IsTrue(_domainValidationException.ResultContainsMessage(JobSystem.Resources.Jobs.Messages.InsufficientSecurityClearance));
        }
示例#3
0
        public void Approve_JobHasNoItems_DomainValidationExceptionThrown()
        {
            var id         = Guid.NewGuid();
            var customerId = Guid.NewGuid();
            var typeId     = Guid.NewGuid();

            var jobRepository = MockRepository.GenerateStub <IJobRepository>();

            jobRepository.Stub(x => x.GetJobItemCount(id)).Return(0);
            _jobService = JobServiceFactory.CreateForApproval(jobRepository, id, typeId, customerId,
                                                              TestUserContext.Create("*****@*****.**", "Test User", "Operations Manager", UserRole.JobApprover));
            ApproveJob(id);
            Assert.IsTrue(_domainValidationException.ResultContainsMessage(JobSystem.Resources.Jobs.Messages.ApprovingJobHasNoItems));
        }
示例#4
0
        public void Approve_UserHasSufficientSecurityClearance_JobSuccessfullyApproved()
        {
            var id         = Guid.NewGuid();
            var customerId = Guid.NewGuid();
            var typeId     = Guid.NewGuid();

            var jobRepository = MockRepository.GenerateMock <IJobRepository>();

            jobRepository.Stub(x => x.GetJobItemCount(id)).Return(1);
            jobRepository.Expect(x => x.Update(null)).IgnoreArguments();
            _jobService = JobServiceFactory.CreateForApproval(jobRepository, id, typeId, customerId,
                                                              TestUserContext.Create("*****@*****.**", "Test User", "Operations Manager", UserRole.JobApprover));
            ApproveJob(id);
            jobRepository.VerifyAllExpectations();
            Assert.That(!_savedJob.IsPending);
        }