Skip to content

Commit

Permalink
test: Add StoreServiceTest
Browse files Browse the repository at this point in the history
  • Loading branch information
s2quake authored and limebell committed Jan 15, 2025
1 parent 85c92ed commit bd1d1b6
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions sdk/node/Libplanet.Node.Tests/Services/StoreServiceTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
using Libplanet.Node.Options;
using Libplanet.Node.Services;
using Libplanet.Store;
using Libplanet.Store.Trie;
using Microsoft.Extensions.DependencyInjection;

namespace Libplanet.Node.Tests.Services;

public class StoreServiceTest
{
[Fact]
public void RocksDB_Test()
{
var settings = new Dictionary<string, string?>
{
[$"{StoreOptions.Position}:{nameof(StoreOptions.Type)}"] = $"{StoreType.RocksDB}",
};
var serviceProvider = TestUtility.CreateServiceProvider(settings);
var storeService = serviceProvider.GetRequiredService<IStoreService>();

Assert.IsType<RocksDBStore.RocksDBStore>(storeService.Store);
Assert.IsType<RocksDBStore.RocksDBKeyValueStore>(storeService.KeyValueStore);
}

[Fact]
public void InMemory_Test()
{
var settings = new Dictionary<string, string?>
{
[$"{StoreOptions.Position}:{nameof(StoreOptions.Type)}"] = $"{StoreType.InMemory}",
};
var serviceProvider = TestUtility.CreateServiceProvider(settings);
var storeService = serviceProvider.GetRequiredService<IStoreService>();

Assert.IsType<MemoryStore>(storeService.Store);
Assert.IsType<MemoryKeyValueStore>(storeService.KeyValueStore);
}
}

0 comments on commit bd1d1b6

Please sign in to comment.