コード例 #1
0
ファイル: GameModule.cs プロジェクト: almackenzie/Dev
 public void Initialize()
 {
     _container.Resolve<IRegionManager>().RegisterViewWithRegion("GameRegion", () =>
         {
             GameViewModel gameViewModel = new GameViewModel(_container);
             GameView gameView = new GameView() { DataContext = gameViewModel };
             return gameView;
         });
 }
コード例 #2
0
ファイル: GameViewModelTests.cs プロジェクト: almackenzie/Dev
        private GameViewModel GetGameViewModel()
        {
            IUnityContainer container = new UnityContainer();

            Mock<IGroupDefinitionService> groupDefinitionServiceMock = new Mock<IGroupDefinitionService>();

            groupDefinitionServiceMock.Setup(gds => gds.GetGroups(It.IsAny<int>(), It.IsAny<int>()))
                .Returns(GetGroups());

            container.RegisterInstance(groupDefinitionServiceMock.Object);

            GameViewModel viewModel = new GameViewModel(container);
            return viewModel;
        }