public void FirstTest() { IRepositoryFactory <Vuelo> factory = new FileRepositoryFactory <Vuelo>(); IRepository <Vuelo> rep = factory.CreateRepository(); var vals = rep.FetchAll(); for (int i = 0; i < 10; ++i) { rep.Add(new Vuelo() { Id = i, AsientosDisponibles = i }); } rep.Save(); var vals2 = rep.FetchAll(); IRepository <Pasajero> pasajerosRepo = new FileRepositoryFactory <Pasajero>().CreateRepository(); var pasajers = pasajerosRepo.FetchAll(); for (int i = 0; i < 10; ++i) { pasajerosRepo.Add(new Pasajero() { Id = i, Nombre = "Pasajero " + i }); } pasajerosRepo.Save(); }
internal void LoadTestSpecificRepositories( IRepositoryFactory repositoryFactory, string testSpecificRepositoryDataFolderName ) { var stopwatch = new Stopwatch(); stopwatch.Start(); try { var folder = Path.Combine( TestRepositoryRootDataFolder, testSpecificRepositoryDataFolderName ); if (!Directory.Exists(folder)) { throw new DirectoryNotFoundException( $"Test specific data folder {folder} was not found." ); } var testFileRepositoryFactory = new FileRepositoryFactory(folder); var copier = new RepositoryDataCopier(testFileRepositoryFactory, repositoryFactory); copier.CopyDataToExistingDestination(); } finally { stopwatch.Stop(); _output.WriteLine($"Loading specific repository data => {stopwatch.ElapsedMilliseconds.ToString()}ms"); } }
/// <summary> /// Generates and returns a password as a protected string. /// </summary> /// <param name="prf">Password profile.</param> /// <param name="crsRandomSource">Cryptographic random source.</param> /// <returns>The generated password.</returns> public override ProtectedString Generate(PwProfile prf, CryptoRandomStream crsRandomSource) { UserConfig config = UserConfig.Deserialize(prf.CustomAlgorithmOptions); SystemConfig sysConfig = new SystemConfig(); RandomUtil random = new RandomUtil(crsRandomSource); IRepositoryFactory factory = new FileRepositoryFactory(config, sysConfig); IPhraseRepository repo = factory.Make(random); ISpecialCharsRepository specialCharsRepo = factory.MakeSpecialChars(random); IPhraseGenerator generator = new PhraseGenerator(config, repo, specialCharsRepo); return(generator.Generate()); }
public void CleanRepository() { IRepository <Pasajero> repo = new FileRepositoryFactory <Pasajero>().CreateRepository(); repo.Add(new Pasajero()); repo.Save(); var vals = repo.FetchAll(); Assert.IsTrue(vals.Count > 0); repo.CleanRepository(); vals = repo.FetchAll(); vals.MergeSort(x => x.Id); Assert.IsTrue(vals.Count == 0); }
public void TestHashcode() { IRepository <Pasajero> repo = new FileRepositoryFactory <Pasajero>().CreateRepository(); repo.Add(new Pasajero() { Nombre = "segundo" }); repo.Add(new Pasajero() { Nombre = "Primero" }); repo.Save(); var desordenados = repo.FetchAll(); var ordenados = desordenados.MergeSort(x => x.Asiento); Console.WriteLine("asdf"); }
///<summary>To Do</summary> /// <param name="loadAllCoreData">When <see langword="true"/>, load all /// core data, otherwise only load settings and metadata.</param> private void LoadCoreRepositoryData(bool loadAllCoreData) { var stopwatch = new Stopwatch(); stopwatch.Start(); try { IRepositoryFactory coreFileRepositoryFactory = new FileRepositoryFactory( CoreRepositoryRootDataFolder ); var copier = new RepositoryDataCopier(coreFileRepositoryFactory, RepositoryFactory); copier.CopyDataToCleanDestination(loadAllCoreData); } finally { stopwatch.Stop(); _output.WriteLine($"Loading core repository data => {stopwatch.ElapsedMilliseconds.ToString()}ms"); } }
public CreateProximaxDataService(IFileStorageConnection fileStorageConnection) { FileUploadService = new FileUploadService(FileRepositoryFactory.Create(fileStorageConnection)); }
public FileDownloadService(IFileStorageConnection fileStorageConnection) { FileRepository = FileRepositoryFactory.Create(fileStorageConnection); }