public void DeleteTemplate() { var template = _agency.CreateTemplate(_dataEntryContractId, ModuleType.CallForService, string.Concat("Testing Template", Guid.NewGuid())); _administrationUnitOfWork.Setup(item => item.Find <Template>(It.IsAny <Guid>(), It.IsAny <TrackingMode>(), It.IsAny <ThrowIf>())) .Returns(template); _templateCommandService.Delete(template.Id); _administrationUnitOfWork.Verify(mock => mock.Commit(It.IsAny <ConcurrencyMode>()), Times.Once); _administrationUnitOfWork.Verify(mock => mock.Remove(template), Times.Once); }
public void CreateReportWithTemplate_WorkflowNotFound() { var template = _agency.CreateTemplate(DataEntryUnitTestFixture.IdentityId, ModuleType.CallForService, "Arrest Default Template"); _templateProvider.Setup(mock => mock.GetTemplate(It.IsAny <Guid>())).Returns(template); _arrestReportCommandService.CreateReportWithTemplate(It.IsAny <Guid>(), false, MockObject.NewArrestReport); }
public static Template Create(Agency agency, DataEntryContract contract) { var template = agency.CreateTemplate(contract.ModuleType, contract.Name); template.Description = contract.Description; BuildSections(template, contract); return(template); }
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); }
public void ClassLevelSetup() { _agency = AdministrationUnitTestFixture.AgencyDetails; var identityContext = new IdentityContext { IdentityId = 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); _administrationUnitOfWork = new Mock <IAdministrationUnitOfWork>(); _metadataUnitOfWorkWork = new Mock <IMetadataUnitOfWork>(); _arrestTemplate = _agency.CreateTemplate(_dataEntryContractId, ModuleType.Arrest, "Arrest Templte"); _templateCommandService = new TemplateCommandService(_administrationUnitOfWork.Object, _metadataUnitOfWorkWork.Object, Mock.Of <ILog>(), _authorizationPolicy.Object, _identityProvider.Object); }
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); }
private void CreateTemplates() { _citationTemplate = _agency.CreateTemplate(_dataEntryContractId, ModuleType.Citation, "Testing Citation Template"); _arrestTemplate = _agency.CreateTemplate(_dataEntryContractId, ModuleType.Arrest, "Testing Arrest Template"); _callForServiceTemplate = _agency.CreateTemplate(_dataEntryContractId, ModuleType.CallForService, "Testing CallForService Template"); _fieldInterviewTemplate = _agency.CreateTemplate(_dataEntryContractId, ModuleType.FieldInterview, "Testing FieldInterview Template"); _incidentTemplate = _agency.CreateTemplate(_dataEntryContractId, ModuleType.Incident, "Testing Incident Template"); }
public void GetAgencyDefault_CheckForTemplateWorkflow() { var template = _agency.CreateTemplate(It.IsAny <Guid>(), ModuleType.Citation, "Testing Citation Template"); template.MakeActive(false); }