public async Task TestDeleteAsync()
        {
            var institute = createInstitutionInstance();

            using (var factory = new TemakiInMemoryContextFactory())
            {
                var id = await SaveInstitute(factory, institute);


                using (var context = factory.CreateContext())
                {
                    var repository = new InstitutionRepository(context);



                    await repository.DeleteAsync(id);
                }

                var institutionGotten = await GetInstitution(factory, id);

                Assert.True(
                    institutionGotten is null
                    );
            }
        }
        public void InstitutionRepositoryConstructor()
        {
            EmptyLists();
            institutionRepository = new InstitutionRepository(context);

            Assert.NotNull(institutionRepository);
        }
        public async Task TestUpdateAsync()
        {
            var institute = createInstitutionInstance();

            using (var factory = new TemakiInMemoryContextFactory())
            {
                var id = await SaveInstitute(factory, institute);

                var institution2 = new Institution()
                {
                    Id      = id,
                    Name    = "minha casa",
                    Address = "nossa casa"
                };
                using (var context = factory.CreateContext())
                {
                    var repository = new InstitutionRepository(context);



                    await repository.UpdateAsync(institution2);
                }

                var institutionGotten = await GetInstitution(factory, id);

                Assert.True(
                    compareInstitutes(institution2, institutionGotten)
                    );
            }
        }
        public void AddDepartmentToInstitutionFalseInstitutionId()
        {
            EmptyLists();
            institutionRepository = new InstitutionRepository(context);
            Exception ex = Assert.Throws <NullReferenceException>(() => institutionRepository.AddDepartmentToInstitution(-1, 1));

            Assert.Equal("Het instellingId is leeg.", ex.Message);
        }
        public void GetByIdFalseInput()
        {
            EmptyLists();
            institutionRepository = new InstitutionRepository(context);
            Exception ex = Assert.Throws <NullReferenceException>(() => institutionRepository.GetById(-1));

            Assert.Equal("Het instellingId is leeg.", ex.Message);
        }
        public void InstitutionRepositoryConstructorFalseInput()
        {
            EmptyLists();

            Exception ex = Assert.Throws <NullReferenceException>(() => institutionRepository = new InstitutionRepository(null));

            Assert.Equal("De instellingContext is leeg.", ex.Message);
        }
        public void UpdateFalseInput()
        {
            EmptyLists();
            institutionRepository = new InstitutionRepository(context);
            Exception ex = Assert.Throws <NullReferenceException>(() => institutionRepository.Update(null));

            Assert.Equal("De instelling is leeg.", ex.Message);
        }
 /// <summary>
 /// Constructor that sets the instances of the repositories and the converters
 /// </summary>
 /// <param name="treatmentRepository"></param>
 /// <param name="departmentRepository"></param>
 /// <param name="institutionRepository"></param>
 public TreatmentTypeController(TreatmentTypeRepository treatmentRepository,
                                DepartmentRepository departmentRepository,
                                InstitutionRepository institutionRepository)
 {
     this.repository            = treatmentRepository;
     this.departmentRepository  = departmentRepository;
     this.institutionRepository = institutionRepository;
     converter = new TreatmentTypeViewModelConverter();
 }
        public void AddInstitution()
        {
            EmptyLists();
            Administrator admin       = new Administrator();
            Institution   institution = new Institution("een", 1, "eend", "696969", "Lichtenstein", admin);

            institutionRepository = new InstitutionRepository(context);
            Assert.Equal(3, institutionRepository.Insert(institution));
        }
Exemple #10
0
        private void LinkCentralServicesNodeCertificates(InstitutionRepository ir)
        {
            var ebms = ir.CentralServicesNode.EbMSSignatureCertificates[0].CertificateIdentification;

            ebms.thumbprint = ir.Certificates[ir.AccessPoints.Count * 3 + ir.Institutions.Count * 2].thumbprint;

            var tls = ir.CentralServicesNode.TLSCertificates[0].CertificateIdentification;

            tls.thumbprint = ir.Certificates[ir.AccessPoints.Count * 3 + ir.Institutions.Count * 2 + 1].thumbprint;
        }
 /// <summary>
 ///
 /// </summary>
 /// <param name="departmentRepository">Department repository</param>
 /// <param name="institutionRepository">Institution repository</param>
 /// <param name="converter">Converter</param>
 public DepartmentController(DepartmentRepository departmentRepository,
                             InstitutionRepository institutionRepository,
                             DoctorRepository doctorRepository,
                             IViewModelConverter <Department, DepartmentDetailViewModel> converter)
 {
     this.departmentRepository  = departmentRepository;
     this.institutionRepository = institutionRepository;
     this.doctorRepository      = doctorRepository;
     this.converter             = converter;
 }
