public static void Start(bool isPrintNotifications) { PersonEntityTranslator personEntityTranslator = new PersonEntityTranslator(); FileReadDataProvider fileReadDataProvider = new FileReadDataProvider(); Cache <Person> cache = new Cache <Person>(fileReadDataProvider, personEntityTranslator); cache.Init(); if (isPrintNotifications) { cache.Notify += (sender, args) => Console.WriteLine($"op: {args.Operation} id: {args.EntityId}"); } Console.WriteLine("Test eager init cache"); TestSingleOps(cache); Console.WriteLine("===================="); TestManyOps(cache); // test lazy init Console.WriteLine("===================="); Console.WriteLine("Test lazy init cache"); fileReadDataProvider.InsertMockDataIntoRepo(); Cache <Person> cacheLazy = new Cache <Person>(fileReadDataProvider, personEntityTranslator, Cache <Person> .InitType.Lazy); TestLazySingleOps(cacheLazy); }
public static void Start() { Console.Write("Starting threads tests "); PersonEntityTranslator personEntityTranslator = new PersonEntityTranslator(); FileReadDataProvider fileReadDataProvider = new FileReadDataProvider(); fileReadDataProvider.InsertMockDataIntoRepo(); Cache <Person> cache = new Cache <Person>(fileReadDataProvider, personEntityTranslator, Cache <Person> .InitType.Eager); cache.Init(); TestThreads(cache); Debug.Assert(fileReadDataProvider.GetFileContents().Trim().Equals(ThreadsOpsResult)); Console.WriteLine("success"); }