public override void RetireRepository(object key, MocksRepository repo) { var dict = currentRepositories.GetAllThreadsValues().FirstOrDefault(repos => repos.Any(pair => pair.Value.Target == repo)); if (dict != null) { var repositoryId = repo.RepositoryId; var repositoryPath = repo.GetRepositoryPath(); dict.Remove(key); repo.Retire(); #if !PORTABLE try { if (MockingContext.Plugins.Exists <IDebugWindowPlugin>()) { var debugWindowPlugin = MockingContext.Plugins.Get <IDebugWindowPlugin>(); debugWindowPlugin.RepositoryRetired(repositoryId, repositoryPath); } } catch (Exception e) { System.Diagnostics.Trace.WriteLine("Exception thrown calling IDebugWindowPlugin plugin: " + e); } #endif } }
public override void AddRepository(object entryKey, MocksRepository entryRepo) { this.GetCurrentDictionary().Add(entryKey, new WeakReference(entryRepo)); #if !PORTABLE try { if (MockingContext.Plugins.Exists <IDebugWindowPlugin>()) { var debugWindowPlugin = MockingContext.Plugins.Get <IDebugWindowPlugin>(); debugWindowPlugin.RepositoryCreated( entryRepo.RepositoryId, entryRepo.GetRepositoryPath(), new MethodMockInfo(entryRepo.Method.Name, entryRepo.Method.MemberType, entryRepo.Method.DeclaringType, entryRepo.Method.ReflectedType)); } } catch (Exception e) { System.Diagnostics.Trace.WriteLine("Exception thrown calling IDebugWindowPlugin plugin: " + e); } #endif }