public void AgencyQueryServiceClassSetUp()
        {
            _factory             = new MockRepository(MockBehavior.Loose);
            _unitOfWorkAdmin     = _factory.Create <IAdministrationUnitOfWork>();
            _jurisdiction        = new Jurisdiction("ori", "agencyCode");
            _agency              = new AgencyDerived(_jurisdiction, "name");
            _agencyConfiguration = new AgencyConfigurationDerived(_agency, "name");
            _rmsSystem           = new RMSSystem(Guid.NewGuid(), "description");
            _user = _rmsSystem.CreateUserAccount(_agency, "username", "password");
            _unitOfWorkAdmin.Setup(item => item.Find <Agency>(It.IsAny <Guid>(), It.IsAny <TrackingMode>(), It.IsAny <ThrowIf>()))
            .Returns(_agency);

            _unitOfWorkAdmin.Setup(item => item.Find <User>(It.IsAny <Guid>(), It.IsAny <TrackingMode>(), It.IsAny <ThrowIf>()))
            .Returns(_user);

            _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);


            _iPasswordQueryService = new PasswordQueryService(_unitOfWorkAdmin.Object, Mock.Of <ILog>(), _authorizationPolicy.Object, _identityProvider.Object);
            SetUpAgencyPasswordConfiguration();
        }
Exemple #2
0
 private void SetUpUser()
 {
     _rmsSystem = new RMSSystem(Guid.NewGuid(), "RMS Description");
     _agency    = AdministrationUnitTestFixture.AgencyDetails;
     _user      = _rmsSystem.CreateUserAccount(_agency, "New User", Password);
     _administrationUnitOfWork.Setup(item => item.Find <User>(It.IsAny <Guid>(), TrackingMode.Automatic, It.IsAny <ThrowIf>())).Returns(_user);
 }
Exemple #3
0
        private void CreateUser()
        {
            _users = new List <User>();
            var rmsSystem = new RMSSystem(Guid.NewGuid(), "RMS Description");
            var user      = rmsSystem.CreateUserAccount(_agencyDerived, "New User", "1ab");

            _users.Add(user);
        }
Exemple #4
0
        public void CreateUser()
        {
            _jurisdiction = new Jurisdiction("ori", "agencyCode");
            _agency       = new AgencyDerived(_jurisdiction, "name");
            var result = rmssystem.CreateUserAccount(_agency, "data", "data1");

            result.Should().BeOfType(typeof(User));
        }
        public void ClassLevelSetUp()
        {
            var jurisdiction = new Jurisdiction("ori", "agencyCode");
            var agency       = new AgencyDerived(jurisdiction, "name");
            var rmsSystem    = new RMSSystem(Guid.NewGuid(), "RMS Description");

            _user = rmsSystem.CreateUserAccount(agency, "New User", "1ab");
            _passwordConfiguration = PasswordConfiguration.Empty;
        }
        private void SetUpUser()
        {
            var rmsSystem = new RMSSystem(Guid.NewGuid(), "RMS System");
            var user      = rmsSystem.CreateUserAccount(_agency, "Ronald Di", "ron123");
            var userList  = new List <User>();

            userList.Add(user);
            _administrationUnitOfWork.Setup(item => item.GetEntityQuery <User>(It.IsAny <TrackingMode>())).Returns(userList.AsQueryable);
        }
Exemple #7
0
        private void SetUpUser()
        {
            var userList  = new List <User>();
            var rmsSystem = new RMSSystem(Guid.NewGuid(), "RMS Description");
            var user      = rmsSystem.CreateUserAccount(_agency, "Workflow User", "A123@TR");

            userList.Add(user);
            _administrationUnitOfWork.Setup(mock => mock.GetEntityQuery <User>(TrackingMode.Automatic)).Returns(userList.AsQueryable);
            _identityId = user.Id;
        }
Exemple #8
0
        public void GetUsers()
        {
            var userList  = new List <User>();
            var systemId  = Guid.NewGuid();
            var rmsSystem = new RMSSystem(systemId, "description");
            var user      = rmsSystem.CreateUserAccount(_agency, "username", "password");

            userList.Add(user);
            _unitOfWorkAdmin.Setup(item => item.GetEntityQuery <User>(It.IsAny <TrackingMode>()))
            .Returns(userList.AsQueryable());

            var result = _agencyQueryService.GetUsers(_agency.Id);

            result.Should().NotBeNullOrEmpty();
            result.Select(item => item.PrimaryAgencyId).FirstOrDefault().Should().Be(_agency.Id);
            result.Select(item => item.UserId).FirstOrDefault().Should().Be(user.Id);
            result.Select(item => item.Username).FirstOrDefault().Should().Be("username");
        }
 private void SetUpUser()
 {
     _user = _rmsSystem.CreateUserAccount(_agency, "New User", Password);
     _administrationUnitOfWork.Setup(item => item.Find <User>(It.IsAny <Guid>(), TrackingMode.Automatic, ThrowIf.Anything)).Returns(_user);
 }