public void Setup() { this.testDir = "TestFiles"; Directory.CreateDirectory(this.testDir); var formatter = new BinaryFormatter(); this.operationDataAccess = new FormatterDataAccess <Operation>(formatter); this.operationIndexDataAccess = new FormatterDataAccess <OperationsIndex>(formatter); this.configurationMock = new Mock <IConfiguration>(); var section = EConfigSection.SAROMSettings.ToString(); this.configurationMock .Setup(c => c.GetSection(section)[EConfigKey.StoragePath.ToString()]) .Returns(this.testDir); this.configurationMock .Setup(c => c.GetSection(section)[EConfigKey.FileExtension.ToString()]) .Returns(".dat"); this.configurationMock .Setup(c => c.GetSection(section)[EConfigKey.IndexFile.ToString()]) .Returns(Path.Combine(this.testDir, "TestOperationIndex.dat")); this.repository = new OperationsRepository( operationDataAccess, operationIndexDataAccess, configurationMock.Object); }
public AutoServiceModel(IFileDataAccess fileDataAccess) { iCarOwners = 0; iOrders = 0; Path = fileDataAccess.Path; CarOwners = new List <CarOwner>(); Orders = new List <Order>(); this.fileDataAccess = fileDataAccess; }
public OperationsRepository( IFileDataAccess <Operation> operationDataAccess, IFileDataAccess <OperationsIndex> operationIndexDataAccess, IConfiguration configuration) { this.operationDataAccess = operationDataAccess; this.operationIndexDataAccess = operationIndexDataAccess; this.configuration = configuration; }
public FileDataAcessFacade([NotNull] IDataAccessFileConfig config, [NotNull] IEnumerable <IFileDataAccess> implementations, [NotNull] ILogger <FileDataAcessFacade> logger) { _config = config ?? throw new ArgumentNullException(nameof(config)); _implementations = implementations ?? throw new ArgumentNullException(nameof(implementations)); _logger = logger ?? throw new ArgumentNullException(nameof(logger)); _fileDataAccess = GetDataAccess(config); _data = _fileDataAccess.ReadFromFile(); }
public UserRepository( IFileDataAccess <IEnumerable <User> > fileDataAccess, IConfiguration configuration) { this.fileDataAccess = fileDataAccess; var section = EConfigSection.SAROMSettings.ToString(); var key = EConfigKey.UsersFile.ToString(); this.filePath = configuration.GetSection(section)[key]; if (!File.Exists(this.filePath)) { File.Create(this.filePath).Dispose(); } }
public TodoItemQuery(IFileDataAccess fileDataAccess) { Field <ListGraphType <TodoItemType> >("all", resolve: ctx => { return(fileDataAccess.Read()); }); Field <TodoItemType>("find", arguments: new QueryArguments(new QueryArgument <IdGraphType> { Name = "id" }), resolve: ctx => { return(fileDataAccess.Find(ctx.GetArgument <Guid>("id"))); }); Field <ListGraphType <TodoItemType> >("delete", arguments: new QueryArguments(new QueryArgument <IdGraphType> { Name = "id" }), resolve: ctx => { return(fileDataAccess.Delete(ctx.GetArgument <Guid>("id"))); }); }
public BlogPostFileAdapter(IConfiguration configuration, IFileDataAccess <BlogPost> fileDataAccess) { _configuration = configuration; _fileDataAccess = fileDataAccess; }
public OrderDAL_file(IFileDataAccess fileDataAccess) { autoServiceModel = fileDataAccess.GetModel(); }
public MyFileDataRepository(IFileDataAccess fileDataAccess) { _fileDataAccess = fileDataAccess; }
public ItemController(IFileDataAccess fileDataAccess) { this.FileDataAccess = fileDataAccess; }