Ejemplo n.º 1
0
        public void GetWorkflow()
        {
            var workflow = _agency.CreateWorkflow(string.Concat("Workflow Title", Guid.NewGuid()),
                                                  "<?xml version='1.0' encoding='utf-16'?><Sequence xmlns='http://schemas.microsoft.com/netfx/2009/xaml/activities' xmlns:s='clr-namespace:System;assembly=mscorlib' xmlns:scg='clr-namespace:System.Collections.Generic;assembly=mscorlib' xmlns:tidrwa='clr-namespace:TriTech.InformRMS.Domain.Reports.Workflow.Activities;assembly=TriTech.InformRMS.Domain.Reports' xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'><tidrwa:Submit DisplayName='Submit' IsVisible='True' /><tidrwa:Review AllowModify='False' DisplayName='Role' RejectionTarget='ReportingOfficer' RoleSelect='False'><tidrwa:Review.RoleIds><scg:List x:TypeArguments='s:Guid' Capacity='0' /></tidrwa:Review.RoleIds></tidrwa:Review><tidrwa:Notify DisplayName='Notify' EmailMessage='This is a Test' NotificationType='Email'><tidrwa:Notify.RoleIds><scg:List x:TypeArguments='s:Guid' Capacity='0' /></tidrwa:Notify.RoleIds><tidrwa:Notify.UserIds><scg:List x:TypeArguments='s:Guid' Capacity='0' /></tidrwa:Notify.UserIds></tidrwa:Notify></Sequence>");

            _administrationUnitOfWork.Setup(item => item.Find <Workflow>(It.IsAny <Guid>(), It.IsAny <TrackingMode>(), It.IsAny <ThrowIf>())).Returns(workflow);
            var workflowDetails = _workflowQueryService.GetWorkflow(workflow.Id);

            workflowDetails.Should().NotBeNull();
            workflowDetails.AgencyId.Should().Be(workflow.AgencyId);
            workflowDetails.Title.Should().Be(workflow.Title);
            workflowDetails.Activities.Should().HaveCount(3);
        }
Ejemplo n.º 2
0
 public void ClassSetUp()
 {
     _factory  = new MockRepository(MockBehavior.Loose);
     _agency   = DataEntryUnitTestFixture.AgencyDetails;
     _workflow = _agency.CreateWorkflow(string.Concat("Workflow Title", Guid.NewGuid()), null);
     _report   = new ReportDerived(Guid.NewGuid(), _agency.Id, Guid.NewGuid(), Guid.NewGuid(), ModuleType.Incident, false);
     new WorkflowInstanceDerived(_report, _workflow.Id, null);
 }
Ejemplo n.º 3
0
        private void SetUpWorkflow()
        {
            var workflowList = new List <Workflow>();

            _workflow = _agency.CreateWorkflow(string.Concat("Report Workflow", Guid.NewGuid()), null);
            workflowList.Add(_workflow);
            _administrationUnitOfWork.Setup(mock => mock.GetEntityQuery <Workflow>(TrackingMode.Automatic)).Returns(workflowList.AsQueryable());
            SetUpWorkflowInstance();
        }
Ejemplo n.º 4
0
        private void SetUpTemplate()
        {
            _template = _agency.CreateTemplate(It.IsAny <Guid>(), ModuleType.Citation, "Testing Template");
            var workflow = _agency.CreateWorkflow("Template Default Worlflow", null);

            _template.SetWorkflow(workflow);
            _administrationUnitOfWork.Setup(item => item.Find <Template>(It.IsAny <Guid>(), It.IsAny <TrackingMode>(), It.IsAny <ThrowIf>()))
            .Returns(_template);
        }
Ejemplo n.º 5
0
        private void SetUpReport()
        {
            var reportList = new List <Report>();

            _report = new ReportDerived(_identity.Id, QueueUnitTestFixture.AgencyDetails.Id, Guid.NewGuid(), Guid.NewGuid(), ModuleType.Arrest, false);
            var workflow = _agency.CreateWorkflow("Report Workflow", null);

            WorkflowInstanceFactory.Create(_report, workflow.Id, new Sequence());
            reportList.Add(_report);
            _reportsUnitOfWork.Setup(mock => mock.GetEntityQuery <Report>(It.IsAny <TrackingMode>()))
            .Returns(reportList.AsQueryable);
        }
Ejemplo n.º 6
0
        private void TemplateSetUp()
        {
            var templateList = new List <Template>();
            var template     = _agency.CreateTemplate(Guid.NewGuid(), ModuleType.Arrest, "Default Arrest Template");

            template.AssignRole(_role);
            var workflow = _agency.CreateWorkflow("Workflow Title", null);

            template.SetWorkflow(workflow);
            template.MakeActive();
            templateList.Add(template);
            _administrationUnitOfWork.Setup(item => item.GetEntityQuery <Template>(TrackingMode.Automatic))
            .Returns(templateList.AsQueryable);
        }
