private void CreateData() { var random = new Random(); foreach (var path in new[] { null, new[] { "FolderA", "FolderA1" }, new[] { "FolderB", "FolderB1", "FolderB2" }, new[] { "FolderC", "FolderC1", "FolderC2", "FolderC3" }, new[] { "FolderD", "FolderD1" }, new[] { "FolderD", "FolderD1", "FolderD2", "FolderD3", "FolderD4" }, }) { foreach (var binName in new[] { "Bin1", "Bin2", "Bin3" }) { var data = new byte[100]; random.NextBytes(data); var nameTag = _tags.AddOrGet(binName); var binaryStorageClass = new BinaryStorageClass { Id = Guid.NewGuid(), NameTag = nameTag }; if (path != null) { binaryStorageClass.PathId = _paths.AddOrGet(path); } _binaries.Add(binaryStorageClass, data); } } }
public void SetUp() { _dataCache = new MockBinaryDataCache(); _binaries = new MockBinariesCache(_dataCache); var random = new Random(); _bytes = new byte[BinaryDataStorageClass.MaxBufferSize * 2]; random.NextBytes(_bytes); _items = Enumerable.Range(0, 40).Select(i => new BinaryStorageClass { Id = Guid.NewGuid() }).ToList(); foreach (var bsc in _items) { _binaries.Add(bsc, _bytes); } _cache = new LoadedBinaryCache(CacheCapacity, _binaries); }