protected virtual List <IStep> GetAvailableSteps()
        {
            StepFactory  sf    = new StepFactory();
            List <IStep> steps = sf.GetStepsOfType <ICommonStep>();

            return(steps);
        }
 public void BeforeTest()
 {
     _hotelSystemDouble  = A.Fake <HotelSystem>();
     _stepFactoryDouble  = A.Fake <StepFactory>();
     _stepExecutorDouble = A.Fake <StepsExecutor>();
     _subject            = new ReserveHotelUsecase(_hotelSystemDouble, _stepFactoryDouble, _stepExecutorDouble);
 }
Esempio n. 3
0
        protected override StepResult HandleResult(string result, Queue <ConfigInitWizardStep> steps, Config config, string workingDirectory)
        {
            if (string.IsNullOrWhiteSpace(result))
            {
                return(StepResult.InvalidResponseSelected());
            }

            var configureBranchStep = StepFactory.CreateStep <ConfigureBranch>();

            switch (result)
            {
            case "0":
                steps.Enqueue(configureBranchStep.WithData(name, branchConfig));
                return(StepResult.Ok());

            case "1":
                branchConfig.Tag = string.Empty;
                steps.Enqueue(configureBranchStep.WithData(name, branchConfig));
                return(StepResult.Ok());

            default:
                branchConfig.Tag = result;
                steps.Enqueue(configureBranchStep.WithData(name, branchConfig));
                return(StepResult.Ok());
            }
        }
        /// <summary>
        /// returns a description of the failure
        /// </summary>
        /// <param name="p_Test"></param>
        /// <returns></returns>
        private string GenerateFailedLog(IRun p_Test)
        {
            try
            {
                StepFactory sf = p_Test.StepFactory as StepFactory;
                if (sf == null)
                {
                    return("");
                }
                IList stepList = sf.NewList("") as IList;
                if (stepList == null)
                {
                    return("");
                }

                //var stList = p_Test.StepFactory.NewList("");
                //string l_szReturn = "";
                string l_szFailedMessage = "";

                //' loop on each step in the steps
                foreach (IStep s in stepList)
                {
                    if (s.Status == "Failed")
                    {
                        l_szFailedMessage += s["ST_DESCRIPTION"] + "'\n\r";
                    }
                }
                return(l_szFailedMessage);
            }
            catch
            {
                return("");
            }
        }
Esempio n. 5
0
        protected override StepResult HandleResult(string result, Queue <ConfigInitWizardStep> steps, Config config, string workingDirectory)
        {
            if (int.TryParse(result, out var parsed))
            {
                if (parsed == 0)
                {
                    steps.Enqueue(StepFactory.CreateStep <EditConfigStep>());
                    return(StepResult.Ok());
                }

                try
                {
                    var foundBranch  = OrderedBranches(config).ElementAt(parsed - 1);
                    var branchConfig = foundBranch.Value;
                    if (branchConfig == null)
                    {
                        branchConfig = new BranchConfig {
                            Name = foundBranch.Key
                        };
                        config.Branches.Add(foundBranch.Key, branchConfig);
                    }
                    steps.Enqueue(StepFactory.CreateStep <ConfigureBranch>().WithData(foundBranch.Key, branchConfig));
                    return(StepResult.Ok());
                }
                catch (ArgumentOutOfRangeException)
                { }
            }

            return(StepResult.InvalidResponseSelected());
        }
Esempio n. 6
0
 public void GetStepsWithEmptySettings()
 {
     //Arrange
     //Act
     //Assert
     IEnumerable <IStep> steps = new StepFactory().Get(new Settings());
 }
Esempio n. 7
0
 internal bool Add(Run therun)
 {
     try {
         StepFactory runstepF = therun.StepFactory as StepFactory;
         Step        thestep  = runstepF.AddItem(_stepName) as Step;
         thestep.Status            = _status;
         thestep["ST_ACTUAL"]      = _actual; //add actual field
         thestep["ST_DESCRIPTION"] = _Description;
         thestep["ST_EXPECTED"]    = _Expected;
         thestep.Post(); //add step
         if (File.Exists(_attachmentPath + "\\" + _attachmentName))
         {
             AttachmentFactory attachFact = thestep.Attachments as AttachmentFactory;
             Attachment        attachfile;
             IExtendedStorage  extStor;
             attachfile = attachFact.AddItem(_attachmentName) as Attachment;
             attachfile.Post();
             extStor            = attachfile.AttachmentStorage as IExtendedStorage;
             extStor.ClientPath = _attachmentPath;
             extStor.Save(_attachmentName, true);
         }
     } catch (Exception) {
         return(false);
     }
     return(true);
 }
