public void GetGraphFromReport()
        {
            var caseList   = new List <Domain.Summaries.Case.Case>();
            var reportList = new List <Report>();

            caseList.Add(_case);
            var report = new ReportDerived(Guid.NewGuid(), _agency.Id, Guid.NewGuid(), Guid.NewGuid(), ModuleType.Incident, false);

            report.CaseNumber = CaseNumber;
            reportList.Add(report);
            _summariesUnitOfWork.Setup(item => item.GetEntityQuery <Domain.Summaries.Case.Case>(TrackingMode.Automatic))
            .Returns(caseList.AsQueryable);

            _reportsUnitOfWork.Setup(
                item => item.Find <Report>(It.IsAny <Guid>(), TrackingMode.Automatic, ThrowIf.Anything))
            .Returns(report);

            _reportsUnitOfWork.Setup(item => item.GetEntityQuery <Report>(TrackingMode.Automatic)).Returns(reportList.AsQueryable);

            var caseNavigationGraph = _caseNavigationService.GetGraphFromReport(_case.Id);

            caseNavigationGraph.Should().NotBeNull();
            caseNavigationGraph.NavigationItems.Count.Should().BeGreaterOrEqualTo(1);
            caseNavigationGraph.Should().BeOfType(typeof(CaseNavigationGraph));
        }
        public void ClassSetUp()
        {
            _factory = new MockRepository(MockBehavior.Loose);

            _reportsUnitOfWork       = _factory.Create <IReportsUnitOfWork>();
            _summariesUnitOfWork     = _factory.Create <ISummariesUnitOfWork>();
            _classicImagesRepository = _factory.Create <IClassicImagesRepository>();
            _reportDerived           = new ReportDerived(Guid.NewGuid(), Guid.NewGuid(), Guid.NewGuid(), Guid.NewGuid(), ModuleType.Incident, true);
            _case                       = new Domain.Summaries.Case.Case(Guid.NewGuid(), Guid.NewGuid(), "number");
            _summaryDerived             = new SummaryDerived(Guid.NewGuid(), Guid.NewGuid(), Guid.NewGuid(), ModuleType.Incident, "number", _case);
            _reportAttachment           = new ReportAttachment(Guid.NewGuid(), Guid.NewGuid(), Guid.NewGuid());
            _reportAttachment.FileName  = FileName;
            _reportAttachment.Source    = "InformRMSWeb";
            _summaryAttachment          = new SummaryAttachment(Guid.NewGuid(), Guid.NewGuid(), Guid.NewGuid());
            _summaryAttachment.FileName = FileName;
            _summaryAttachment.Source   = "InformRMSWeb";
            _reportsUnitOfWork.Setup(mock => mock.Find <ReportAttachment>(It.IsAny <Guid>(), It.IsAny <TrackingMode>(), It.IsAny <ThrowIf>()))
            .Returns(_reportAttachment);

            _reportsUnitOfWork.Setup(mock => mock.Find <Report>(It.IsAny <Guid>(), It.IsAny <TrackingMode>(), It.IsAny <ThrowIf>()))
            .Returns(_reportDerived);
            _summariesUnitOfWork.Setup(mock => mock.Find <Summary>(It.IsAny <Guid>(), It.IsAny <TrackingMode>(), It.IsAny <ThrowIf>()))
            .Returns(_summaryDerived);
            _summariesUnitOfWork.Setup(mock => mock.Find <SummaryAttachment>(It.IsAny <Guid>(), It.IsAny <TrackingMode>(), It.IsAny <ThrowIf>()))
            .Returns(_summaryAttachment);
            _attachmentQueryService = new AttachmentQueryService(_reportsUnitOfWork.Object, _summariesUnitOfWork.Object, _classicImagesRepository.Object, Mock.Of <ILog>(),
                                                                 Mock.Of <IServiceAuthorizationPolicy>(), Mock.Of <IServiceIdentityProvider>());
        }
