Exemplo n.º 1
0
        public MutationConfigWindowViewModel(EnvironmentService environmentService, SolutionInfoService solutionInfoService)
        {
            _environmentService  = environmentService;
            _solutionInfoService = solutionInfoService;

            TestRunnerTypes = new List <string> {
                "DotNet"
            };

            TestProjectChangedCommand = new DelegateCommand <string>(TestProjectChanged);
            AddFileCommand            = new DelegateCommand(AddFileToFilter);
            AddLineCommand            = new DelegateCommand(AddLineToFilter);
            AddCodeConstrainCommand   = new DelegateCommand(AddCodeConstrainToFilter);

            ProjectGridItems          = new ObservableCollection <ConfigProjectGridItem>();
            NumberOfParallelTestRuns  = 3;
            MutationOperatorGridItems = new ObservableCollection <MutationOperatorGridItem>(Enum
                                                                                            .GetValues(typeof(MutationOperators)).Cast <MutationOperators>().Select(m =>
                                                                                                                                                                    new MutationOperatorGridItem
            {
                IsSelected       = true,
                MutationOperator = m,
                Description      = m.GetValue()
            }));

            _jsonSettings = new JsonSerializerSettings();

            _jsonSettings.NullValueHandling = NullValueHandling.Ignore;
            _jsonSettings.Converters.Add(new Newtonsoft.Json.Converters.StringEnumConverter());
        }
Exemplo n.º 2
0
		public void TestConstructorSpecificEnvironment()
		{
			string myEnv = "FlagscriptEnvironment";
			IEnvironmentService environmentService = new EnvironmentService(myEnv);
			ConfigurationService configurationService = new ConfigurationService(environmentService);
			Assert.Equal(myEnv, configurationService.EnvironmentService.EnvironmentName);
		}
Exemplo n.º 3
0
        public TableStorageConfigurationServiceTestsFixture SetupEnvironmentService()
        {
            EnvironmentService.Setup(x => x.GetVariable(EnvironmentVariableNames.Environment)).Returns(ExpectedEnvironment);
            EnvironmentService.Setup(x => x.GetVariable(EnvironmentVariableNames.ConfigurationStorageConnectionString)).Returns(ExpectedConfigurationConnectionString);

            return(this);
        }
Exemplo n.º 4
0
        public static void Main(string[] args)
        {
            var config             = SwimbaitConfig.Get();
            var environmentService = new EnvironmentService(config);

            //var swimbaitConfig = config.GetSection("Swimbait");

            //var s = swimbaitConfig["RelayHost"];


            var activity = File.ReadAllLines(environmentService.ActivityLogFilename);
            int counter  = 1;

            foreach (var line in activity)
            {
                var log = RequestLog.FromCsv(line);

                if (log.Method == "GET")
                {
                    var swimbaitResponse = UriService.GetResponse(environmentService.IpAddress, log.ActualPort, log.PathAndQuery);
                    var yamahaResponse   = UriService.GetResponse(IPAddress.Parse("192.168.1.213"), log.YamahaPort, log.PathAndQuery);

                    var logService = new LogService(environmentService);
                    logService.LogToDisk(counter, swimbaitResponse);
                    logService.LogToDisk(counter, yamahaResponse);
                }

                counter++;
            }
        }
Exemplo n.º 5
0
        public void ThenCreatedEnvironmentAppearsInPostman()
        {
            var getAllResponse = new EnvironmentService().GetAllEnvironments();
            var postResponse   = ScenarioContext.Current["envPostResponse"] as EnvironmentInfoModel;

            getAllResponse.environments.Any(i => i.uid.Equals(postResponse.environment.uid)).Should().BeTrue();
        }
Exemplo n.º 6
0
        public void ThenNameOfEnvironmentWasUpdatedTo(string newName)
        {
            var getAllResponse = new EnvironmentService().GetAllEnvironments();
            var postResponse   = ScenarioContext.Current["envPostResponse"] as EnvironmentInfoModel;

            getAllResponse.environments.FirstOrDefault(i => i.uid.Equals(postResponse.environment.uid)).name.Should().Equals(newName);
        }