Esempio n. 8
0
        public override string Solve()
        {
            var lines   = InputReader.ReadLines();
            var steps   = new StepFactory(_settings.StepSettings).Create(lines);
            var orderer = new InstructionHelper();

            return(orderer.Order(steps));
        }
 public UseCaseFactory()
 {
     _hotelSystem  = new HotelSystem();
     _stepFactory  = new StepFactory();
     _stepExecutor = new StepsExecutor();
     _systemInit   = new SystemInit();
     _systemInit.AddHotels(_hotelSystem);
 }
Esempio n. 10
0
        public LinkedList <IStep> Build()
        {
            IStepFactory stepFactory = new StepFactory();

            var settings = new ConfigurationFactory().Get(_configFiles.Values);

            var steps = stepFactory.Get(settings);

            return(new LinkedList <IStep>(steps));
        }
        protected override List <IStep> GetAvailableSteps()
        {
            List <IStep> steps = base.GetAvailableSteps();

            StepFactory sf = new StepFactory();

            steps.AddRange(sf.GetStepsOfType <IScaleUnitStep>());

            return(steps);
        }
Esempio n. 12
0
        public override string Solve()
        {
            var lines             = InputReader.ReadLines();
            var steps             = new StepFactory(_settings.StepSettings).Create(lines);
            var instructionHelper = new InstructionHelper();

            var time = instructionHelper.TimeToAssemble(steps, _settings.WorkerSettings.WorkerCount);

            return(time.ToString());
        }
Esempio n. 13
0
        public void StepFactory_AllowsSettingDurationOffset(string line, char testedStep, int duration, int durationOffset, StepSettings stepSettings)
        {
            stepSettings.DurationOffset = durationOffset;
            var lines = new List <string> {
                line
            };

            var steps = new StepFactory(stepSettings).Create(lines);

            Assert.Equal(duration, steps.First(x => x.Name == testedStep).Duration);
        }
Esempio n. 14
0
        // for Test
        SequenceFile GenerateTestSequenceFile()
        {
            SequenceFile seqFile = new SequenceFile();

            seqFile.Name                  = "TestSequenceFile";
            seqFile.Description           = "This is a test sequenceFile.";
            seqFile.Comment               = "Nothing";
            seqFile.Version.MarjorVersion = "1";

            ISequence mainSequence = SequenceFactory.CreateSequence(SequenceTypes.Normal);

            mainSequence.Name          = "MainSequence1";
            mainSequence.Description   = "Main sequence for test.";
            mainSequence.EnableLogging = false;
            mainSequence.TestTimeout   = 3000;
            mainSequence.BreakPoint    = true;

            IStep actionStep = StepFactory.CreateStep(StepTypes.Action);

            actionStep.Name        = "Action step test";
            actionStep.Description = "this is a test action step";
            IAdaptor adaptor = AdaptorFactory.CreateAdaptor(AdaptorTypes.DotnetAdaptor);

            adaptor.MethodName     = "Test";
            adaptor.TestModuleName = "DotNetTest.dll";
            adaptor.Parameters.Add(new DotNetParameter());
            adaptor.Parameters.Add(new DotNetParameter("parameter1"));
            adaptor.Parameters.Add(new DotNetParameter("parameter2"));
            actionStep.Adaptor = adaptor;

            IStep subActionStep = StepFactory.CreateStep(StepTypes.Action);

            subActionStep.Name        = "SubAction step test";
            subActionStep.Description = "this is a sub test action step";

            actionStep.Children.Add(subActionStep);

            mainSequence.Children.Add(actionStep);
            mainSequence.Children.Add(subActionStep);
            mainSequence.Children.Add(subActionStep);

            ISequence mainSequence2 = SequenceFactory.CreateSequence(SequenceTypes.Normal);

            mainSequence2.Name          = "MainSequence2";
            mainSequence2.Description   = "Main sequence 2 for test.";
            mainSequence2.EnableLogging = false;
            mainSequence2.TestTimeout   = 3000;
            mainSequence2.BreakPoint    = true;

            seqFile.Sequences.Add(mainSequence);
            seqFile.Sequences.Add(mainSequence2);
            return(seqFile);
        }
