public void Test_Enqueue_EmptyData() { var repo = new QueueShardRepository(new List <QueueShard <IQueueShardItem> >() { new QueueShard <IQueueShardItem>("test") }); Assert.Throws <ArgumentException>(() => repo.Enqueue("test", null)); }
public void Test_AddQueue_Duplicate() { var repo = new QueueShardRepository(new List <QueueShard <IQueueShardItem> >() { new QueueShard <IQueueShardItem>("test") }); Assert.Throws <ArgumentException>(() => repo.AddQueue("test")); }
public void Test_Enqueue_NotExistingQueue() { var repo = new QueueShardRepository(new List <QueueShard <IQueueShardItem> >() { new QueueShard <IQueueShardItem>("test") }); Assert.Throws <ArgumentException>(() => repo.Enqueue("test0", new byte[1024])); }
public void Test_Enqueue_Success() { var repo = new QueueShardRepository(new List <QueueShard <IQueueShardItem> >() { new QueueShard <IQueueShardItem>("test") }); var model = repo.Enqueue("test", new byte[1024]); Assert.True(Guid.TryParse(model, out Guid result)); }
public void Test_DeleteQueue_Success() { var repo = new QueueShardRepository(new List <QueueShard <IQueueShardItem> >() { new QueueShard <IQueueShardItem>("test") }); var model = repo.DeleteQueue("test"); Assert.Equal("test", model); }
public void Test_List_Success() { var repo = new QueueShardRepository(new List <QueueShard <IQueueShardItem> >() { new QueueShard <IQueueShardItem>("test") }); var model = repo.List(); Assert.True(model.Any()); Assert.Equal("test", model.First()); }
public void Test_Dequeue_Success() { var repo = new QueueShardRepository(new List <QueueShard <IQueueShardItem> >() { new QueueShard <IQueueShardItem>("test") }); repo.Enqueue("test", new byte[1024]); var model = repo.Dequeue("test"); Assert.NotNull(model); }
public void Test_DeleteItem_Success() { var repo = new QueueShardRepository(new List <QueueShard <IQueueShardItem> >() { new QueueShard <IQueueShardItem>("test") }); var model = repo.Enqueue("test", new byte[1024]); Assert.NotNull(model); var modelDeq = repo.Dequeue("test"); Assert.NotNull(modelDeq); Assert.Equal(repo.DeleteItem("test", modelDeq.ID), modelDeq.ID); }
public void Test_DeleteItem_InvalidItem() { var repo = new QueueShardRepository(new List <QueueShard <IQueueShardItem> >() { new QueueShard <IQueueShardItem>("test") }); var model = repo.Enqueue("test", new byte[1024]); Assert.NotNull(model); var modelDeq = repo.Dequeue("test"); Assert.NotNull(modelDeq); Assert.Throws <ArgumentException>(() => repo.DeleteItem("test", null)); }
public void Test_DeleteQueue_NotExisting() { var repo = new QueueShardRepository(); Assert.Throws <ArgumentException>(() => repo.DeleteQueue("test")); }
public void Test_List_NotInitialized() { var repo = new QueueShardRepository(); Assert.False(repo.List().Any()); }