예제 #1
0
        public override IEnumerable <ITravelerJournal> GetEnumerable()
        {
            List <ITravelerJournal> tJournals = new List <ITravelerJournal> ();

            foreach (FileInfo journalFile in JournalDirectory.GetFiles())
            {
                if (journalFile.Name.Contains(FileID))
                {
                    SetStorage(journalFile.Name.Replace(".csv", string.Empty));

                    ITravelerJournal journal = JournalFactory.CreateEmpty(JournalType.TravelerJournal) as ITravelerJournal;
                    try
                    {
                        journal.BuildEntity(Storage.ReadAll());
                    }
                    catch (Exception _e)
                    {
                        Debug.LogWarning(_e.ToString());
                    }


                    tJournals.Add(journal);
                }
            }

            return(tJournals);
        }
예제 #2
0
 public AdminService(CacheManager cacheManager,
                     CryptoHelper cryptoHelper,
                     IOrganizationRepository organizationRepository,
                     OrganizationFactory organizationFactory,
                     IUserRepository userRepository,
                     UserFactory userFactory,
                     IJournalRepository journalRepository,
                     JournalFactory journalFactory,
                     ITokenRequestLogRepository tokenRequestLogRepository,
                     TokenRequestLogFactory tokenRequestLogFactory,
                     ISendEmailLogRepository sendEmailLogRepository,
                     SendEmailLogFactory sendEmailLogFactory,
                     IUserLoginLogRepository userLoginLogRepository,
                     UserLoginLogFactory userLoginLogFactory)
 {
     _cacheManager              = cacheManager;
     _cryptoHelper              = cryptoHelper;
     _organizationRepository    = organizationRepository;
     _organizationFactory       = organizationFactory;
     _userRepository            = userRepository;
     _userFactory               = userFactory;
     _journalRepository         = journalRepository;
     _journalFactory            = journalFactory;
     _tokenRequestLogRepository = tokenRequestLogRepository;
     _tokenRequestLogFactory    = tokenRequestLogFactory;
     _sendEmailLogRepository    = sendEmailLogRepository;
     _sendEmailLogFactory       = sendEmailLogFactory;
     _userLoginLogRepository    = userLoginLogRepository;
     _userLoginLogFactory       = userLoginLogFactory;
 }
        private void Initiate()
        {
            if (!Directory.Exists(TravelerJournalRepo.Link.StoragePath))
            {
                Directory.CreateDirectory(TravelerJournalRepo.Link.StoragePath);
            }

            patient = PatientHelper.GetNewPatient();
            journal = JournalFactory.CreateWithPatient(JournalType.TravelerJournal, patient) as ITravelerJournal;
            currentIDIndex++;
        }
예제 #4
0
        public override ITravelerJournal GetDataByIdentifier <IDType> (IDType _id)
        {
            SetStorage($"{FileID}{_id}");

            IJournal journal = JournalFactory.CreateEmpty(JournalType.TravelerJournal);

            try
            {
                journal.BuildEntity(Storage.ReadAll());
            }
            catch (Exception _e)
            {
                Debug.LogWarning(_e.ToString());
            }

            return(journal as ITravelerJournal);
        }
        public void CanGetEnumerator()
        {
            //  Arrange
            Initiate();
            int  expectedEntries = 3;
            bool notNull;
            bool notEmpty;
            bool correctAmount;

            JournalHelper.ManualStorageInsertion(JournalFactory.Create(JournalType.TravelerJournal), JournalType.TravelerJournal, TravelerJournalRepo.Link.StoragePath);
            JournalHelper.ManualStorageInsertion(JournalFactory.Create(JournalType.TravelerJournal), JournalType.TravelerJournal, TravelerJournalRepo.Link.StoragePath, true);
            JournalHelper.ManualStorageInsertion(JournalFactory.Create(JournalType.TravelerJournal), JournalType.TravelerJournal, TravelerJournalRepo.Link.StoragePath, true);

            //  Act
            List <ITravelerJournal> pJournal = TravelerJournalRepo.Link.GetEnumerable().ToList();

            notNull       = journal != null;
            notEmpty      = pJournal?.Count != 0;
            correctAmount = pJournal?.Count == 3;
            CleanUp();

            //  Assert
            Assert.True(notNull && notEmpty && correctAmount, $" {AssertHelper.ValidatorMessage ("Is Null:", !notNull, !notNull, false)} <|> {AssertHelper.ValidatorMessage ("Is Empty:", !notEmpty, ( ( journal != null ) ? ( pJournal.Count.ToString () ) : ( "NaN" ) ), "> 0")} <|> {AssertHelper.ValidatorMessage ("Correct Amount:", correctAmount, ( ( pJournal != null ) ? ( pJournal.Count.ToString () ) : ( "NaN" ) ), expectedEntries)}");
        }
예제 #6
0
 public JournalService(CacheManager cacheManager, IJournalRepository journalRepository, JournalFactory journalFactory)
 {
     _cacheManager      = cacheManager;
     _journalRepository = journalRepository;
     _journalFactory    = journalFactory;
 }