Beispiel #3
0
        private void SetUpReport()
        {
            _reportsUnitOfWork = _factory.Create <IReportsUnitOfWork>();
            _report            = new ReportDerived(DataEntryUnitTestFixture.IdentityId, DataEntryUnitTestFixture.AgencyDetails.Id, Guid.NewGuid(), Guid.NewGuid(), ModuleType.Arrest, false);
            new WorkflowInstanceDerived(_report, Guid.NewGuid(), null);
            _report.CaseNumber = "AAA";
            _report.Number     = "BBB";
            _reportsUnitOfWork.Setup(mock => mock.Find <Report>(It.IsAny <Guid>(), It.IsAny <TrackingMode>(), It.IsAny <ThrowIf>())).Returns(_report);

            var duplicateReport = new ReportDerived(Guid.NewGuid(), DataEntryUnitTestFixture.AgencyDetails.Id, Guid.NewGuid(), Guid.NewGuid(), ModuleType.Arrest, false)
            {
                CaseNumber = _report.CaseNumber,
                Number     = _report.Number
            };

            new WorkflowInstanceDerived(duplicateReport, Guid.NewGuid(), null);

            var reportList = new List <Report>()
            {
                _report,
                duplicateReport
            };

            _reportsUnitOfWork.Setup(mock => mock.GetEntityQuery <Report>(It.IsAny <TrackingMode>())).Returns(reportList.AsQueryable);
        }
 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);
 }
        private void SetUpReport()
        {
            var report = new ReportDerived(Guid.NewGuid(), _agency.Id, Guid.NewGuid(), Guid.NewGuid(), ModuleType.Incident, false);

            _reportId         = report.Id;
            _workflowInstance = WorkflowInstanceFactory.Create(report, _workflow.Id, new Sequence());
            _workflowInstance.DurableInstanceId = Guid.NewGuid();
        }
Beispiel #6
0
 public void ClassSetUp()
 {
     _factory           = new MockRepository(MockBehavior.Loose);
     _reportsUnitOfWork = _factory.Create <IReportsUnitOfWork>();
     _report            = new ReportDerived(DataEntryUnitTestFixture.IdentityId, DataEntryUnitTestFixture.AgencyDetails.Id, Guid.NewGuid(), Guid.NewGuid(), ModuleType.Arrest, false);
     _reportComment     = _report.AddComment(DataEntryUnitTestFixture.IdentityId, "User", "Description");
     _reportsUnitOfWork.Setup(mock => mock.FindAndInclude <Report>(It.IsAny <Guid>(), It.IsAny <TrackingMode>(), It.IsAny <ThrowIf>())).Returns(_report);
     _reportCommentQueryService = new ReportCommentQueryService(_reportsUnitOfWork.Object, Mock.Of <ILog>(), Mock.Of <IServiceAuthorizationPolicy>(), Mock.Of <IServiceIdentityProvider>());
 }
Beispiel #7
0
        private void SetUpReport()
        {
            var reportList = new List <Report>();

            _report        = new ReportDerived(DataEntryUnitTestFixture.IdentityId, DataEntryUnitTestFixture.AgencyDetails.Id, Guid.NewGuid(), Guid.NewGuid(), ModuleType.Incident, false);
            _report.Number = Number;
            reportList.Add(_report);
            _reportsUnitOfWork.Setup(mock => mock.GetEntityQuery <Report>(It.IsAny <TrackingMode>())).Returns(reportList.AsQueryable);
        }
Beispiel #8
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);
        }
        public void Process_SetNextNumberToReport()
        {
            const string NextNumber = "567";

            _numberProvider.Setup(mock => mock.GetNextNumber(It.IsAny <Guid>(), It.IsAny <ModuleType>()))
            .Returns(NextNumber);
            var report = new ReportDerived(Guid.NewGuid(), _agency.Id, Guid.NewGuid(), Guid.NewGuid(), ModuleType.Incident, false);
            var isNumberControlProcessor = _numberControlProcessor.Process(report);

            isNumberControlProcessor.Should().BeTrue();
            NextNumber.Should().BeSameAs(report.CaseNumber);
        }
Beispiel #10
0
        public void CreateAttachmentFile_1()
        {
            MemoryStream memoryStream = null;

            _documentService = new Mock <IDocumentService>();
            var createAttachment = new SSRSEmailAttachment(_documentService.Object);

            _documentService.Setup(mock => mock.RenderReport(It.IsAny <Report>(), It.IsAny <AttachmentType>(), It.IsAny <string>())).Returns(memoryStream);
            _report = new ReportDerived(ReportUnitTestFixture.IdentityId, Guid.NewGuid(), Guid.NewGuid(), Guid.NewGuid(), ModuleType.Arrest, false);
            var result = createAttachment.CreateAttachmentFile(_report, "string", AttachmentType.DOCX, It.IsAny <string>());

            result.Should().BeNull();
        }
