Пример #1
0
 public void Dispose()
 {
     if (ServiceScope != null)
     {
         ServiceScope.Dispose();
     }
 }
Пример #2
0
        private async Task <IActor> CreateSectorAsync(IPerson startPerson, IServiceProvider _globalServiceProvider)
        {
            if (ServiceScope != null)
            {
                ServiceScope.Dispose();
                ServiceScope = null;
            }

            ServiceScope = _globalServiceProvider.CreateScope();

            ConfigBotAux();

            var humanPlayer  = _globalServiceProvider.GetRequiredService <HumanPlayer>();
            var scoreManager = _globalServiceProvider.GetRequiredService <IScoreManager>();

            var sectorManager         = ServiceScope.ServiceProvider.GetRequiredService <ISectorManager>();
            var playerEventLogService = ServiceScope.ServiceProvider.GetService <IPlayerEventLogService>();

            await sectorManager.CreateSectorAsync().ConfigureAwait(false);

            sectorManager.CurrentSector.ScoreManager    = scoreManager;
            sectorManager.CurrentSector.HumanGroupExit += CurrentSector_HumanGroupExit;

            var humanActor = CreateHumanActor(humanPlayer,
                                              startPerson,
                                              sectorManager,
                                              playerEventLogService);

            return(humanActor);
        }
Пример #3
0
 /// <inheritdoc />
 public void Dispose()
 {
     if (ShouldDispose)
     {
         ServiceScope.Dispose();
     }
 }
 public void Dispose()
 {
     ScopedBusControl?.StopAsync();
     BusControl?.StopAsync();
     ServiceScope?.Dispose();
     Logger.LogInformation($"{Id} Bus stopped, scope disposed");
 }
        public void TearDown()
        {
            ServiceScope?.Dispose();

            if (!string.IsNullOrEmpty(_tempDataDirectory) && Directory.Exists(_tempDataDirectory))
            {
                Directory.Delete(_tempDataDirectory, true);
            }
        }
Пример #6
0
        public void Dispose()
        {
            if (!_disposed)
            {
                _disposed = true;

                PopNestedServiceScope();
                ServiceScope.Dispose();
            }
        }
 public void TearDown()
 {
     ServiceScope?.Dispose();
     ServiceProvider?.Dispose();
     if (_temporaryDatabase != null)
     {
         var connString = _temporaryDatabase.ConnectionString;
         _temporaryDatabase = null;
         FbDatabase.DropDatabase(connString);
     }
 }
Пример #8
0
        private IServiceScope CreateScopeInternal()
        {
            if (_currentScope != null)
            {
                _currentScope.Dispose();
                _currentScope = null;
                GC.Collect();
            }

            _currentScope = new ServiceScope(Instance.CreateChildContainer());
            return(_currentScope);
        }
Пример #9
0
        public void DisposeScopeDisposesContainer()
        {
            var container = new Mock <IContainer>();

            container.Setup(c => c.Dispose()).Verifiable();

            var serviceScope = new ServiceScope(container.Object);

            serviceScope.Dispose();

            container.Verify();
        }
Пример #10
0
        public void Dispose_ShouldDisposeLifetimeScope()
        {
            // Arrange
            var lifetimeScopeMock = new Mock<ILifetimeScope>();
            var scope = new ServiceScope(lifetimeScopeMock.Object);
            lifetimeScopeMock.Verify(x => x.Dispose(), Times.Never);

            // Act
            scope.Dispose();

            // Assert
            lifetimeScopeMock.Verify(x => x.Dispose(), Times.Once);
        }
Пример #11
0
        public void Dispose_ShouldDisposeServiceScope()
        {
            // Arrange
            var microsoftServiceScopeMock = new Mock <IServiceScope>();
            var scope = new ServiceScope(microsoftServiceScopeMock.Object);

            microsoftServiceScopeMock.Verify(x => x.Dispose(), Times.Never);

            // Act
            scope.Dispose();

            // Assert
            microsoftServiceScopeMock.Verify(x => x.Dispose(), Times.Once);
        }
Пример #12
0
        public void TearDown()
        {
            ServiceScope?.Dispose();

            if (!string.IsNullOrEmpty(_tempDataDirectory) && Directory.Exists(_tempDataDirectory))
            {
                try
                {
                    Directory.Delete(_tempDataDirectory, true);
                }
                catch
                {
                    // Ignore exceptions - we need to find out later why this happens
                }
            }
        }
Пример #13
0
 public void Dispose()
 {
     ServiceScope?.Dispose();
     ServiceProvider?.Dispose();
 }
Пример #14
0
 public virtual void TestCleanup()
 {
     ServiceScope.Dispose();
 }
Пример #15
0
 public virtual void Cleanup()
 {
     ClaimBanListService.Clean();
     ServiceScope.Dispose();
 }
Пример #16
0
 /// <summary>释放
 /// </summary>
 protected virtual void Dispose(bool disposing)
 {
     ServiceScope.Dispose();
 }
        public virtual void Dispose()
        {
            ServiceScope.Dispose();

            ServiceProvider.Dispose();
        }
Пример #18
0
 public void Dispose()
 {
     ServiceScope.Dispose();
 }
Пример #19
0
 public void TearDown()
 {
     ServiceScope?.Dispose();
     ServiceProvider?.Dispose();
 }
Пример #20
0
 /// <summary>
 /// Обработать событие остановки.
 /// </summary>
 public virtual void OnStopped()
 {
     ServiceScope.Dispose();
 }
Пример #21
0
 public virtual void Cleanup()
 {
     DB.ClearAllData();
     ClaimBanListService.Clean();
     ServiceScope.Dispose();
 }
Пример #22
0
 public void TearDown()
 {
     ServiceScope?.Dispose();
 }
Пример #23
0
 void IDisposable.Dispose()
 {
     ServiceScope.Dispose();
     ServiceProvider.Dispose();
 }