Holds the unique failure ids .
Beispiel #1
0
        /// <summary>
        /// Attempt each operation.
        /// Any exceptions from failures are caught and stored for later.
        /// </summary>
        /// <param name="actions">The list of actions.</param>
        /// <returns></returns>
        public SafeActions Attempt(IEnumerable <Action> actions)
        {
            foreach (Action action in actions)
            {
                try
                {
                    action();
                }
                catch (Exception e)
                {
                    Failures.Add(e);
                    FailureHandler(e);
                }
            }

            return(this);
        }
        public ValidateException(List <ValidationFailure> failures)
            : this()
        {
            var propertyNames = failures
                                .Select(e => e.PropertyName)
                                .Distinct();

            foreach (var propertyName in propertyNames)
            {
                var propertyFailures = failures
                                       .Where(e => e.PropertyName == propertyName)
                                       .Select(e => e.ErrorMessage)
                                       .ToArray();

                Failures.Add(propertyName, propertyFailures);
            }
        }
Beispiel #3
0
            /** <inheritdoc /> */
            public bool Invoke(Guid nodeId, string message)
            {
                try
                {
                    LastNodeIds.Push(nodeId);
                    ReceivedMessages.Push(message);

                    ReceivedEvent.Signal();

                    return(ListenResult);
                }
                catch (Exception ex)
                {
                    // When executed on remote nodes, these exceptions will not go to sender,
                    // so we have to accumulate them.
                    Failures.Push(string.Format("Exception in Listen (msg: {0}, id: {1}): {2}", message, nodeId, ex));
                    throw;
                }
            }
Beispiel #4
0
        public List <Type> GetDynamicTypes()
        {
            List <Type> dynamicTypes = new List <Type>();

            YamlFiles.Each(new { List = dynamicTypes }, (ctx, yf) =>
            {
                try
                {
                    ctx.List.AddRange(yf.DynamicTypes);
                }
                catch (Exception ex)
                {
                    FireEvent(YamlDeserializationFailed, new YamlEventArgs {
                        Schema = this, Files = this.Files, CurrentFile = yf, Exception = ex
                    });
                    Failures.Add(new YamlDeserializationFailure(yf, ex));
                }
            });

            return(dynamicTypes);
        }
Beispiel #5
0
        public void Install()
        {
            // Record that we have attempted an install.
            Attempted = true;

            // Can this be installed at this point?
            if (CanInstall)
            {
                // Possibly need to recreate the installer at this point.
                Installer = new Installer(Installer.TempInstallFolder, ModuleManifestName(Installer.TempInstallFolder), Globals.ApplicationMapPath, true);

                // Is the installer valid?
                if (Installer.IsValid)
                {
                    // Already installed?
                    if (Installer.InstallerInfo.Installed)
                    {
                        // Yes, make a repair install.
                        Installer.InstallerInfo.RepairInstall = true;
                    }

                    // Install.
                    Installer.Install();

                    // Did the package install successfully?
                    Success = Installer.IsValid;
                }

                // Record failures.
                foreach (LogEntry log in Installer.InstallerInfo.Log.Logs)
                {
                    if (log.Type.Equals(LogType.Failure))
                    {
                        string failure = log.ToString();

                        Failures.Add(failure);
                    }
                }
            }
        }
        public ValidationException(List <ValidationFailure> failures)
            : this()
        {
            var sb = new StringBuilder();

            var propertyNames = failures
                                .Select(e => e.PropertyName)
                                .Distinct();

            foreach (var propertyName in propertyNames)
            {
                var propertyFailures = failures
                                       .Where(e => e.PropertyName == propertyName)
                                       .Select(e => e.ErrorMessage)
                                       .ToArray();

                Failures.Add(propertyName, propertyFailures);
                sb.Append(string.Join(" ", propertyFailures));
            }

            AllFailuresMessage = sb.ToString();
        }
Beispiel #7
0
 internal new TestResultsHolder Clone()
 {
     return(new TestResultsHolder
     {
         Id = Id,
         ParentId = ParentId,
         IsSuite = IsSuite,
         Name = Name,
         Skipped = Skipped,
         Failure = Failure,
         Duration = Duration,
         Failures = Failures.ToList(),
         Nested = new List <SuiteOrTest>(Nested.Select(n => n.Clone())),
         Logs = Logs.ToList(),
         UserAgent = UserAgent,
         Running = Running,
         TestsFailed = TestsFailed,
         TestsFinished = TestsFinished,
         TestsSkipped = TestsSkipped,
         TotalTests = TotalTests
     });
 }