Ejemplo n.º 7
0
        public void ClassSetUp()
        {
            _factory = new MockRepository(MockBehavior.Loose);

            _identityId = Guid.NewGuid();
            var identityContext = new IdentityContext()
            {
                IdentityId = Guid.NewGuid(), RoleIds = new List <Guid> {
                    Guid.NewGuid(), Guid.NewGuid()
                }
            };

            _authorizationPolicy = new Mock <IServiceAuthorizationPolicy>();
            _identityProvider    = new Mock <IServiceIdentityProvider>();
            _identityProvider.Setup(x => x.GetPrincipalIdentifier()).Returns(identityContext.IdentityId);
            _identityProvider.Setup(x => x.GetIdentityContext()).Returns(identityContext);

            _agency   = DataEntryUnitTestFixture.AgencyDetails;
            _workflow = _agency.CreateWorkflow("Workflow Title", null);
            _case     = new Domain.Summaries.Case.Case(Guid.NewGuid(), DataEntryUnitTestFixture.AgencyDetails.Id, CaseNumber);
        }
Ejemplo n.º 8
0
        public void ClassSetUp()
        {
            _identityId = Guid.NewGuid();
            var identityContext = new IdentityContext()
            {
                IdentityId = Guid.NewGuid()
            };

            _authorizationPolicy = new Mock <IServiceAuthorizationPolicy>();
            _authorizationPolicy.Setup(mock => mock.RequireViewPermissions(It.IsAny <IdentityContext>(), It.IsAny <Guid>(), It.IsAny <ModuleType>()));
            _identityProvider = new Mock <IServiceIdentityProvider>();
            _identityProvider.Setup(x => x.GetPrincipalIdentifier()).Returns(identityContext.IdentityId);
            _identityProvider.Setup(x => x.GetIdentityContext()).Returns(identityContext);

            _agency   = DataEntryUnitTestFixture.AgencyDetails;
            _workflow = _agency.CreateWorkflow(string.Concat("Workflow Title", Guid.NewGuid()),
                                               "<?xml version='1.0' encoding='utf-16'?><Sequence xmlns='http://schemas.microsoft.com/netfx/2009/xaml/activities' xmlns:s='clr-namespace:System;assembly=mscorlib' xmlns:scg='clr-namespace:System.Collections.Generic;assembly=mscorlib' xmlns:tidrwa='clr-namespace:TriTech.InformRMS.Domain.Reports.Workflow.Activities;assembly=TriTech.InformRMS.Domain.Reports' xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'><tidrwa:Submit DisplayName='Submit' IsVisible='True' /><tidrwa:Review AllowModify='False' DisplayName='Role' RejectionTarget='ReportingOfficer' RoleSelect='False'><tidrwa:Review.RoleIds><scg:List x:TypeArguments='s:Guid' Capacity='0' /></tidrwa:Review.RoleIds></tidrwa:Review><tidrwa:Notify DisplayName='Notify' EmailMessage='This is a Test' NotificationType='Email'><tidrwa:Notify.RoleIds><scg:List x:TypeArguments='s:Guid' Capacity='0' /></tidrwa:Notify.RoleIds><tidrwa:Notify.UserIds><scg:List x:TypeArguments='s:Guid' Capacity='0' /></tidrwa:Notify.UserIds></tidrwa:Notify></Sequence>");
            _template = _agency.CreateTemplate(DataEntryUnitTestFixture.IdentityId, ModuleType.Arrest, "Arrest Default Template");
            _template.SetWorkflow(_workflow);

            _factory           = new MockRepository(MockBehavior.Loose);
            _reportsUnitOfWork = _factory.Create <IReportsUnitOfWork>();
            _templateProvider  = _factory.Create <ITemplateProvider>();
            ////_eventDispatcher = _factory.Create<IEventDispatcher>();

            _messageBusClient = _factory.Create <IMessageBusPublishClient>();

            ////_eventDispatcher.Setup( mock => mock.Publish( It.IsAny<object>() ) );
            //MessageBus.SetInstance( //_eventDispatcher.Object, _messageBusClient.Object);

            _arrestReport = new ArrestReport(DataEntryUnitTestFixture.IdentityId, _agency.Id, Guid.NewGuid(), Guid.NewGuid(), false);
            _reportsUnitOfWork.Setup(mock => mock.Find <ArrestReport>(It.IsAny <Guid>(), It.IsAny <TrackingMode>(), It.IsAny <ThrowIf>())).Returns(_arrestReport);
            _reportsUnitOfWork.Setup(mock => mock.Find <Report>(It.IsAny <Guid>(), It.IsAny <TrackingMode>(), It.IsAny <ThrowIf>())).Returns(_arrestReport);
            _reportsUnitOfWork.Setup(x => x.PendingMessages).Returns(new System.Collections.Generic.List <TriTech.InformRMS.Infrastructure.Messaging.Contracts.Messages.Message>());
            _arrestReportCommandService = new ArrestReportCommandService(_reportsUnitOfWork.Object, Mock.Of <IWorkflowInstanceService>(), _templateProvider.Object,
                                                                         Mock.Of <ILog>(), _authorizationPolicy.Object, _identityProvider.Object);
        }