Skip to content

Commit 88747ff

Browse files
committed
Added Tests for #155: Ensure in memory queues respect max items
1 parent 177c9cc commit 88747ff

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

test/Exceptionless.Tests/Storage/InMemoryFileStorageTests.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using Exceptionless.Storage;
2+
using Xunit;
23
using Xunit.Abstractions;
34

45
namespace Exceptionless.Tests.Storage {
@@ -8,5 +9,22 @@ public InMemoryFileStorageTests(ITestOutputHelper output) : base(output) { }
89
protected override IObjectStorage GetStorage() {
910
return new InMemoryObjectStorage();
1011
}
12+
13+
[Fact]
14+
public void SaveObject_AddObject_WillRespectMaxItems() {
15+
// Assign
16+
var storage = new InMemoryObjectStorage(2);
17+
storage.SaveObject("1.json", "1");
18+
storage.SaveObject("2.json", "2");
19+
20+
// Act
21+
storage.SaveObject("3.json", "3");
22+
23+
// Assert
24+
Assert.Equal(storage.MaxObjects, storage.Count);
25+
Assert.False(storage.Exists("1.json"));
26+
Assert.True(storage.Exists("2.json"));
27+
Assert.True(storage.Exists("3.json"));
28+
}
1129
}
1230
}

0 commit comments

Comments
 (0)