Esempio n. 15
0
        public void GetStepsForConfigFileOnly()
        {
            //Arrange
            Settings settings = new ConfigurationFactory()
                                .Get(FileProvider.Configuration.SettingsZipping.AsOneItemList());

            //Act
            IEnumerable <IStep> steps = new StepFactory().Get(settings);

            //Assert
            Assert.AreEqual(3, steps.Count());
        }
Esempio n. 16
0
        public void LoadOnlySharedConfiguration()
        {
            //Arrange
            Settings settings = new ConfigurationFactory()
                                .Get(FileProvider.Configuration.SharedSettings.AsOneItemList());

            //Act
            IEnumerable <IStep> steps = new StepFactory().Get(settings);

            //Assert
            Assert.AreEqual(steps.Count(), 0);
        }
Esempio n. 17
0
        public void Step_ParsesLineToCorrectStepsWithPrerequisiteAndNext(string line, char step1, char step2, StepSettings stepSettings)
        {
            var lines = new List <string> {
                line
            };

            var steps = new StepFactory(stepSettings).Create(lines);

            Assert.Equal(2, steps.Count);
            Assert.Equal(step2, steps.First(x => x.Name == step1).NextSteps.First().Name);
            Assert.Empty(steps.First(x => x.Name == step2).NextSteps);
            Assert.Equal(step1, steps.First(x => x.Name == step2).PrerequisiteSteps.First().Name);
            Assert.Empty(steps.First(x => x.Name == step1).PrerequisiteSteps);
        }
Esempio n. 18
0
        public void InstructionHelper_IdentifiesTheFirstStep(StepSettings stepSettings)
        {
            var lines = new List <string> {
                "Step C must be finished before step A can begin.",
                "Step C must be finished before step F can begin.",
            };

            var steps             = new StepFactory(stepSettings).Create(lines);
            var instructionHelper = new InstructionHelper();

            var result = instructionHelper.Order(steps);

            Assert.Equal('C', result.First());
        }
Esempio n. 19
0
        protected Step astar(IntVec3 start)
        {
            if (stepCache == null)
            {
                stepCache = new StepFactory();
            }
            stepCache.Reset(dest, costPerMoveCardinal, costPerMoveDiagonal, Math.Max(Math.Abs(start.x - dest.Cell.x), Math.Abs(start.z - dest.Cell.z)) > maxDistanceBeforeCheating, mapSizeX, mapSizeZ);
            openlist = openlistShared;
            if (openlist == null)
            {
                openlist       = new Priority_Queue.FastPriorityQueue <Step>(limitForSearch + 10);
                openlistShared = openlist;
            }
            else
            {
                openlist.Clear();
            }
            List <int> destCells = CalculateAllowedDestCells(map, dest, peMode, traverseParms);

            // Initialisierung der Open List, die Closed List ist noch leer
            // (die Priorität bzw. der f Wert des Startknotens ist unerheblich)
            Step firstStep = stepCache.getCachedOrNewStep(start, cellIndices.CellToIndex(start));

            openlist.Enqueue(firstStep, 0);
            // diese Schleife wird durchlaufen bis entweder
            // - die optimale Lösung gefunden wurde oder
            // - feststeht, dass keine Lösung existiert
            while (openlist.Count != 0)
            {
                // Knoten mit dem geringsten f Wert aus der Open List entfernen
                Step currentStep = openlist.Dequeue();
                // Wurde das Ziel gefunden?
                if (destCells.Contains(currentStep.currentIndx))
                {
                    return(currentStep);
                }
                if (stepCache.Count >= limitForSearch)
                {
                    return(null);
                }
                // Wenn das Ziel noch nicht gefunden wurde: Nachfolgeknoten
                // des aktuellen Knotens auf die Open List setzen
                expandNode(currentStep);
                // der aktuelle Knoten ist nun abschließend untersucht
                currentStep.closed = true;
                //if ( drawPath ) map.debugDrawer.FlashCell(currentStep.current, 0.9f, "closed", 100);
            }
            // die Open List ist leer, es existiert kein Pfad zum Ziel
            return(null);
        }
