Exemplo n.º 1
0
        public void OnCreation_ExposesTheNameOfTheSelectedProfile()
        {
            // Act
            ProfileSelectViewModel vm = new ProfileSelectViewModel(_profileManager, Mock.Of <IWindowService>());

            // Assert
            Assert.AreEqual(_profileManager.ActiveProfile.Name, vm.SelectedProfile);
        }
Exemplo n.º 2
0
        public void OnCreation_ExposesTheNamesOfAllProfiles()
        {
            // Act
            ProfileSelectViewModel vm = new ProfileSelectViewModel(_profileManager, Mock.Of <IWindowService>());

            // Assert
            CollectionAssert.Contains(vm.AllProfiles, _defaultProfile.Name);
            CollectionAssert.Contains(vm.AllProfiles, _alternateProfile.Name);
        }
Exemplo n.º 3
0
        public LaunchViewModel(
            ConfigService configService,
            ThemeService themeService,
            VersionService versionService,
            LibraryService libraryService,
            AssetService assetService,
            AccountService accountService,
            AuthService authService,
            AuthlibInjectorService authlibInjectorService,
            LaunchService launchService,
            DownloadService downloadService,
            LogService logService,

            IWindowManager windowManager,
            GreetingViewModel greetingVM,
            VersionsManagementViewModel versionsVM,
            LaunchStatusViewModel statusVM,
            AccountEditViewModel accountEditVM,
            DownloadStatusViewModel downloadVM,
            ErrorReportViewModel errorReportVM,
            ProfileSelectViewModel profileSelectVM)
        {
            _windowManager = windowManager;
            _config        = configService.Entries;

            _versionService         = versionService;
            _libraryService         = libraryService;
            _assetService           = assetService;
            _accountService         = accountService;
            _authService            = authService;
            _authlibInjectorService = authlibInjectorService;
            _launchService          = launchService;
            _downloadService        = downloadService;
            _logService             = logService;

            _statusVM         = statusVM;
            _accountEditVM    = accountEditVM;
            _profileSelectVM  = profileSelectVM;
            _downloadStatusVM = downloadVM;
            _errorReportVM    = errorReportVM;

            _launchService.Exited += OnGameExited;

            _versionService.Loaded  += hasAny => HasVersion = hasAny;
            _versionService.Created += _ => HasVersion = true;

            _statusVM.Closed += (sender, e) => OnLaunchCompleted();

            ThemeService = themeService;
            GreetingVM   = greetingVM;
            VersionsVM   = versionsVM;
        }
Exemplo n.º 4
0
        public void OnNewProfile_AddsProfileNameToExposedProfiles()
        {
            // Arrange
            Mock <IProfile> profile = new Mock <IProfile>();
            string          name    = "Profile";

            profile.SetupGet(p => p.Name).Returns(name);

            Messages.NewProfile msg = new Messages.NewProfile(profile.Object);

            // Act
            ProfileSelectViewModel vm = new ProfileSelectViewModel(_profileManager, Mock.Of <IWindowService>());

            Messenger.Default.Send(msg);

            // Assert
            CollectionAssert.Contains(vm.AllProfiles, name);
        }