Exemple #1
0
        public ViewModel(Tally tally, IVoteCounter voteCounter,
                         ICache <string> cache, CheckForNewRelease newRelease, IAgnostic agnostic,
                         IGlobalOptions globalOptions, ILogger <ViewModel> logger)
        {
            // Save our dependencies in readonly fields.
            this.tally              = tally;
            this.voteCounter        = voteCounter;
            this.PageCache          = cache;
            this.globalOptions      = globalOptions;
            this.checkForNewRelease = newRelease;
            this.agnostic           = agnostic;
            this.logger             = logger;

            tally.PropertyChanged       += Tally_PropertyChanged;
            voteCounter.PropertyChanged += VoteCounter_PropertyChanged;

            // Set up binding commands.
            AddQuestCommand    = new RelayCommand(this, nameof(AddQuestCommand), DoAddQuest, CanAddQuest);
            RemoveQuestCommand = new RelayCommand(this, nameof(RemoveQuestCommand), DoRemoveQuest, CanRemoveQuest);

            RunTallyCommand        = new AsyncRelayCommand(this, nameof(RunTallyCommand), DoRunTallyAsync, CanRunTally);
            CancelTallyCommand     = new RelayCommand(this, nameof(CancelTallyCommand), DoCancelTally, CanCancelTally);
            ClearTallyCacheCommand = new RelayCommand(this, nameof(ClearTallyCacheCommand), DoClearTallyCache, CanClearTallyCache);

            AddLinkedQuestCommand    = new RelayCommand(this, nameof(AddLinkedQuestCommand), AddLinkedQuest, CanAddLinkedQuest);
            RemoveLinkedQuestCommand = new RelayCommand(this, nameof(RemoveLinkedQuestCommand), RemoveLinkedQuest, CanRemoveLinkedQuest);

            SetupWatches();
        }
        public static void ClassInit(TestContext context)
        {
            serviceProvider = TestStartup.ConfigureServices();

            voteCounter     = serviceProvider.GetRequiredService <IVoteCounter>();
            tally           = serviceProvider.GetRequiredService <Tally>();
            voteConstructor = serviceProvider.GetRequiredService <VoteConstructor>();
            agnostic        = serviceProvider.GetRequiredService <IAgnostic>();
        }
Exemple #3
0
        public static void ClassInit(TestContext context)
        {
            serviceProvider = TestStartup.ConfigureServices();
            agnostic        = serviceProvider.GetRequiredService <IAgnostic>();

            IQuest quest = new Quest();

            agnostic.ComparisonPropertyChanged(quest, new PropertyChangedEventArgs(nameof(quest.CaseIsSignificant)));
        }
        public static void ClassInit(TestContext context)
        {
            serviceProvider = TestStartup.ConfigureServices();

            voteCounter     = serviceProvider.GetRequiredService <IVoteCounter>();
            tally           = serviceProvider.GetRequiredService <Tally>();
            voteConstructor = serviceProvider.GetRequiredService <VoteConstructor>();
            agnostic        = serviceProvider.GetRequiredService <IAgnostic>();

            IQuest quest = new Quest();

            agnostic.ComparisonPropertyChanged(quest, new System.ComponentModel.PropertyChangedEventArgs(nameof(quest.CaseIsSignificant)));
        }