Ejemplo n.º 1
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);
        }
Ejemplo n.º 2
0
        public void ClassSetUp()
        {
            _factory                 = new MockRepository(MockBehavior.Loose);
            _jurisdiction            = new ValueObjects.Jurisdiction("ori", "agencyCode");
            _agency                  = new AgencyDerived(_jurisdiction, "name");
            _agencyConfiguration     = new AgencyConfigurationDerived(_agency, "name");
            _agencyConfigurationList = new List <AgencyConfiguration>();
            _agencyConfigurationList.Add(_agencyConfiguration);
            _agencyReference = new List <AgencyReference>();
            var agencyReference = new AgencyReference();

            agencyReference.AgencyId = _agency.Id;
            _agencyReference.Add(agencyReference);
            _authorizationPolicy = new Mock <IServiceAuthorizationPolicy>();
            _identityProvider    = new Mock <IServiceIdentityProvider>();

            _unitOfWorkAdmin = _factory.Create <IAdministrationUnitOfWork>();
            _rmsSystem       = new RMSSystem(Guid.NewGuid(), "description");

            _unitOfWorkAdmin.Setup(item => item.GetEntityQuery <AgencyConfiguration>(It.IsAny <TrackingMode>()))
            .Returns(_agencyConfigurationList.AsQueryable());
            _unitOfWorkAdmin.Setup(item => item.GetSystemInstance()).Returns(_rmsSystem);
            _agencyCommandService = new Administration.Services.Command.AgencyCommandService(
                _unitOfWorkAdmin.Object, Mock.Of <ILog>(), _authorizationPolicy.Object, _identityProvider.Object);
        }