Ejemplo n.º 1
0
        public void Reset_WithData_DeletesData()
        {
            _inMemDataStore.Save("test1", new byte[] { 1, 2, 3 });
            _inMemDataStore.Save("test2", new byte[] { 4, 5, 6 }, new Dictionary <string, string> {
                { "x", "y" }
            });

            Assert.That(_inMemDataStore.SizeBytes, Is.EqualTo(6));
            Assert.That(_inMemDataStore.LoadMetadata("test1"), Is.Empty);
            Assert.That(_inMemDataStore.LoadMetadata("test2")["x"], Is.EqualTo("y"));

            _inMemDataStore.Reset();

            Assert.That(_inMemDataStore.SizeBytes, Is.Zero);
            Assert.That(_inMemDataStore.AttachmentIds, Is.Empty);
            Assert.That(_inMemDataStore.Contains("test1"), Is.False);
            Assert.That(_inMemDataStore.Contains("test2"), Is.False);
            Assert.That(() => _inMemDataStore.Load("test1"), Throws.ArgumentException.With.Message.Contains("test1"));
            Assert.That(() => _inMemDataStore.Load("test2"), Throws.ArgumentException.With.Message.Contains("test2"));
            Assert.That(() => _inMemDataStore.LoadMetadata("test1"), Throws.ArgumentException.With.Message.Contains("test1"));
            Assert.That(() => _inMemDataStore.LoadMetadata("test2"), Throws.ArgumentException.With.Message.Contains("test2"));
        }
Ejemplo n.º 2
0
 public async Task <Dictionary <string, string> > ReadMetadata(string id) => _dataStore.LoadMetadata(id);