Exemple #12
0
        private void LinkInstitutionCertificates(InstitutionRepository ir)
        {
            for (int i = 0; i < ir.Institutions.Count; i++)
            {
                var ebms = ir.Institutions[i].EbMSSignatureCertificates[0].CertificateIdentification;
                ebms.thumbprint = ir.Certificates[ir.AccessPoints.Count * 3 + i * 2].thumbprint;

                var business = ir.Institutions[i].BusinessSignatureCertificates[0].CertificateIdentification;
                business.thumbprint = ir.Certificates[ir.AccessPoints.Count * 3 + i * 2 + 1].thumbprint;
            }
        }
        public void Update()
        {
            EmptyLists();
            Administrator admin       = new Administrator();
            Institution   institution = new Institution("een", 1, "eend", "696969", "Lichtenstein", admin)
            {
                Id = 1
            };

            institutionRepository = new InstitutionRepository(context);
            Assert.True(institutionRepository.Update(institution));
        }
Exemple #14
0
        private void LinkAccessPointCertificates(InstitutionRepository ir)
        {
            for (int i = 0; i < ir.AccessPoints.Count; i++)
            {
                var ebms = ir.AccessPoints[i].EbMSSignatureCertificates[0].CertificateIdentification;
                ebms.thumbprint = ir.Certificates[i * 3].thumbprint;

                var internalTls = ir.AccessPoints[i].InternalTLSCertificates[0].CertificateIdentification;
                internalTls.thumbprint = ir.Certificates[i * 3 + 1].thumbprint;

                var externalTls = ir.AccessPoints[i].ExternalTLSCertificates[0].CertificateIdentification;
                externalTls.thumbprint = ir.Certificates[i * 3 + 2].thumbprint;
            }
        }
Exemple #15
0
        public InstitutionRepository Create()
        {
            var institutionCount = AccessPointCount * InstitutionsPerAccessPoint;

            var result = new InstitutionRepository
            {
                CentralServicesNode = CentralServicesNodeFactory.Create(),
                AccessPoints        = AccessPointFactory.Create(AccessPointCount),
                Institutions        = InstitutionFactory.Create(institutionCount),
                Certificates        = CertificateFactory.Create(AccessPointCount * 3 + institutionCount * 2 + 2)
            };

            LinkInstitutions(result);
            LinkAccessPointCertificates(result);
            LinkInstitutionCertificates(result);
            LinkCentralServicesNodeCertificates(result);
            return(result);
        }
Exemple #16
0
 private void LinkInstitutions(InstitutionRepository ir)
 {
     for (int i = 0; i < ir.AccessPoints.Count; i++)
     {
         for (int j = 0; j < InstitutionsPerAccessPoint; j++)
         {
             var k = i * InstitutionsPerAccessPoint + j;
             ir.AccessPoints[i].LinkedInstitutions.Add(new LinkedInstitution
             {
                 Institution = new InstitutionIdentification
                 {
                     officialID  = ir.Institutions[k].officialID,
                     countryCode = ir.Institutions[k].countryCode
                 },
                 ValidityPeriod = ir.Institutions[k].ValidityPeriod
             });
         }
     }
 }
        public async Task TestGetAsync()
        {
            var institute = createInstitutionInstance();

            using (var factory = new TemakiInMemoryContextFactory())
            {
                var id = await SaveInstitute(factory, institute);


                using (var context = factory.CreateContext())
                {
                    var repository      = new InstitutionRepository(context);
                    var institionGotten = await repository.GetAsync(id);


                    Assert.True(
                        compareInstitutes(institute, institionGotten)
                        );
                }
            }
        }