Beispiel #8
0
        public void Add(Failures failures)
        {
            var mappedFailure  = _mapper.Map <Entities.Tenant.Failures.Failure>(failures);
            var mappedFailures = new List <Entities.Tenant.Failures.Failure>()
            {
                mappedFailure
            };

            using var transaction = _dbContext.Specific.Database.BeginTransaction();

            _dbContext.BulkInsertEngine.BulkInsert(mappedFailures, new BulkInsertOptions {
                PreserveInsertOrder = true, SetOutputIdentity = true, BulkCopyTimeout = 300
            });

            mappedFailure.Items.ForEach(c => c.FailureId = mappedFailure.Id);

            _dbContext.BulkInsertEngine.BulkInsert(mappedFailure.Items, new BulkInsertOptions {
                BulkCopyTimeout = 300
            });

            transaction.Commit();
        }
Beispiel #9
0
        private void AddInMatrices(int row, int col, string buildingShort, int buildingIndex)
        {
            var temp = _matrixType[row, col].FirstOrDefault(s => s.Contains("@"));

            bool fail = !(_matrixType[row, col].Count == 0 ||
                          (temp != null && temp.Length <= 3));

            _matrixType[row, col].Add(buildingShort);
            _matrixIndex[row, col].Add(buildingIndex);
            if (fail)
            {
                var key = "" + row + "," + col;

                if (!Failures.ContainsKey(key))
                {
                    Failures.Add(key, string.Join("", _matrixType[row, col].ToArray()));
                }
                else
                {
                    Failures[key] += buildingShort;
                }
            }
        }
Beispiel #10
0
        private void ClearInMatrices(int row, int col, string buildingShort, int buildingIndex)
        {
            if (_matrixIndex[row, col].Contains(buildingIndex))
            {
                _matrixType[row, col].Remove(buildingShort);
                _matrixIndex[row, col].Remove(buildingIndex);

                var key = "" + row + "," + col;

                if (Failures.ContainsKey(key))
                {
                    if (_matrixType[row, col].Count < 2 ||
                        _matrixType[row, col].Contains("###") ||
                        (_matrixType[row, col].Count == 1 && _matrixType[row, col][0].Contains("@")))
                    {
                        Failures.Remove(key);
                    }
                    else
                    {
                        Failures[key] = string.Join("", _matrixType[row, col].ToArray());
                    }
                }
            }
        }
Beispiel #11
0
 public ValidationException(string key, string[] message) : this()
 {
     Failures.Add(key, message);
 }
Beispiel #12
0
 public ValidationException(string key, string message) : this()
 {
     Failures.Add(key, new string[1] {
         message
     });
 }
