public static IServiceCollection AddDataChangedEvents(this IServiceCollection serviceCollection, params Assembly[] assemblies) { var scanner = new DataChangedEventScanner(); scanner.ScanAssemblies(assemblies); var repository = new DataChangedEventRepository(scanner.Added, scanner.Updated, scanner.Removed); return(serviceCollection.AddSingleton <IDataChangedEventRepository>(repository)); }
public DataChangedEventRepositoryTests() { var added = new DataChangedEventDictionary(DataChangedEvent.Added); var updated = new DataChangedEventDictionary(DataChangedEvent.Updated); var removed = new DataChangedEventDictionary(DataChangedEvent.Removed); _subject = new DataChangedEventRepository(added, updated, removed); added.Add(typeof(Data1), typeof(Data1Added)); updated.Add(typeof(Data1), typeof(Data1Updated)); removed.Add(typeof(Data1), typeof(Data1Removed)); removed.Add(typeof(Data2), typeof(Data2Removed)); }