Exemplo n.º 1
0
        public void CodeSetCommandServiceClassSetUp()
        {
            AppConfig.Set("pageSizeParameter", "10");
            _agency              = AdministrationUnitTestFixture.AgencyDetails;
            _codeSet             = new CodeSetDerived(_agency, "category", "name", "description");
            _codeSetDerived      = new CodeSetDerived(_agency, "category", "name", "description");
            _factory             = new MockRepository(MockBehavior.Loose);
            _unitOfWorkAdmin     = _factory.Create <IAdministrationUnitOfWork>();
            _iLogMock            = _factory.Create <ILog>();
            _authorizationPolicy = new Mock <IServiceAuthorizationPolicy>();
            _identityProvider    = new Mock <IServiceIdentityProvider>();

            var identityContext = new IdentityContext {
                IdentityId = Guid.NewGuid()
            };

            _identityProvider.Setup(x => x.GetPrincipalIdentifier()).Returns(identityContext.IdentityId);
            _identityProvider.Setup(x => x.GetIdentityContext()).Returns(identityContext);


            _unitOfWorkAdmin.Setup(item => item.Find <AggregatesAgency.CodeSet>(It.IsAny <Guid>(), It.IsAny <TrackingMode>(), It.IsAny <ThrowIf>()))
            .Returns(_codeSet);
            _codeSetQueryService = new Administration.Services.Query.CodeSetQueryService(_unitOfWorkAdmin.Object, _iLogMock.Object, _authorizationPolicy.Object,
                                                                                         _identityProvider.Object);
            SetUpCode();
            SetUpCodeSet();
            SetUpOfficer();
            AgencyReferenceListSetUp();
            SetUpViolationCode();
            SetUpUcrCode();
        }
Exemplo n.º 2
0
        public void CodeSetCommandServiceSetup()
        {
            _unitOfWorkAdmin = _factory.Create <IAdministrationUnitOfWork>();
            _iLogMock        = _factory.Create <ILog>();
            _jurisdiction    = new ValueObjects.Jurisdiction("ori", "agencyCode");
            _agencyDerived   = new AgencyDerived(_jurisdiction, "name");
            _codeSetDerived  = new CodeSetDerived(_agencyDerived, "category", "name", "description");
            _unitOfWorkAdmin.Setup(item => item.Find <Agency>(It.IsAny <Guid>(), It.IsAny <TrackingMode>(), It.IsAny <ThrowIf>()))
            .Returns(_agencyDerived);
            _unitOfWorkAdmin.Setup(item => item.Find <CodeSet>(It.IsAny <Guid>(), It.IsAny <TrackingMode>(), It.IsAny <ThrowIf>()))
            .Returns(_codeSetDerived);
            var urcCode = new RMSSystem(It.IsAny <Guid>(), "description");

            _unitOfWorkAdmin.Setup(item => item.GetSystemInstance()).Returns(urcCode);
            _authorizationPolicy = new Mock <IServiceAuthorizationPolicy>();
            _identityProvider    = new Mock <IServiceIdentityProvider>();

            var identityContext = new IdentityContext()
            {
                IdentityId = Guid.NewGuid()
            };

            _identityProvider.Setup(x => x.GetPrincipalIdentifier()).Returns(identityContext.IdentityId);
            _identityProvider.Setup(x => x.GetIdentityContext()).Returns(identityContext);


            _codeSetCommandService = new Administration.Services.Command.CodeSetCommandService(_unitOfWorkAdmin.Object, _iLogMock.Object, _authorizationPolicy.Object,
                                                                                               _identityProvider.Object);
        }
Exemplo n.º 3
0
 private void SetUpCodeSetDerived()
 {
     _codeSetDerived     = new CodeSetDerived(_agency, "FMX", "name", "description");
     _codeSetDerivedList = new List <CodeSetDerived>();
     _codeSetDerivedList.Add(_codeSetDerived);
     _unitOfWorkAdmin.Setup(mock => mock.GetEntityQuery <AggregatesAgency.CodeSet>(It.IsAny <TrackingMode>()))
     .Returns(_codeSetDerivedList.AsQueryable());
 }