Beispiel #11
0
        private void SetUpWorkflowInstance()
        {
            _report = new ReportDerived(_identityId, QueueUnitTestFixture.AgencyDetails.Id, Guid.NewGuid(), Guid.NewGuid(), ModuleType.Arrest, false);
            var workflowInstance = WorkflowInstanceFactory.Create(_report, _workflow.Id, new Sequence());

            _report.WorkflowInstance.ReportState = ReportState.InProgress;
            _report.WorkflowInstance.Sequence    = 1;
            var workflowInstanceLog = new WorkflowInstanceLog(workflowInstance, _identityId);

            workflowInstance.WorkflowInstanceLogs.Add(workflowInstanceLog);
            _reportsUnitOfWork.Setup(mock => mock.FindAndInclude <WorkflowInstance>(It.IsAny <Guid>(), TrackingMode.Automatic, ThrowIf.NotFound, instance => instance.WorkflowInstanceLogs, instance => instance.WorkflowInstanceUsers, instance => instance.WorkflowInstanceRoles))
            .Returns(workflowInstance);
        }
        private void SetUpReport()
        {
            _report = new ReportDerived(DataEntryUnitTestFixture.IdentityId, DataEntryUnitTestFixture.AgencyDetails.Id, Guid.NewGuid(), Guid.NewGuid(), ModuleType.Arrest,
                                        false);
            _workflowInstance = new WorkflowInstanceDerived(_report, Guid.NewGuid(), null);
            _reportsUnitOfWork.Setup(
                mock => mock.FindAndInclude <Report>(It.IsAny <Guid>(), It.IsAny <TrackingMode>(), It.IsAny <ThrowIf>(), include => include.WorkflowInstance))
            .Returns(_report);
            var reportList = new List <Report>();

            reportList.Add(_report);
            _reportsUnitOfWork.Setup(mock => mock.GetEntityQuery <Report>(It.IsAny <TrackingMode>())).Returns(reportList.AsQueryable());
        }
Beispiel #13
0
        public void MessageHandler()
        {
            SetUpAgencyConfiguration();
            _report = new ReportDerived(DataEntryUnitTestFixture.IdentityId, DataEntryUnitTestFixture.AgencyDetails.Id, Guid.NewGuid(), Guid.NewGuid(), ModuleType.Arrest, false);
            var workflowInstance = new WorkflowInstanceDerived(_report, Guid.NewGuid(), It.IsAny <string>());

            _reportsUnitOfWork.Setup(mock => mock.Find <WorkflowInstance>(It.IsAny <Guid>(), It.IsAny <TrackingMode>(), It.IsAny <ThrowIf>()))
            .Returns(workflowInstance);
            SetUpAttachment();
            var users = new[] { _userId };
            var workflowNotificationMessage = new WorkflowNotificationMessage(Guid.NewGuid(), users, null, "", NotificationType.Attachment);
            //_workflowNotificationService.MessageHandler(workflowNotificationMessage);
        }
Beispiel #14
0
        public void DeleteReportPreview()
        {
            var report = new ReportDerived(Guid.NewGuid(), _agency.Id, Guid.NewGuid(), Guid.NewGuid(), ModuleType.Incident, false);

            report.CaseNumber = CaseNumber;
            new WorkflowInstanceDerived(report, _workflow.Id, null);
            _reportsUnitOfWork.Setup(item => item.Find <Report>(It.IsAny <Guid>(), TrackingMode.Automatic, ThrowIf.Anything))
            .Returns(report);
            var deletedPreview = _deleteService.DeleteReportPreview(_case.Id);

            deletedPreview.Should().NotBeNull();
            deletedPreview.Reports.Should().HaveCount(1);
        }
Beispiel #15
0
        public void DeleteReport()
        {
            var report = new ReportDerived(Guid.NewGuid(), _agency.Id, Guid.NewGuid(), Guid.NewGuid(), ModuleType.Incident, false);

            report.CaseNumber = CaseNumber;
            new WorkflowInstanceDerived(report, _workflow.Id, null);
            _reportsUnitOfWork.Setup(item => item.Find <Report>(It.IsAny <Guid>(), It.IsAny <TrackingMode>(), It.IsAny <ThrowIf>()))
            .Returns(report);
            _reportsUnitOfWork.Setup(mock => mock.PendingMessages).Returns(new List <Message>());
            _deleteService.DeleteReport(_case.Id);
            _summariesUnitOfWork.Verify(mock => mock.Commit(It.IsAny <ConcurrencyMode>()), Times.Once);
            _reportsUnitOfWork.Verify(mock => mock.Commit(It.IsAny <ConcurrencyMode>()), Times.Once);
            _reportsUnitOfWork.Object.PendingMessages.Should().HaveCount(1);
        }