Exemplo n.º 7
0
        public void IHaveEnvironmentWithName(string environmentName)
        {
            var contentModel = CreateModel(environmentName);
            var postResponse = new EnvironmentService().CreateEnvironment(contentModel);

            ScenarioContext.Current["envPostResponse"] = postResponse;
        }
Exemplo n.º 8
0
        public void WhenISendGETRequestToPostmanEnvironmentsApiWithUidOfThisEnvironment()
        {
            var postResponse      = ScenarioContext.Current["envPostResponse"] as EnvironmentInfoModel;
            var getSingleResponse = new EnvironmentService().GetSingleEnvironment(postResponse.environment.uid);

            ScenarioContext.Current["envGetSingleResponse"] = getSingleResponse;
        }
Exemplo n.º 9
0
        public void ThenEnvironmentWasDeleted()
        {
            var getAllResponse = new EnvironmentService().GetAllEnvironments();
            var postResponse   = ScenarioContext.Current["envPostResponse"] as EnvironmentInfoModel;

            getAllResponse.environments.All(i => i.uid.Equals(postResponse.environment.uid)).Should().BeFalse();
        }
Exemplo n.º 10
0
        public ActionResult Create()
        {
            var viewModel = new ServerViewModel();

            viewModel.SelectableEnvironments = EnvironmentService.GetAll().ToList();
            return(View(viewModel));
        }
        public void Should_Create_New_Environment()
        {
            var fakeContext = new FakeContext("CreateNewEnvironment");

            var fakeEnvironment = new Environment();

            fakeEnvironment.Name = "full name";

            using (var context = new MainContext(fakeContext.FakeOptions))
            {
                var repository    = new EnvironmentRepository(context);
                var mockValidator = new Mock <IValidator <Environment> >(MockBehavior.Strict);

                mockValidator
                .Setup(x => x.Validate(fakeEnvironment))
                .Returns(new FluentValidation.Results.ValidationResult());

                var service = new EnvironmentService(repository, mockValidator.Object);
                var actual  = service.Create(fakeEnvironment);
                var id      = actual.Id;

                Assert.NotEqual(0, id);
                repository.Dispose();
            }
        }
Exemplo n.º 12
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddRazorPages();
            services.AddSignalR(
                o =>
            {
                o.EnableDetailedErrors      = true;
                o.MaximumReceiveMessageSize = 2000000;
            })
            .AddJsonProtocol(options => { options.PayloadSerializerOptions.Converters.Add(new JsonStringEnumConverter()); });
            services.AddCors();
            var runnerConfig = Configuration.GetSection("RunnerConfig");

            services.Configure <RunnerConfig>(runnerConfig);

            services.AddSingleton <IConfigurationService, ConfigurationService>();
            services.AddSingleton <IRunnerStateService, RunnerStateService>();
            services.AddSingleton <IEnvironmentService, EnvironmentService>();
            services.AddSingleton <ITimerService, TimerService>();

            services.AddTransient <ICloudCallbackFactory, CloudCallbackFactory>();

            var envarService = new EnvironmentService();

            if (envarService.IsCloud)
            {
                services.AddTransient <ICloudIntegrationService, CloudIntegrationService>();
            }
            else
            {
                services.AddTransient <ICloudIntegrationService, NoOpCloudIntegrationService>();
            }
        }
Exemplo n.º 13
0
        private void PopulateSelectListsToModel(BindingViewModel viewModel, IBinding binding)
        {
            if (viewModel != null)
            {
                if (viewModel.SelectedWebsiteId > 0)
                {
                    binding.Website = WebsiteService.GetById(viewModel.SelectedWebsiteId);
                }

                if (viewModel.SelectedServerIds.Any())
                {
                    if (binding.Servers == null)
                    {
                        binding.Servers = new HashSet <IServer>();
                    }
                    foreach (long selectedServerId in viewModel.SelectedServerIds)
                    {
                        binding.Servers.Add(ServerService.GetById(selectedServerId));
                    }
                }
                if (viewModel.SelectedEnvironmentIds.Any())
                {
                    if (binding.Environments == null)
                    {
                        binding.Environments = new HashSet <IEnvironment>();
                    }
                    foreach (long selectedEnvironmentId in viewModel.SelectedEnvironmentIds)
                    {
                        binding.Environments.Add(EnvironmentService.GetById(selectedEnvironmentId));
                    }
                }
            }
        }
        public void TestNamedConstructorValue()
        {
            string             flagEnv            = "FlagscriptEnvironment";
            EnvironmentService environmentService = new EnvironmentService(flagEnv);

            Assert.Equal(flagEnv, environmentService.EnvironmentName);
        }
