示例#1
0
        public MainViewModel(QuestCollectionWrapper config, HttpClientHandler handler,
                             IPageProvider pageProvider, ITextResultsProvider textResults,
                             IErrorLogger errorLogger, Func <string, CompareInfo, CompareOptions, int> hashFunction)
        {
            ErrorLog.LogUsing(errorLogger);
            Agnostic.HashStringsUsing(hashFunction);

            if (config != null)
            {
                QuestList = config.QuestCollection;
                QuestList.Sort();
                SelectQuest(config.CurrentQuest);
            }
            else
            {
                QuestList = new QuestCollection();
                SelectQuest(null);
            }

            SetupNetwork(pageProvider, handler);
            SetupTextResults(textResults);

            AllVotesCollection  = new ObservableCollectionExt <string>();
            AllVotersCollection = new ObservableCollectionExt <string>();

            BuildCheckForNewRelease();
            BuildTally();
            BindVoteCounter();

            SetupCommands();
        }
示例#2
0
        public static IServiceProvider ConfigureServices()
        {
            IServiceCollection services = new ServiceCollection();

            // Get the services provided by the core library.
            NetTally.Startup.ConfigureServices(services);

            //services.AddSingleton<IPageProvider, TestPageProvider>();
            //services.AddSingleton<IHash, NormalHash>();
            services.AddSingleton <IClock, StaticClock>();

            var serviceProvider = services.BuildServiceProvider();

            var loggerFactory = serviceProvider.GetRequiredService <ILoggerFactory>();
            var logger        = loggerFactory.CreateLogger("TestStartup");

            logger.LogInformation("Services defined for testing!");

            var hash = serviceProvider.GetRequiredService <IHash>();

            Agnostic.Init(hash);

            var agnostic = serviceProvider.GetRequiredService <IAgnostic>();
            var logger2  = serviceProvider.GetRequiredService <Logger2>();

            return(serviceProvider);
        }
示例#3
0
        public static void ClassInit(TestContext context)
        {
            serviceProvider = TestStartup.ConfigureServices();
            var hash = serviceProvider.GetRequiredService <IHash>();

            Agnostic.HashStringsUsing(hash.HashFunction);
        }
示例#4
0
        protected override void OnStartup(StartupEventArgs e)
        {
            // Create a service collection and configure our dependencies
            var serviceCollection = new ServiceCollection();

            ConfigureServices(serviceCollection);

            // Build the IServiceProvider and set our reference to it
            serviceProvider = serviceCollection.BuildServiceProvider();

            var hash = serviceProvider.GetRequiredService <IHash>();

            Agnostic.Init(hash);

            var loggerFactory = ServiceProvider.GetService <ILoggerFactory>();
            var logger        = loggerFactory.CreateLogger <App>();
            var logger2       = serviceProvider.GetRequiredService <Logger2>();

            logger.LogInformation($"Services defined. Starting application. Version: {ProductInfo.Version}");

            // Request the navigation service and create our main window.
            var navigationService = ServiceProvider.GetRequiredService <IoCNavigationService>();

            _ = navigationService.ShowAsync <MainWindow>();
        }
示例#5
0
        public static void ClassInit(TestContext context)
        {
            Agnostic.HashStringsUsing(UnicodeHashFunction.HashFunction);

            sampleQuest = new Quest();

            ViewModelService.Instance.Build();
        }
示例#6
0
        public static void ClassInit(TestContext context)
        {
            Agnostic.HashStringsUsing(UnicodeHashFunction.HashFunction);
            ViewModelService.Instance.Build();
            VotingRecords.Instance.PropertyChanged += Instance_PropertyChanged;

            defaultIdentity      = new Identity("Name", "1");
            defaultPlanPartition = new VotePartition(new VoteLine("[X] Plan Name\n-[X] Some content"), VoteType.Plan);
        }
示例#7
0
        public static void ClassInit(TestContext context)
        {
            Agnostic.HashStringsUsing(UnicodeHashFunction.HashFunction);

            sampleQuest = new Quest();

            ViewModelService.Instance.Build();

            voteConstructor = ViewModelService.MainViewModel.VoteCounter.VoteConstructor;
        }
示例#8
0
        public MainViewModel(
            HttpClientHandler httpClientHandler, IPageProvider pageProvider,
            IVoteCounter voteCounter, ITextResultsProvider textResults,
            Func <string, CompareInfo, CompareOptions, int> hashFunction)
        {
            PropertyChanged += Agnostic.HashStringsUsing(hashFunction);

            SetupNetwork(pageProvider, httpClientHandler);
            SetupTextResults(textResults);

            AllVotesCollection  = new ObservableCollectionExt <string>();
            AllVotersCollection = new ObservableCollectionExt <string>();

            BuildCheckForNewRelease();
            SetupVoteCounter(voteCounter);

            BuildTally();

            SetupCommands();
        }
示例#9
0
 public static void ClassInit(TestContext context)
 {
     Agnostic.HashStringsUsing(UnicodeHashFunction.HashFunction);
 }
示例#10
0
 public static void ClassInit(TestContext context)
 {
     Agnostic.HashStringsUsing(UnicodeHashFunction.HashFunction);
     VotingRecords.Instance.PropertyChanged += Instance_PropertyChanged;
 }