Beispiel #16
0
        public void Process_1()
        {
            _reportsUoW = new Mock <IReportsUnitOfWork>();
            var reportList = new List <Report>();
            var sequenceNotationProcessorObj = new SequenceNotationProcessor(_reportsUoW.Object);

            _report = new ReportDerived(ReportUnitTestFixture.IdentityId, Guid.NewGuid(), Guid.NewGuid(), Guid.NewGuid(), ModuleType.Arrest, false);
            var WorkflowInstance = new WorkflowInstanceDerived(_report, Guid.NewGuid(), "abc");

            _report.WorkflowInstance.ReportState = ReportState.Approved;
            reportList.Add(_report);
            sequenceNotationProcessorObj.Process(_report);
            _report.SequenceNotation.Should().Be(".0");
        }
Beispiel #17
0
        public void WorkflowInstanceLog()
        {
            var identityId = Guid.NewGuid();
            var _report    = new ReportDerived(ReportUnitTestFixture.IdentityId, Guid.NewGuid(), Guid.NewGuid(), Guid.NewGuid(), ModuleType.Arrest, true);

            workflowInstance             = new WorkflowInstanceDerived(_report, Guid.NewGuid(), "data");
            workflowInstance.Sequence    = 1;
            workflowInstance.ReportState = ReportState.Approved;
            workflowInstanceLogObj       = new WorkflowInstanceLog(workflowInstance, identityId);
            workflowInstanceLogObj.Sequence.Should().Be(1);
            workflowInstanceLogObj.ReportState.Should().Be(ReportState.Approved);
            workflowInstanceLogObj.Recorded.Should().BeOnOrBefore(DateTime.Now);
            workflowInstanceLogObj.IdentityId.Should().Be(identityId);
        }
Beispiel #18
0
        public void RenderReport()
        {
            _cache = new Mock <ICacheProvider>();
            Cache.SetInstance(_cache.Object);
            _log = new Mock <ILog>();
            _log.Setup(mock => mock.Debug(It.IsAny <string>()));
            var _report = new ReportDerived(Guid.NewGuid(), Guid.NewGuid(), Guid.NewGuid(), Guid.NewGuid(), ModuleType.Incident, true);

            _report.Number = "123";
            var workflowInstance = new WorkflowInstanceDerived(_report, Guid.NewGuid(), "data");

            _documentService = new DocumentService();
            _documentService.RenderReport(_report, AttachmentType.PDF, It.IsAny <string>());
            _log.VerifyAll();
        }
Beispiel #19
0
        public void AddArrestee()
        {
            List <PublicSafetyPerson> lstPerson = new List <PublicSafetyPerson>();

            ArrestArrestee _person = new ArrestArrestee(Guid.NewGuid(), Guid.NewGuid(), Guid.NewGuid());

            _person.Email = "email";
            lstPerson.Add(_person);
            ReportDerived _report = new ReportDerived(Guid.NewGuid(), Guid.NewGuid(), Guid.NewGuid(), Guid.NewGuid(), ModuleType.Arrest, true);

            _arrestReport.People = lstPerson;
            ArrestArrestee obj = new ArrestArrestee(Guid.NewGuid(), Guid.NewGuid(), Guid.NewGuid());

            _arrestReport.AddArrestee(obj);
        }
