protected AbstractJsonRepositoryTest()
        {
            _path    = Guid.NewGuid().ToString("N");
            _options = new JsonStoreOptions {
                NamingStrategy = new StaticNamingStrategy(_path)
            };

            // create a file with an item
            JsonFileCreator.CreateSingleItemRepository(_options.GetFileFullPath(_path));
        }
Esempio n. 2
0
        public ConcurrentRepositoryCrudOperations()
        {
            _path    = Guid.NewGuid().ToString("N");
            _options = new JsonStoreOptions {
                NamingStrategy = new StaticNamingStrategy(_path)
            };
            _semaphoreFactory = new LocalSemaphoreFactory();
            _tokenSource      = new CancellationTokenSource();

            // create a file with an item
            var filePath = Path.Combine(_options.Location, $"{_path}.json");

            JsonFileCreator.CreateMultiItemsRepository(filePath);
        }
Esempio n. 3
0
        public ConcurrentJsonStoreExistingFile()
        {
            // creates a file
            _fileName         = Guid.NewGuid().ToString();
            _semaphoreFactory = new LocalSemaphoreFactory();

            // create a file
            _options = new JsonStoreOptions
            {
                NamingStrategy = new StaticNamingStrategy(_fileName)
            };
            var filePath = Path.Combine(_options.Location, $"{_fileName}.json");

            JsonFileCreator.CreateStore(filePath);
        }
        public JsonStoreWithExistingFile()
        {
            _fileName = Guid.NewGuid().ToString();
            _content  = Constants.GetPerson();

            // create a file
            var options = new JsonStoreOptions
            {
                NamingStrategy = new StaticNamingStrategy(_fileName)
            };

            JsonFileCreator.CreateStore(options.GetFileFullPath(_fileName));

            JsonFileCreator.CreateStore(_fileName);
            _store = new JsonStore <Person>(options);
        }