Exemple #18
0
        public UnitOfWork(ApplicationDbContext context)
        {
            _context = context;

            Accounts             = new AccountRepository(_context);
            Assets               = new AssetRepository(_context);
            Bonds                = new BondRepository(_context);
            Contacts             = new ContactRepository(_context);
            Partners             = new PartnerRepository(_context);
            Institutions         = new InstitutionRepository(_context);
            Banks                = new InstitutionRepository(_context);
            Currencies           = new CurrencyRepository(_context);
            Countries            = new CountryRepository(_context);
            Messages             = new MessageRepository(_context);
            Portfolios           = new PortfolioRepository(_context);
            Tasks                = new TaskRepository(_context);
            Reports              = new ReportRepository(_context);
            ExchangeRates        = new ExchangeRateRepository(_context);
            Returns              = new ReturnRepository(_context);
            HoldingPeriodReturns = new ReturnRepository(_context);
            TileWidgets          = new TileWidgetRepository(_context);
        }
Exemple #19
0
 public void Dispose()
 {
     this._userRepository               = null;
     this._permissionRepository         = null;
     this._roleRepository               = null;
     this._rolePermissionRepository     = null;
     this._investigatorRepository       = null;
     this._institutionRepository        = null;
     this._interestAreaRepository       = null;
     this._programRepository            = null;
     this._investigationGroupRepository = null;
     this._commissionRepository         = null;
     this._draftLawRepository           = null;
     this._conceptRepository            = null;
     this._badLanguageRepository        = null;
     this._tagRepository = null;
     this._conceptStatusLogRepository       = null;
     this._debateSpeakerRepository          = null;
     this._educationalInstitutionRepository = null;
     this._knowledgeAreaRepository          = null;
     this._academicLevelRepository          = null;
     this._educationLevelRepository         = null;
     this._snieRepository                     = null;
     this._meritRangeRepository               = null;
     this._investigatorCommissionRepository   = null;
     this._investigatorInterestAreaRepository = null;
     this._configurationRepository            = null;
     this._notificationRepository             = null;
     this._conceptDebateSpeakerRepository     = null;
     this._consultationRepository             = null;
     this._consultationInterestAreaRepository = null;
     this._draftLawStatusRepository           = null;
     this._periodRepository                   = null;
     this._originRepository                   = null;
     this._userInstitutionRepository          = null;
     this._consultationTypeRepository         = null;
     this._reasonRejectRepository             = null;
     _context.Dispose();
 }
        public async Task TestAddAsync()
        {
            var institute = createInstitutionInstance();

            using (var factory = new TemakiInMemoryContextFactory())
            {
                using (var context = factory.CreateContext())
                {
                    var instituteRepository = new InstitutionRepository(context);
                    await instituteRepository.AddAsync(institute);

                    await context.SaveChangesAsync();
                }

                using (var context = factory.CreateContext())
                {
                    var success = await context.Institutions.AnyAsync(
                        i1 => (i1.Address == institute.Address) && (i1.Name == institute.Name)
                        );

                    Assert.True(success);
                }
            }
        }
 public void GetById()
 {
     EmptyLists();
     institutionRepository = new InstitutionRepository(context);
     Assert.Equal("instituut", institutionRepository.GetById(1).Name);
 }
Exemple #22
0
        private void CleanInstitutionRepository()
        {
            var institutionRepository = new InstitutionRepository(_options);

            institutionRepository.RemoveAllInstitutions();
        }
Exemple #23
0
 public InstitutionsController(InstitutionRepository repo, IModelService modelServices)
 {
     this._repo          = repo;
     this._modelServices = modelServices;
 }
 public void AddDepartmentToInstitution()
 {
     EmptyLists();
     institutionRepository = new InstitutionRepository(context);
     Assert.True(institutionRepository.AddDepartmentToInstitution(1, 1));
 }
 public void GetAll()
 {
     EmptyLists();
     institutionRepository = new InstitutionRepository(context);
     Assert.Equal(2, institutionRepository.GetAll().Count);
 }
 public InstitutionRepositoryTests()
 {
     _institutionRepository = new InstitutionRepository(_sql, _cache);
 }
Exemple #27
0
 public InstitutionBL()
 {
     oUnitOfWork  = new UnitOfWork(ConfigurationManager.ConnectionStrings["SSREntities"].ConnectionString);
     oRepositorio = oUnitOfWork.InstitutionRepository;
 }
Exemple #28
0
        public InstitutionControllerTest()
        {
            var institutionRepository = new InstitutionRepository(_options);

            _controller = new InstitutionController(institutionRepository);
        }