Esempio n. 20
0
        /// <summary>
        /// summerizes test steps after test has run
        /// </summary>
        /// <param name="test"></param>
        /// <returns>a string containing descriptions of step states and messags</returns>
        string GetTestStepsDescFromQc(ITSTest test)
        {
            StringBuilder sb = new StringBuilder();

            try
            {
                //get runs for the test
                RunFactory rfactory = test.RunFactory;
                List       runs     = rfactory.NewList("");
                if (runs.Count == 0)
                {
                    return("");
                }

                //get steps from run
                StepFactory stepFact = runs[runs.Count].StepFactory;
                List        steps    = stepFact.NewList("");
                if (steps.Count == 0)
                {
                    return("");
                }

                //go over steps and format a string
                foreach (IStep step in steps)
                {
                    sb.Append("Step: " + step.Name);

                    if (!string.IsNullOrWhiteSpace(step.Status))
                    {
                        sb.Append(", Status: " + step.Status);
                    }

                    string desc = step["ST_DESCRIPTION"] as string;
                    if (!string.IsNullOrEmpty(desc))
                    {
                        desc = "\n\t" + desc.Trim().Replace("\n", "\t").Replace("\r", "");
                        if (!string.IsNullOrWhiteSpace(desc))
                        {
                            sb.AppendLine(desc);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                sb.AppendLine("Exception while reading step data: " + ex.Message);
            }

            return(sb.ToString().TrimEnd());
        }
Esempio n. 21
0
        protected override StepResult HandleResult(string result, Queue <ConfigInitWizardStep> steps, Config config, string workingDirectory)
        {
            switch (result)
            {
            case "0":
                steps.Enqueue(StepFactory.CreateStep <EditConfigStep>());
                return(StepResult.Ok());

            case "1":
                steps.Enqueue(StepFactory.CreateStep <AppveyorPublicPrivate>());
                return(StepResult.Ok());
            }
            return(StepResult.Ok());
        }
Esempio n. 22
0
        public void InstructionHelper_PicksNextStepAlpabeticallyFromAllAvailable(StepSettings stepSettings)
        {
            var lines = new List <string> {
                "Step C must be finished before step A can begin.",
                "Step C must be finished before step F can begin.",
                "Step A must be finished before step B can begin.",
            };

            var steps             = new StepFactory(stepSettings).Create(lines);
            var instructionHelper = new InstructionHelper();

            var result = instructionHelper.Order(steps);

            Assert.Equal("CABF", result);
        }
Esempio n. 23
0
        public void InstructionHelper_TimeToAssemble_TwoWorkersSolvesTwoBlockedSteps(string line, int duration, StepSettings stepSettings, WorkerSettings workerSettings)
        {
            stepSettings.DurationOffset = 0;
            workerSettings.WorkerCount  = 2;
            var lines = new List <string> {
                line
            };

            var steps             = new StepFactory(stepSettings).Create(lines);
            var instructionHelper = new InstructionHelper();

            var result = instructionHelper.TimeToAssemble(steps, workerSettings.WorkerCount);

            Assert.Equal(duration, result);
        }
Esempio n. 24
0
        public void InstructionHelper_TimeToAssemble_TwoWorkersSolvesThreeSteps(StepSettings stepSettings, WorkerSettings workerSettings)
        {
            stepSettings.DurationOffset = 0;
            workerSettings.WorkerCount  = 2;
            var lines = new List <string> {
                "Step C must be finished before step B can begin.",
                "Step C must be finished before step F can begin.",
            };

            var steps             = new StepFactory(stepSettings).Create(lines);
            var instructionHelper = new InstructionHelper();

            var result = instructionHelper.TimeToAssemble(steps, workerSettings.WorkerCount);

            Assert.Equal(9, result);
        }
Esempio n. 25
0
        public void Step_ParsesTwoLinesWithThreeSteps(StepSettings stepSettings)
        {
            var lines = new List <string> {
                "Step C must be finished before step A can begin.",
                "Step C must be finished before step F can begin.",
            };

            var steps = new StepFactory(stepSettings).Create(lines);

            Assert.Equal(3, steps.Count);

            Assert.Contains(steps.First(x => x.Name == 'A').PrerequisiteSteps, x => x.Name == 'C');
            Assert.Contains(steps.First(x => x.Name == 'F').PrerequisiteSteps, x => x.Name == 'C');

            Assert.Contains(steps.First(x => x.Name == 'C').NextSteps, x => x.Name == 'A');
            Assert.Contains(steps.First(x => x.Name == 'C').NextSteps, x => x.Name == 'F');
        }
Esempio n. 26
0
        public void GetStepsWithReferences()
        {
            //Arrange
            FileInfo[] configFiles = new FileInfo[]
            {
                FileProvider.Configuration.SettingsZippingWithReferences,
                FileProvider.Configuration.SettingsZippingWithReferencesShared
            };

            Settings settings = new ConfigurationFactory()
                                .Get(configFiles);

            //Act
            IEnumerable <IStep> steps = new StepFactory().Get(settings).ToList();

            //Assert
            Assert.AreEqual(3, steps.Count());
        }
Esempio n. 27
0
        protected override StepResult HandleResult(string result, Queue <ConfigInitWizardStep> steps, Config config, string workingDirectory)
        {
            switch (result)
            {
            case "0":
                steps.Enqueue(StepFactory.CreateStep <EditConfigStep>());
                return(StepResult.Ok());

            case "1":
                steps.Enqueue(StepFactory.CreateStep <AppVeyorSetup>().WithData(ProjectVisibility.Public));
                return(StepResult.Ok());

            case "2":
                steps.Enqueue(StepFactory.CreateStep <AppVeyorSetup>().WithData(ProjectVisibility.Private));
                return(StepResult.Ok());
            }
            return(StepResult.Ok());
        }
        protected override StepResult HandleResult(string result, Queue <ConfigInitWizardStep> steps, Config config, string workingDirectory)
        {
            switch (result.ToLower())
            {
            case "y":
                Console.Write(@"Because you need to maintain multiple versions of your product in production at the same time, GitFlow is likely a good fit.

GitFlow allows you to have new development happening on the 'develop' branch, patch issues in old minor versions with 'hotfix/' branches and support old major versions with 'support/' branches");
                steps.Enqueue(StepFactory.CreateStep <PickBranchingStrategyStep>());
                return(StepResult.Ok());

            case "n":
                steps.Enqueue(StepFactory.CreateStep <PickBranchingStrategy2Step>());
                return(StepResult.Ok());
            }

            return(StepResult.InvalidResponseSelected());
        }
Esempio n. 29
0
        protected override StepResult HandleResult(string result, Queue <ConfigInitWizardStep> steps, Config config, string workingDirectory)
        {
            var editConfigStep = StepFactory.CreateStep <EditConfigStep>();

            if (string.IsNullOrEmpty(result))
            {
                steps.Enqueue(editConfigStep);
                return(StepResult.Ok());
            }

            if (!SemanticVersion.TryParse(result, string.Empty, out var semVer))
            {
                return(StepResult.InvalidResponseSelected());
            }

            config.NextVersion = semVer.ToString("t");
            steps.Enqueue(editConfigStep);
            return(StepResult.Ok());
        }
Esempio n. 30
0
        protected override StepResult HandleResult(string result, Queue <ConfigInitWizardStep> steps, Config config, string workingDirectory)
        {
            switch (result)
            {
            case "0":
                steps.Enqueue(StepFactory.CreateStep <ConfigureBranches>());
                return(StepResult.Ok());

            case "1":
                steps.Enqueue(StepFactory.CreateStep <SetBranchTag>().WithData(name, branchConfig));
                return(StepResult.Ok());

            case "2":
                steps.Enqueue(StepFactory.CreateStep <SetBranchIncrementMode>().WithData(name, branchConfig));
                return(StepResult.Ok());
            }

            return(StepResult.InvalidResponseSelected());
        }