Beispiel #13
0
 // This should be called during [SetUp]
 public static void ClearFailures()
 {
     Failures.Clear();
 }
        private void CheckAppliedTemplates(TemplateManager.TemplateManager TM, ref MonsterStatBlock TestMonSB)
        {
            string CheckName        = "CheckAppliedTemplates";
            bool   stackedTemplates = false;

            if (_sbCheckerBaseInput.MonsterSB.TemplatesApplied.Contains(","))
            {
                stackedTemplates = true;                                                               //|1,2,3…@sk|
            }
            List <string> templates = _sbCheckerBaseInput.MonsterSB.TemplatesApplied.Split('|').ToList();

            templates.RemoveAll(x => x == string.Empty);
            List <string> stackedTemplateList = new List <string>();
            string        stackedTemplateBase = string.Empty;

            if (stackedTemplates)
            {
                FindStackTemplates(templates, ref stackedTemplateList, ref stackedTemplateBase);
            }

            foreach (string appliedTemplate in templates)
            {
                string lowerAppliedTemplate = appliedTemplate.ToLower();
                if (lowerAppliedTemplate.Contains("advanced") || lowerAppliedTemplate.Contains("advanced hd") || lowerAppliedTemplate.Contains("advanced-hd"))
                {
                    if (_sbCheckerBaseInput.MonsterSB.HDValue() - _sbCheckerBaseInput.CharacterClasses.FindTotalClassLevels() != _sbCheckerBaseInput.Race_Base.RacialHDValue())
                    {
                        TestMonSB = ApplyAdvancedHDTemplate(TM, TestMonSB);
                    }
                    else
                    {
                        if (TestMonSB != null)
                        {
                            List <string> Failures;
                            if (stackedTemplates)
                            {
                                TestMonSB = ApplyStackedTemplates(TM, TestMonSB, stackedTemplateList, stackedTemplateBase, out Failures);
                            }
                            else
                            {
                                if (templates.Count == 1)
                                {
                                    TestMonSB = ApplyOneTemplate(CheckName, TM, TestMonSB);
                                }
                                else
                                {
                                    TestMonSB = ApplyMultipleTemplates(TM, TestMonSB, templates, stackedTemplateList);
                                }
                            }
                            _sbCheckerBaseInput.Race_Base.ApplyTemplatedRaceSB(TestMonSB, true);
                        }
                    }
                }
                else
                {
                    if (TestMonSB != null)
                    {
                        bool             Success;
                        MonsterStatBlock tempmonSB = null;
                        List <string>    Failures;

                        if (stackedTemplates)
                        {
                            TestMonSB = ApplyStackedTemplates(TM, TestMonSB, stackedTemplateList, stackedTemplateBase, out Failures);
                            Success   = !Failures.Any();
                        }
                        else
                        {
                            TM.ApplyTemplate(TestMonSB, lowerAppliedTemplate.Trim(), out Success);
                        }
                        if (tempmonSB != null)
                        {
                            TestMonSB = tempmonSB;
                        }
                        if (!Success)
                        {
                            _sbCheckerBaseInput.MessageXML.AddFail("CheckTemplates", "Template not applied for " + lowerAppliedTemplate.Trim());
                        }
                        else
                        {
                            _sbCheckerBaseInput.MessageXML.AddInfo("Template Applied - " + lowerAppliedTemplate.Trim());
                            _sbCheckerBaseInput.Race_Base.ApplyTemplatedRaceSB(TestMonSB, true);
                        }
                    }
                }
            }
        }
 /// <summary>
 /// There are no comments for Failures in the schema.
 /// </summary>
 public void AddToFailures(Failures failures)
 {
     base.AddObject("Failures", failures);
 }
 public AppSubscriptionException(string failure)
     : base(failure)
 {
     Failures.Add(failure);
 }
Beispiel #17
0
 public ValidationResult(List <ValidationRuleResult> validationResults)
 {
     Failures = validationResults?.Where(result => result.Failed).ToList().AsReadOnly() ?? throw new ArgumentNullException(nameof(validationResults));
     Failed   = Failures.Any();
 }
Beispiel #18
0
 public AppBusinessException(string failure)
     : base(failure)
 {
     Failures.Add(failure);
 }
 /// <summary>
 /// Create a new Failures object.
 /// </summary>
 /// <param name="ID">Initial value of Id.</param>
 /// <param name="testId">Initial value of TestId.</param>
 /// <param name="changed">Initial value of Changed.</param>
 public static Failures CreateFailures(int ID, int testId, global::System.DateTime changed)
 {
     Failures failures = new Failures();
     failures.Id = ID;
     failures.TestId = testId;
     failures.Changed = changed;
     return failures;
 }
Beispiel #20
0
 private void DisplayFailures(Failures fails)
 {
     bsFails.DataSource = fails;
     Text = $"Design Storm {fails.DesignStorm} Failures";
 }
Beispiel #21
0
 public ValidationException(List <IdentityError> failures)
     : this()
 {
     Failures.Add("general", failures.Select(x => x.Description).ToArray());
 }
Beispiel #22
0
 public FailuresForm(Failures fails)
 {
     InitializeComponent();
     DisplayFailures(fails);
 }
Beispiel #23
0
 private R(E error)
 {
     IsSuccess = false;
     Failures.Add(error);
 }
Beispiel #24
0
 public BadRequestException(string message)
     : this()
 {
     Failures.Add("message", new string[] { message });
 }
Beispiel #25
0
 public void Insert(Failures failures) => Add(failures);
Beispiel #26
0
 /// <inheritdoc/>
 public override Workspace WithExtraFailures(IEnumerable <Failure> failures)
 {
     Contract.Requires(failures != null);
     return(new SemanticWorkspace(WorkspaceProvider, WorkspaceConfiguration, SpecModules, PreludeModule, ConfigurationModule, m_semanticModel, Failures.Union(failures).ToList()));
 }
Beispiel #27
0
 internal void AddFailure(SessionRemoteException failure)
 {
     Failures.InternalAdd(failure);
 }
Beispiel #28
0
 public ValidationException(string propertyName, string errorMessage)
     : this()
 {
     Failures.Add(propertyName, new[] { errorMessage });
 }
Beispiel #29
0
 internal bool ShouldHalt() => HaltsOnFirstFailure && Failures.Any();
Beispiel #30
0
 public bool IsSuccessful()
 {
     return(!Failures.Any());
 }