Exemplo n.º 15
0
        private IEnvironmentService CreateEnvironmentService()
        {
            var service = new EnvironmentService(messageBus);

            registerToMessageBus.Register <ISettingUpdatedMessage>(service);
            return(service);
        }
Exemplo n.º 16
0
        //https://github.com/commandlineparser/commandline
        //https://github.com/dotnet/command-line-api

        public static int Main(string[] args)
        {
            var environmentService      = new EnvironmentService();
            var traceService            = new FileTraceService();
            var localVersionService     = new LocalVersionService(traceService);
            var migrationServiceFactory = new CLI.MigrationServiceFactory(traceService);
            var commandLineService      = new CommandLineService(migrationServiceFactory, localVersionService, environmentService, traceService);

            var resultCode = Parser.Default.ParseArguments <
                InitOption,
                RunOption,
                ListOption,
                NextVersionOption,
                VerifyOption,
                EraseOption,
                BaselineOption,
                RebaseOption>(args)
                             .MapResult(
                (InitOption opts) => Dispatch(commandLineService.RunInitOption, opts, traceService),
                (RunOption opts) => Dispatch(commandLineService.RunMigration, opts, traceService),
                (NextVersionOption opts) => Dispatch(commandLineService.IncrementVersion, opts, traceService),
                (ListOption opts) => Dispatch(commandLineService.RunListOption, opts, traceService),
                (VerifyOption opts) => Dispatch(commandLineService.RunVerify, opts, traceService),
                (EraseOption opts) => Dispatch(commandLineService.RunEraseOption, opts, traceService),
                (BaselineOption opts) => Dispatch(commandLineService.RunBaselineOption, opts, traceService),
                (RebaseOption opts) => Dispatch(commandLineService.RunRebaseOption, opts, traceService),
                (ArchiveOption opts) => Dispatch(commandLineService.RunArchiveOption, opts, traceService),
                errs => 1);

            return(resultCode);
        }
Exemplo n.º 17
0
 public EditorHandler(string rootPath, OpenIDE.Core.EditorEngineIntegration.ILocateEditorEngine editorFactory, EnvironmentService environment, Action <string> dispatch)
 {
     _rootPath      = rootPath;
     _editorFactory = editorFactory;
     _environment   = environment;
     _dispatch      = dispatch;
 }
        //Check that create a VDB call will return a response.
        public void ProvisionVdbTest()
        {
            // Create and valiate a session
            ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
            // Trust all certificates
            System.Net.ServicePointManager.ServerCertificateValidationCallback =
                ((sender, certificate, chain, sslPolicyErrors) => true);

            // Get a cookie + Authenticate
            Session.CreateSession(System.Environment.GetEnvironmentVariable("DELPHIX_USER"), System.Environment.GetEnvironmentVariable("DELPHIX_PASSWORD"), System.Environment.GetEnvironmentVariable("DELPHIX_URL"));
            string cookie = Session.jSessionId.Value;


            //Create helpers
            GroupService        groupHelper = new GroupService();
            EnvironmentService  delphixEnvironmentHelper = new EnvironmentService();
            SourceConfigService sourceConfigHelper       = new SourceConfigService();
            RepositoryService   repositoryHelper         = new RepositoryService();
            TimeflowService     timeflowHelper           = new TimeflowService();
            SourceService       sourceHelper             = new SourceService();
            DatabaseService     dbHelp = new DatabaseService();

            //Create a test group
            CreateGroupsResponse newGroupRef = groupHelper.CreateGroups("intTestGroup", true);

            if (newGroupRef.result.Equals("Group already exists"))
            {
                Console.WriteLine("A group named intTestGroup already exists.  An attempt to delete the existing one was made, but there are active databases within the group.");
            }

            //Create a target server on Delphix
        }
        public KeyVaultSettings Create()
        {
            if (File.Exists("keyvaultsettings.json"))
            {
                var settingsJson = File.ReadAllText("keyvaultsettings.json");
                var settings     = JsonConvert.DeserializeObject <KeyVaultSettings>(settingsJson);
                return(settings);
            }

            var environmentService = new EnvironmentService();
            var vault    = environmentService.GetVariable("vault");
            var clientId = environmentService.GetVariable("clientid");
            var secret   = environmentService.GetVariable("secret");


            if (vault == null || clientId == null || secret == null)
            {
                throw new InvalidOperationException("No keyvault information found. Add a keyvaultsettings.json file or environment variables");
            }

            return(new KeyVaultSettings()
            {
                Vault = vault,
                ClientId = clientId,
                Secret = secret
            });
        }
