Exemplo n.º 1
0
        public void HandleUninitializedToPreclientPhaseTransitionTest()
        {
            var firstResolutionTask  = CreateMock <IResolutionTask>();
            var secondResolutionTask = CreateMock <IResolutionTask>();

            When(leagueModificationResolutionService.StartModificationResolution(firstModification, ModificationTargetType.Client)).ThenReturn(firstResolutionTask);
            When(leagueModificationResolutionService.StartModificationResolution(secondModification, ModificationTargetType.Client)).ThenReturn(secondResolutionTask);

            var firstCompilationTask  = CreateMock <ICompilationTask>();
            var secondCompilationTask = CreateMock <ICompilationTask>();

            When(leagueModificationObjectCompilerService.CompileObjects(firstModification, ModificationTargetType.Client)).ThenReturn(firstCompilationTask);
            When(leagueModificationObjectCompilerService.CompileObjects(secondModification, ModificationTargetType.Client)).ThenReturn(secondCompilationTask);

            testObj.HandleUninitializedToPreclientPhaseTransition(CreateMock <ILeagueSession>(), new LeagueSessionPhaseChangedArgs(0, 0));

            Verify(leagueModificationRepositoryService, Times(1)).EnumerateModifications();
            Verify(leagueModificationResolutionService, Times(1), AfterPrevious()).StartModificationResolution(firstModification, ModificationTargetType.Client);
            Verify(leagueModificationResolutionService, Times(1), WithPrevious()).StartModificationResolution(secondModification, ModificationTargetType.Client);
            Verify(radsService, Times(1), AfterPrevious()).Suspend();
            Verify(firstResolutionTask, Times(1), AfterPrevious()).WaitForChainCompletion();
            Verify(secondResolutionTask, Times(1), WithPrevious()).WaitForChainCompletion();
            Verify(leagueModificationObjectCompilerService, Times(1), AfterPrevious()).CompileObjects(firstModification, ModificationTargetType.Client);
            Verify(leagueModificationObjectCompilerService, Times(1), WithPrevious()).CompileObjects(secondModification, ModificationTargetType.Client);
            Verify(firstCompilationTask, Times(1), AfterPrevious()).WaitForChainCompletion();
            Verify(secondCompilationTask, Times(1), WithPrevious()).WaitForChainCompletion();
            VerifyNoMoreInteractions();
        }