public static IPersistentState <T> AddPersistentState <T>( this TestKitSilo silo, IStorage <T> storage, string stateName, string storageName = default, T state = default) where T : new() { if (silo == null) { throw new ArgumentNullException(nameof(silo)); } if (string.IsNullOrWhiteSpace(stateName)) { throw new ArgumentException("A state name must be provided", nameof(stateName)); } if (storage is null) { throw new ArgumentNullException(nameof(storage)); } silo.StorageManager.AddStorage(storage, stateName); return(silo.StorageManager.stateAttributeFactoryMapper.AddPersistentState(storage, stateName, storageName, state)); }
public static Mock <T> AddServiceProbe <T>(this TestKitSilo silo) where T : class { if (silo == null) { throw new ArgumentNullException(nameof(silo)); } return(silo.ServiceProvider.AddServiceProbe <T>()); }
public static TestStorageStats StorageStats(this TestKitSilo silo) { if (silo == null) { throw new ArgumentNullException(nameof(silo)); } return(silo.StorageManager.GetStorageStats()); }
public static Task FireTimerAsync(this TestKitSilo silo, int index) { if (silo == null) { throw new ArgumentNullException(nameof(silo)); } return(silo.TimerRegistry.FireAsync(index)); }
public static Task FireAllTimersAsync(this TestKitSilo silo) { if (silo == null) { throw new ArgumentNullException(nameof(silo)); } return(silo.TimerRegistry.FireAllAsync()); }
public static void FireAllTimers(this TestKitSilo silo) { if (silo == null) { throw new ArgumentNullException(nameof(silo)); } silo.TimerRegistry.FireAll(); }
public static void FireTimer(this TestKitSilo silo, int index) { if (silo == null) { throw new ArgumentNullException(nameof(silo)); } silo.TimerRegistry.Fire(index); }
public static TState State <TState>(this TestKitSilo silo) where TState : class, new() { if (silo == null) { throw new ArgumentNullException(nameof(silo)); } return(silo.StorageManager.GetStorage <TState>().State); }
public static T AddService <T>(this TestKitSilo silo, T instance) where T : class { if (silo == null) { throw new ArgumentNullException(nameof(silo)); } return(silo.ServiceProvider.AddService(instance)); }
public static Task FireAllReminders(this TestKitSilo silo, TickStatus tickStatus = default) { if (silo == null) { throw new ArgumentNullException(nameof(silo)); } return(silo.ReminderRegistry.FireAllReminders(tickStatus)); }
public static Mock <T> AddProbe <T>(this TestKitSilo silo, long id, string classPrefix = null) where T : class, IGrainWithIntegerKey { if (silo == null) { throw new ArgumentNullException(nameof(silo)); } return(silo.GrainFactory.AddProbe <T>(new TestGrainIdentity(id), classPrefix)); }
public static void AddProbe <T>(this TestKitSilo silo, Func <IGrainIdentity, IMock <T> > factory) where T : class, IGrain { if (silo == null) { throw new ArgumentNullException(nameof(silo)); } silo.GrainFactory.AddProbe(factory); }
public static Mock <T> AddProbe <T>(this TestKitSilo silo, Guid id, string keyExtension, string classPrefix = null) where T : class, IGrainWithGuidCompoundKey { if (silo == null) { throw new ArgumentNullException(nameof(silo)); } return(silo.GrainFactory.AddProbe <T>(new TestGrainIdentity(id, keyExtension), classPrefix)); }
public static Task FireReminder(this TestKitSilo silo, string reminderName, TickStatus tickStatus = default) { if (silo == null) { throw new ArgumentNullException(nameof(silo)); } if (reminderName == null) { throw new ArgumentNullException(nameof(reminderName)); } return(silo.ReminderRegistry.FireReminder(reminderName, tickStatus)); }
public static TestStream <T> AddStreamProbe <T>(this TestKitSilo silo, Guid id, string streamNamespace, string providerName) { if (silo == null) { throw new ArgumentNullException(nameof(silo)); } if (providerName == null) { throw new ArgumentNullException(nameof(providerName)); } return(silo.StreamProviderManager.AddStreamProbe <T>(id, streamNamespace, providerName)); }
public static IStorage <T> AddGrainState <TGrain, T>( this TestKitSilo silo, T state = default) where TGrain : Grain <T> where T : new() { if (silo == null) { throw new ArgumentNullException(nameof(silo)); } var storage = silo.StorageManager.GetGrainStorage <TGrain, T>(); storage.State = state ?? new T(); return(storage); }
public static IPersistentState <T> AddPersistentState <T>( this TestKitSilo silo, string stateName, string storageName = default, T state = default) where T : new() { if (silo == null) { throw new ArgumentNullException(nameof(silo)); } if (string.IsNullOrWhiteSpace(stateName)) { throw new ArgumentException("A state name must be provided", nameof(stateName)); } var storage = silo.StorageManager.GetStorage <T>(stateName); return(AddPersistentState(silo, storage, stateName, storageName, state)); }
public static TestStream <T> AddStreamProbe <T>(this TestKitSilo silo, Guid id, string streamNamespace) => AddStreamProbe <T>(silo, id, streamNamespace, "Default");
public static TestStream <T> AddStreamProbe <T>(this TestKitSilo silo, Guid id) => AddStreamProbe <T>(silo, id, typeof(T).Name);
public static Mock <T> AddServiceProbe <T>(this TestKitSilo silo, Mock <T> mock) where T : class => silo.ServiceProvider.AddServiceProbe(mock);
public static T AddService <T>(this TestKitSilo silo, T instance) where T : class => silo.ServiceProvider.AddService(instance);
public static Mock <T> AddProbe <T>(this TestKitSilo silo, Guid id, string keyExtension, string classPrefix = null) where T : class, IGrainWithGuidCompoundKey => silo.GrainFactory.AddProbe <T>(new TestGrainIdentity(id, keyExtension), classPrefix);
public static void AddProbe <T>(this TestKitSilo silo, Func <IGrainIdentity, IMock <T> > factory) where T : class, IGrain => silo.GrainFactory.AddProbe <T>(factory);
public static TState State <TGrain, TState>(this TestKitSilo silo) where TGrain : Grain <TState> where TState : class, new() => silo.StorageManager.GetGrainStorage <TGrain, TState>().State;
public static TestStorageStats StorageStats(this TestKitSilo silo) => silo.StorageManager.GetStorageStats();
public static Task FireAllReminders(this TestKitSilo silo, TickStatus tickStatus = new TickStatus()) => silo.ReminderRegistry.FireAllReminders(tickStatus);
public static TestStream <T> AddStreamProbe <T>(this TestKitSilo silo) => AddStreamProbe <T>(silo, Guid.Empty);
public static Mock <T> AddProbe <T>(this TestKitSilo silo, long id, string classPrefix = null) where T : class, IGrainWithIntegerKey => silo.GrainFactory.AddProbe <T>(new TestGrainIdentity(id), classPrefix);
public static Task FireReminder(this TestKitSilo silo, string reminderName, TickStatus tickStatus = new TickStatus()) => silo.ReminderRegistry.FireReminder(reminderName, tickStatus);
public static TState State <TState>(this TestKitSilo silo) where TState : class, new() => silo.StorageManager.GetStorage <TState>().State;