Beispiel #20
0
        public void Process()
        {
            _reportsUoW = new Mock <IReportsUnitOfWork>();
            var reportList = new List <Report>();
            var sequenceNotationProcessorObj = new SequenceNotationProcessor(_reportsUoW.Object);

            _report = new ReportDerived(ReportUnitTestFixture.IdentityId, Guid.NewGuid(), Guid.NewGuid(), Guid.NewGuid(), ModuleType.Arrest, true);
            var WorkflowInstance = new WorkflowInstanceDerived(_report, Guid.NewGuid(), "abc");

            _report.Number = "123";
            _report.WorkflowInstance.ReportState = ReportState.Approved;
            reportList.Add(_report);
            _reportsUoW.Setup(mock => mock.GetEntityQuery <Report>(TrackingMode.Automatic)).Returns(reportList.AsQueryable);
            sequenceNotationProcessorObj.Process(_report);
            _report.SequenceNotation.Should().Be(".001");
        }
        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);

            _factory = new MockRepository(MockBehavior.Loose);

            _reportDerived     = new ReportDerived(Guid.NewGuid(), Guid.NewGuid(), Guid.NewGuid(), Guid.NewGuid(), ModuleType.Incident, true);
            _case              = new Domain.Summaries.Case.Case(Guid.NewGuid(), Guid.NewGuid(), "number");
            _summaryDerived    = new SummaryDerived(Guid.NewGuid(), Guid.NewGuid(), Guid.NewGuid(), ModuleType.Incident, "number", _case);
            _reportAttachment  = new ReportAttachment(Guid.NewGuid(), Guid.NewGuid(), Guid.NewGuid());
            _summaryAttachment = new SummaryAttachment(Guid.NewGuid(), Guid.NewGuid(), Guid.NewGuid());
            //_eventDispatcher = _factory.Create<IEventDispatcher>();
            _messageBusClient = _factory.Create <IMessageBusPublishClient>();

            //MessageBus.SetInstance( //_eventDispatcher.Object, _messageBusClient.Object );
            //_eventDispatcher.Setup( mock => mock.Publish( It.IsAny<object>() ) );
            _reportsUnitOfWork   = _factory.Create <IReportsUnitOfWork>();
            _summariesUnitOfWork = _factory.Create <ISummariesUnitOfWork>();

            _reportsUnitOfWork.Setup(mock => mock.Find <ReportAttachment>(It.IsAny <Guid>(), It.IsAny <TrackingMode>(), It.IsAny <ThrowIf>()))
            .Returns(_reportAttachment);
            _reportsUnitOfWork.Setup(mock => mock.Find <Report>(It.IsAny <Guid>(), It.IsAny <TrackingMode>(), It.IsAny <ThrowIf>()))
            .Returns(_reportDerived);
            _summariesUnitOfWork.Setup(mock => mock.Find <SummaryAttachment>(It.IsAny <Guid>(), It.IsAny <TrackingMode>(), It.IsAny <ThrowIf>()))
            .Returns(_summaryAttachment);
            _summariesUnitOfWork.Setup(mock => mock.Find <Summary>(It.IsAny <Guid>(), It.IsAny <TrackingMode>(), It.IsAny <ThrowIf>()))
            .Returns(_summaryDerived);

            _reportsUnitOfWork.Setup(x => x.PendingMessages).Returns(new System.Collections.Generic.List <TriTech.InformRMS.Infrastructure.Messaging.Contracts.Messages.Message>());
            _summariesUnitOfWork.Setup(x => x.PendingMessages).Returns(new System.Collections.Generic.List <TriTech.InformRMS.Infrastructure.Messaging.Contracts.Messages.Message>());

            _attachmentCommandService = new AttachmentCommandService(
                _reportsUnitOfWork.Object,
                _summariesUnitOfWork.Object, Mock.Of <ILog>(), _authorizationPolicy.Object, _identityProvider.Object);
        }
Beispiel #22
0
        public void ClassSetUp()
        {
            _identityId     = Guid.NewGuid();
            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);

            _factory           = new MockRepository(MockBehavior.Loose);
            _reportsUnitOfWork = _factory.Create <IReportsUnitOfWork>();
            _report            = new ReportDerived(DataEntryUnitTestFixture.IdentityId, DataEntryUnitTestFixture.AgencyDetails.Id, Guid.NewGuid(), Guid.NewGuid(), ModuleType.Arrest, false);
            new WorkflowInstanceDerived(_report, Guid.NewGuid(), null);
            _reportsUnitOfWork.Setup(mock => mock.Find <Report>(It.IsAny <Guid>(), It.IsAny <TrackingMode>(), It.IsAny <ThrowIf>())).Returns(_report);
            _reportCommentCommandService = new ReportCommentCommandService(_reportsUnitOfWork.Object, Mock.Of <ILog>(), _authorizationPolicy.Object, _identityProvider.Object);
        }
 private void SetUpReport()
 {
     _report = new ReportDerived(DataEntryUnitTestFixture.IdentityId, DataEntryUnitTestFixture.AgencyDetails.Id, Guid.NewGuid(), Guid.NewGuid(), ModuleType.Incident, false);
     _reportsUnitOfWork.Setup(mock => mock.Find <Report>(It.IsAny <Guid>(), It.IsAny <TrackingMode>(), It.IsAny <ThrowIf>())).Returns(_report);
 }
Beispiel #24
0
        public void SetUp()
        {
            var _report = new ReportDerived(ReportUnitTestFixture.IdentityId, Guid.NewGuid(), Guid.NewGuid(), Guid.NewGuid(), ModuleType.Arrest, true);

            workflowInstance = new WorkflowInstanceDerived(_report, Guid.NewGuid(), "data");
        }