private TestComponents InitializeTest(int testId) { var result = new TestComponents(); GetConfigurationsForTest(testId, out AgentConfiguration agentConfig, out GameMasterConfiguration gmConfig, out CommunicationServerConfiguration csConfig); result.GameMaster = new GameMaster.GameMaster(gmConfig); result.Agent = new Agent.Agent(agentConfig); result.CsTask = new Task(IntegrationTestsHelper.RunCommunicationServer, csConfig); return(result); }
// Server should be gently killed after GameMaster termination private void Assert_CommunicationServerSuccessfullyKilled(TestComponents testComponents) { try { testComponents?.Agent.OnDestroy(); testComponents?.GameMaster.OnDestroy(); testComponents.CsTask.Wait(200); } catch (AggregateException ex) { Assert.AreEqual(TaskStatus.Faulted, testComponents.CsTask.Status); var exception = ex.InnerException as CommunicationErrorException; Assert.IsNotNull(exception); Assert.AreEqual(CommunicationExceptionType.GameMasterDisconnected, exception.Type); } }