public void SetUp()
 {
     _fixture = new ModuleTestHarness();
     _fixture.ClearMessages();
     _lifetimeScope = _fixture.Container.BeginLifetimeScope();
     _lifetimeScope.Dispose();
     _lifetimeScopeBeginningMessage = _fixture.GetSingleMessageOrDefault <LifetimeScopeBeginningMessage>();
     _lifetimeScopeEndingMessage    = _fixture.GetSingleMessageOrDefault <LifetimeScopeEndingMessage>();
 }
        void AttachToLifetimeScope(ILifetimeScope lifetimeScope, ILifetimeScope parent = null)
        {
            var lifetimeScopeModel = ModelMapper.GetLifetimeScopeModel(lifetimeScope, parent);
            var message            = new LifetimeScopeBeginningMessage(lifetimeScopeModel);

            Send(message);

            lifetimeScope.CurrentScopeEnding += (s, e) =>
            {
                Send(new LifetimeScopeEndingMessage(lifetimeScopeModel.Id));
                ModelMapper.IdTracker.ForgetId(lifetimeScope);
            };

            lifetimeScope.ChildLifetimeScopeBeginning += (s, e) => AttachToLifetimeScope(e.LifetimeScope, lifetimeScope);
            lifetimeScope.ResolveOperationBeginning   += (s, e) => AttachToResolveOperation(e.ResolveOperation, lifetimeScopeModel);
        }
 public void SetUp()
 {
     _fixture = new ModuleTestHarness();
     _profilerConnectedMessage  = _fixture.GetSingleMessageOrDefault <ProfilerConnectedMessage>();
     _rootScopeBeginningMessage = _fixture.GetSingleMessageOrDefault <LifetimeScopeBeginningMessage>();
 }