Exemplo n.º 20
0
        /// <summary>
        /// c# implementation of https://github.com/robidouille/robidouille/blob/master/raspicam_cv/RaspiCamTest.c
        /// </summary>
        public void Run()
        {
            Log.Info("Creating Window");
            var windowName = "PiCamCVSimpleTest";

            CvInvoke.NamedWindow(windowName); //Create the window using the specific name

            Log.Info("Creating capture");

            EnvironmentService.DemandUnix("OpenCV 3.0 deprecated these capture methods. Only supported with PiCamCv on Pi");
            var captureConfig = new CaptureConfig {
                Resolution = new Resolution(640, 480), Framerate = 25, Monochrome = true
            };
            var piConfig = PiCameraConfig.FromConfig(captureConfig);

            IntPtr capture = CvInvokeRaspiCamCV.cvCreateCameraCapture2(0, ref piConfig); // Index doesn't really matter

            do
            {
                IntPtr imagePtr = CvInvokeRaspiCamCV.cvQueryFrame(capture);
                using (var managedImage = Image <Bgr, Byte> .FromIplImagePtr(imagePtr))
                {
                    CvInvoke.Imshow(windowName, managedImage);
                }
            } while (CvInvoke.WaitKey(100) < 0);

            CvInvoke.DestroyWindow("RaspiCamTest");
            CvInvokeRaspiCamCV.cvReleaseCapture(ref capture);
        }
Exemplo n.º 21
0
        /// <summary>
        /// temp hack - shouldn't be internal
        /// </summary>
        internal static EnvironmentService GetEnvironmentService()
        {
            var config             = SwimbaitConfig.Get();
            var environmentService = new EnvironmentService(config);

            return(environmentService);
        }
 public EnvironmentTestsFixture()
 {
     AppSettings        = new NameValueCollection();
     ExpectedKey        = "keyone";
     ExpectedValue      = "valueone";
     ExpectedPrefix     = "APPSETTING_";
     EnvironmentService = new EnvironmentService();
 }
Exemplo n.º 23
0
        public App()
        {
            var environmentService = new EnvironmentService();

            Directory.CreateDirectory(environmentService.ProfilePath);
            ProfileOptimization.SetProfileRoot(environmentService.ProfilePath);
            ProfileOptimization.StartProfile("Startup.profile");
        }
Exemplo n.º 24
0
 public EnvironmentHandler(string token, Action <string> dispatch, ICodeEngineLocator locator, ILocateEditorEngine editorLocator, EnvironmentService environment)
 {
     _token         = token;
     _dispatch      = dispatch;
     _locator       = locator;
     _editorLocator = editorLocator;
     _environment   = environment;
 }
Exemplo n.º 25
0
        public EnvironmentServiceTest()
        {
            _fakeContext = new FakeContext("LevelTestes");
            _fakeContext.FillWithAll();

            _contexto   = new CentralErroContexto(_fakeContext.FakeOptions);
            _envService = new EnvironmentService(_contexto);
        }
