コード例 #1
0
        public void InvokeILiveService_GetLiveStatisticsViewModelMethodOnceWithCorrectParameter()
        {
            // Arrange
            var liveService      = new Mock <ILiveService>();
            var identityProvider = new Mock <IIdentityProvider>();

            var liveController = new LiveController(liveService.Object, identityProvider.Object);

            var username = "******";

            identityProvider.Setup(p => p.GetUsername()).Returns(username);

            // Act
            liveController
            .WithCallTo(c => c.UpdateLiveCombatStatistics())
            .ShouldRenderPartialView("_LiveStatisticsViewModel");

            // Assert
            liveService.Verify(s => s.GetLiveStatisticsViewModel(username), Times.Once);
        }
コード例 #2
0
        public void RenderCorrectViewWithCorrectViewModel()
        {
            // Arrange
            var liveService      = new Mock <ILiveService>();
            var identityProvider = new Mock <IIdentityProvider>();

            var liveController = new LiveController(liveService.Object, identityProvider.Object);

            var expectedViewModel = new LiveStatisticsViewModel();

            liveService.Setup(s => s.GetLiveStatisticsViewModel(It.IsAny <string>())).Returns(expectedViewModel);

            // Act & Assert
            liveController
            .WithCallTo(c => c.UpdateLiveCombatStatistics())
            .ShouldRenderPartialView("_LiveStatisticsViewModel")
            .WithModel <LiveStatisticsViewModel>(actualViewModel =>
            {
                Assert.That(actualViewModel, Is.SameAs(expectedViewModel));
            });
        }
コード例 #3
0
ファイル: LiveControllerTests.cs プロジェクト: Slidran/CCC
 public LiveControllerTests()
 {
     _services   = new LiveServiceMock();
     _controller = new LiveController(_services);
 }
コード例 #4
0
        /// <summary>
        /// 初始化系统
        /// </summary>
        private void InitSystem()
        {
            accountManager = AccountManager.Instance;
#if UNITY_EDITOR || UNITY_STANDALONE_WIN || UNITY_WSA
            anchorController = SceneAnchorController.Instance;
#endif
            liveController       = LiveController.Instance;
            inputManager         = MultiInputManager.Instance;
            speechManager        = SpeechManager.Instance;
            uiManager            = UIManager.Instance;
            collaborationManager = CollaborationManager.Instance;
            storageManager       = StorageManager.Instance;
            libraryManager       = LibraryManager.Instance;

            moduleSwitch.Add(NeedAccount);
            mrc = MixedRealityCapture.Instance;
#if UNITY_EDITOR || UNITY_STANDALONE_WIN || UNITY_WSA
            moduleSwitch.Add(NeedAnchor);
#endif
            moduleSwitch.Add(NeedInput);
            moduleSwitch.Add(NeedSpeech);
            moduleSwitch.Add(NeedUI);
            moduleSwitch.Add(NeedCollaboration);
            moduleSwitch.Add(NeedStorage);
            moduleSwitch.Add(NeedLibrary);
            moduleSwitch.Add(NeedSocial);
            moduleSwitch.Add(NeedLive);

            moduleList.Add(accountManager);
#if UNITY_EDITOR || UNITY_STANDALONE_WIN || UNITY_WSA
            moduleList.Add(anchorController);
#endif
            moduleList.Add(inputManager);
            moduleList.Add(speechManager);
            moduleList.Add(uiManager);
            moduleList.Add(collaborationManager);
            moduleList.Add(storageManager);
            moduleList.Add(libraryManager);
            moduleList.Add(mrc);
            moduleList.Add(liveController);

            // 按需求启动模块
            for (int i = 0; i < moduleSwitch.Count; i++)
            {
                if (moduleList[i] == null)
                {
                    continue;
                }

                if (moduleSwitch[i])
                {
                    moduleList[i].gameObject.SetActive(true);
                    moduleList[i].Init();
                }
                else
                {
                    moduleList[i].gameObject.SetActive(false);
                }
            }

            HasInit = true;
        }