예제 #1
0
 public string ApplyConfigVarsOnField(string field)
 {
     if (ConfigVariables == null)
     {
         ConfigVariables = new List <ConfigVariable>();
     }
     return(ConfigVariables.ApplyOn(field));
 }
        public BaseTestController()
        {
            am = new Mock <IAuthorizeService>();
            am.Setup(a => a.isDictaatOwner(It.IsAny <string>(), It.IsAny <string>()))
            .Returns(Task.FromResult(true));
            am.Setup(a => a.IsDictaatContributer(It.IsAny <string>(), It.IsAny <string>()))
            .Returns(Task.FromResult(true));

            //mock user store
            var userStore = new Mock <IUserStore <ApplicationUser> >();
            var umm       = new Mock <UserManager <ApplicationUser> >(userStore.Object, null, null, null, null, null, null, null, null);

            _user = new TestPrincipal(new Claim[] {
                new Claim(ClaimTypes.Name, "ssmulder"),
                new Claim(ClaimTypes.NameIdentifier, "06c52646-53fd-4a03-8009-d2ad921e954e")
            });

            _config = new Mock <IOptions <ConfigVariables> >();
            ConfigVariables vars = new ConfigVariables()
            {
                DictaatRoot        = "//resources",
                PagesDirectory     = "pages",
                DictaatConfigName  = "dictaat.config.json",
                DictatenDirectory  = "dictaten",
                TemplatesDirectory = "templates",
                MenuConfigName     = "nav-menu.json",
                ImagesDirectory    = "images",
                StyleDirectory     = "styles",
            };

            _config.Setup(c => c.Value).Returns(vars);

            //database
            var options = new DbContextOptionsBuilder <WebdictaatContext>()
                          .UseSqlServer("Data Source=(localdb)\\webdictaat;Initial Catalog=webdictaat.test;Integrated Security=False;User ID=ssmulder;Password=password;Connect Timeout=60;Encrypt=False;TrustServerCertificate=True;ApplicationIntent=ReadWrite;MultiSubnetFailover=False")
                          .Options;

            _context = new WebdictaatContext(options);

            //managers and factories
            _dictaatFactory = new Mock <IDictaatFactory>();
            _dictaatFactory.Setup(df => df.GetDictaat(It.IsAny <string>())).Returns(new Domain.Dictaat()
            {
                Name = "Test"
            });
            _dictaatFactory.Setup(df => df.CopyDictaat(It.IsAny <string>(), It.IsAny <DictaatDetails>())).Returns(new Domain.Dictaat()
            {
                Name = "Test2"
            });
            _analytics = new Mock <IGoogleAnalytics>();

            //repos
            _assignmentRepo  = new AssignmentRepository(_context, null);
            _dictaatRepo     = new DictaatRepository(_config.Object, _analytics.Object, _dictaatFactory.Object, _context);
            _participantRepo = new ParticipantRepository(_context, umm.Object);
        }
예제 #3
0
        public void UpdateConfiguration(ConfigVariables cv)
        {
            Application.Current.Dispatcher.Invoke(() =>
            {
                Mouse.OverrideCursor = Cursors.Wait;
            });

            _serialPort.Open();
            _serialPort.WriteLine(cv.PayLoad);
        }
예제 #4
0
        public DictaatFactoryTest()
        {
            _config = new ConfigVariables()
            {
                DictaatRoot    = "C:\\webdictaat.test",
                PagesDirectory = "pages",
                MenuConfigName = "menu-config.json"
            };

            _fac = new DictaatFactory(_config, new Directory(), new File());
        }
예제 #5
0
        public MenuFactoryTest()
        {
            var config = new ConfigVariables()
            {
                DictaatRoot    = "C:\\webdictaat.test",
                PagesDirectory = "pages",
                MenuConfigName = "menu-config.json"
            };

            _fileMock    = new Mock <IFile>();
            _menuFactory = new Webdictaat.Core.MenuFactory(config, _fileMock.Object);
        }
        public void SetUp()
        {
            var configuration = new ConfigurationBuilder()
                                .AddUserSecrets <QuizMetadataServiceTest>()
                                .Build();
            var configVariables        = new ConfigVariables(configuration);
            var guardianApiHttpService = new GuardianApiHttpService(
                new RestClient("https://content.guardianapis.com/theguardian/"),
                configVariables);

            _quizMetadataService = new QuizMetadataService(guardianApiHttpService);
        }
예제 #7
0
        private void BtnUploadSettings_OnClick(object sender, RoutedEventArgs e)
        {
            var serialPort       = cbDevice.SelectedValue as SerialPort;
            var uploadController = new UploadController(serialPort);
            var config           = new ConfigVariables
            {
                ArrowWeight       = tbArrowWeight.Text,
                DrawLength        = tbDrawLength.Text,
                IboRating         = tbIboRating.Text,
                LbsOfForce        = tbLbsOfForce.Text,
                WeightOnBowstring = tbWeightOnBowstring.Text
            };

            uploadController.UpdateConfiguration(config);

            DataReceivedNotification(uploadController);
        }
        public void SetUp()
        {
            var configuration = new ConfigurationBuilder()
                                .AddUserSecrets <IntegrationTests>()
                                .Build();
            var configVariables        = new ConfigVariables(configuration);
            var guardianApiHttpService = new GuardianApiHttpService(
                new RestClient("https://content.guardianapis.com/theguardian/"),
                configVariables);

            _quizMetadataService = new QuizMetadataService(guardianApiHttpService);
            _quizService         = new QuizService(
                new GuardianScraperHttpService(new HttpClient()),
                new HtmlService(
                    new SectionExtractor(),
                    new HtmlStripper(),
                    new SectionSplitter(),
                    new QuestionAssembler()),
                _quizMetadataService);
        }
예제 #9
0
 public Account()
 {
     configV = new ConfigVariables();
 }
예제 #10
0
 public PathHelper(ConfigVariables configVariables)
 {
     _configVariables = configVariables;
 }