Exemplo n.º 26
0
        public void Should_Return_Right_User_When_Find_By_Id(int id)
        {
            var environment = _fakeContext.GetFakeData <CentralErros.Models.Environment>().Find(x => x.Id == id);

            var service = new EnvironmentService(_contexto);
            var atual   = service.FindById(environment.Id);

            Assert.Equal(environment, atual, new EnvironmentIdComparer());
        }
        public FaceTrackingPanTiltController(IPanTiltMechanism panTiltMech, CaptureConfig captureConfig)
            : base(panTiltMech, captureConfig)
        {
            var environmentService = new EnvironmentService();
            var haarEyeFile        = new FileInfo(environmentService.GetAbsolutePathFromAssemblyRelative("haarcascades/haarcascade_eye.xml"));
            var haarFaceFile       = new FileInfo(environmentService.GetAbsolutePathFromAssemblyRelative("haarcascades/haarcascade_frontalface_default.xml"));

            _faceDetector = new FaceDetector(haarFaceFile.FullName, haarEyeFile.FullName);
        }
        public void TestIsStaging()
        {
            EnvironmentService environmentService = new EnvironmentService("sTaGiNG");

            Assert.True(environmentService.IsStaging);

            environmentService = new EnvironmentService("stg");
            Assert.False(environmentService.IsStaging);
        }
        public void TestIsQa()
        {
            EnvironmentService environmentService = new EnvironmentService("qA");

            Assert.True(environmentService.IsQa);

            environmentService = new EnvironmentService("myQ");
            Assert.False(environmentService.IsQa);
        }
        public void Should_Return_Ok_When_Find_All_Env()
        {
            var level = _fakeContext.GetFakeData <CentralErros.Models.Environment>().ToList();

            var service = new EnvironmentService(_contexto);
            var atual   = service.FindAll();

            Assert.Equal(level, atual, new EnvironmentIdComparer());
        }
Exemplo n.º 31
0
        public HaarCascadeControl()
        {
            InitializeComponent();

            var environmentService = new EnvironmentService();
            var cascadeFileInfo = new FileInfo(environmentService.GetAbsolutePathFromAssemblyRelative("haarcascades/haarcascade_lego_batman5.xml"));
            if (!cascadeFileInfo.Exists)
            {
                Log.WarnFormat("HaarCascadeControl failed to load cascade {0}", cascadeFileInfo.FullName);
            }
        }
Exemplo n.º 32
0
        public void ControlLoad(object sender, EventArgs e)
        {
            var environmentService = new EnvironmentService();
            var haarEyeFile = new FileInfo(environmentService.GetAbsolutePathFromAssemblyRelative("haarcascades/haarcascade_eye.xml"));
            var haarFaceFile = new FileInfo(environmentService.GetAbsolutePathFromAssemblyRelative("haarcascades/haarcascade_frontalface_default.xml"));

            _faceDetector = new FaceDetector(haarFaceFile.FullName, haarEyeFile.FullName);

            _sunglassOverlay2 = new AccessoryOverlay(environmentService.GetAbsolutePathFromAssemblyRelative("Resources/Images/sunglasses2.png"));
            _hatOverlay1 = new AccessoryOverlay(environmentService.GetAbsolutePathFromAssemblyRelative("Resources/Images/partyhat.png"));

            _classiferParams = new ClassifierParameters();
            classifierConfigControl.ConfigChanged += classifierConfigControl_ConfigChanged;
        }
Exemplo n.º 33
0
        private void SetupComboBox()
        {
            var environmentService = new EnvironmentService();
            var dummyFile =
                new FileInfo(environmentService.GetAbsolutePathFromAssemblyRelative("haarcascades/thisdoesnotexist.xml"));
            var files = dummyFile.Directory.GetFiles("*.xml");

            _comboBinding = true;
            comboBoxCascade.DataSource = new BindingSource(files, null);
            comboBoxCascade.DisplayMember = "Name";
            comboBoxCascade.ValueMember = "FullName";
            _comboBinding = false;
        }