public async Task SingleItemPutTest() { var mockData = new SampleClass() { Id = 123, Data = "Kratos" }; var key = Guid.NewGuid().ToString(); var category = "spartan"; var aerospikeStateProvider = new AerospikeStateProvider(new AerospikeClientFactory(), GetMockConfigurationProvider(), GetMockSessionStoreSerializerFactory().Object, new RecyclableStreamPool()); await aerospikeStateProvider.AddAsync(new ItemKey(category, key), mockData); var item = await aerospikeStateProvider.GetAsync <SampleClass>(new ItemKey(category, key)); Assert.Equal(mockData.Data, item.Data); }
public async Task TestSingleItemOperation() { var mockConfigProvider = GetMockConfigurationProvider(); var mockSessionStoreSerializerFactory = GetMockSessionStoreSerializerFactory(); var mockSessionProviderFactory = GetSessionProviderFactory(mockSessionStoreSerializerFactory, mockConfigProvider); var sessionStore = new Tavisca.Common.Plugins.SessionStore.SessionStore(mockSessionProviderFactory); var mockData = new SampleClass() { Id = 123, Data = "Kratos" }; var key = Guid.NewGuid().ToString(); var category = "spartan"; await sessionStore.AddAsync(new DataItem <SampleClass>(new ItemKey(category, key), mockData)); var readData = await sessionStore.GetAsync <SampleClass>(new ItemKey(category, key), CancellationToken.None); Assert.NotNull(readData); Assert.Equal(mockData.Id, readData.Id); Assert.Equal(mockData.Data, readData.Data); }