コード例 #1
0
ファイル: ResultProxyTests.cs プロジェクト: ZHJEE/OpenTAP
        public void ResultTableName()
        {
            var      rl = new ResultValidator();
            TestPlan tp = new TestPlan();

            tp.ChildTestSteps.Add(new DelegateTestStep
            {
                RunAction = (r) =>
                {
                    r.Publish(new TestCls <double> {
                        X = 1.0
                    });
                    r.Publish(new TestCls <double> .TestCls2 <int> {
                        X = 1.0, Y = 1
                    });
                }
            });
            var run = tp.Execute(new[] { rl });

            Assert.AreEqual("TestCls`1", rl.Results.First().Name);
            Assert.AreEqual("TestCls2`1", rl.Results.Last().Name);
            bool anyNullGroup = run.Parameters.Any(x => x.Group == null);

            Assert.IsFalse(anyNullGroup);
        }
 public override void Given()
 {
     Logger     = new Logger <CsvHelperService <ResultCsvRecordRequest, CsvResponseModel <ResultCsvRecordResponse>, ResultCsvRecordResponse> >(new NullLoggerFactory());
     DataParser = new ResultParser();
     Validator  = new ResultValidator();
     Service    = new CsvHelperService <ResultCsvRecordRequest, CsvResponseModel <ResultCsvRecordResponse>, ResultCsvRecordResponse>(Validator, DataParser, Logger);
     FilePath   = Path.Combine(Path.GetDirectoryName(GetCodeBaseAbsolutePath()), _dataFilePath);
 }
コード例 #3
0
 public bool OptionsValid()
 {
     if ((ResultValidator.OptionsValid(this._table.ValidationOptions)) && this.PageHeader.OptionsValid())
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
コード例 #4
0
 public bool OptionsValid()
 {
     if (this.Table != null)
     {
         return(ResultValidator.OptionsValid(this.Table.ValidationOptions));
     }
     else
     {
         return(true);
     }
 }
コード例 #5
0
ファイル: Director.cs プロジェクト: SomeZyla/TsGui
        public void OnTimeoutReached()
        {
            if (GuiTimeout.Instance.IgnoreValidation == true)
            {
                foreach (IValidationGuiOption valop in this._optionlibrary.ValidationOptions)
                {
                    //validation needs disabling because LostFocus is a validation event
                    if (valop.ValidationHandler != null)
                    {
                        valop.ValidationHandler.Enabled = false;
                    }
                    valop.ClearToolTips();
                }

                if (GuiTimeout.Instance.CancelOnTimeout == false)
                {
                    this.Finish();
                }
                else
                {
                    this.Cancel();
                }
            }
            else
            {
                if (ResultValidator.OptionsValid(this._optionlibrary.ValidationOptions))
                {
                    if (GuiTimeout.Instance.CancelOnTimeout == false)
                    {
                        this.Finish();
                    }
                    else
                    {
                        this.Cancel();
                    }
                }
            }
        }
コード例 #6
0
ファイル: TsFreeText.cs プロジェクト: SomeZyla/TsGui
        public void RefreshValue()
        {
            string s = this._setvaluequerylist.GetResultWrangler()?.GetString();

            if (s != null)
            {
                //if required, remove invalid characters and truncate
                string invalchars = this.ValidationHandler.GetAllInvalidCharacters();
                if (!string.IsNullOrEmpty(invalchars))
                {
                    s = ResultValidator.RemoveInvalid(s, this.ValidationHandler.GetAllInvalidCharacters());
                }
                if (this.MaxLength > 0)
                {
                    s = ResultValidator.Truncate(s, this.MaxLength);
                }

                if (this.ControlText != s)
                {
                    this.ControlText = s;
                }
            }
        }
コード例 #7
0
        internal override bool MoveNext()
        {
            GlobalDebug.WriteLineIf(GlobalDebug.Info, "ADDNConstraintLinkedAttrSet", "Entering MoveNext");
            GlobalDebug.WriteLineIf(GlobalDebug.Info, "ADDNConstraintLinkedAttrSet", "Filter {0}", _constraintData);
            bool   match = false;
            string dn    = "NotSet";

            if (!base.MoveNext())
            {
                return(false);
            }
            else
            {
                while (!match)
                {
                    if (null == this.current)
                    {
                        return(false);
                    }

                    switch (_constraint)
                    {
                    case ConstraintType.ContainerStringMatch:

                        if (this.current is SearchResult)
                        {
                            dn = ((SearchResult)this.current).Properties["distinguishedName"][0].ToString();
                        }
                        else
                        {
                            dn = ((DirectoryEntry)this.current).Properties["distinguishedName"].Value.ToString();
                        }

                        if (dn.EndsWith((string)_constraintData, StringComparison.Ordinal))
                        {
                            match = true;
                        }

                        break;

                    case ConstraintType.ResultValidatorDelegateMatch:
                    {
                        ResultValidator resultValidator = _constraintData as ResultValidator;
                        if (resultValidator != null)
                        {
                            dSPropertyCollection resultPropCollection = null;
                            if (this.current is SearchResult)
                            {
                                resultPropCollection = new dSPropertyCollection(((SearchResult)this.current).Properties);
                            }
                            else
                            {
                                resultPropCollection = new dSPropertyCollection(((DirectoryEntry)this.current).Properties);
                            }
                            match = resultValidator.Invoke(resultPropCollection);
                        }
                        else
                        {
                            Debug.Fail("ADStoreCtx.ADDNConstraintLinkedAttrSet: Invalid constraint data. Expected: object of type ResultValidator");
                        }
                        break;
                    }

                    default:
                        Debug.Fail("ADStoreCtx.ADDNConstraintLinkedAttrSet: fell off end looking for " + _constraint.ToString());
                        break;
                    }

                    GlobalDebug.WriteLineIf(GlobalDebug.Info, "ADDNConstraintLinkedAttrSet", "Found {0} Match {1}", dn, match.ToString());

                    if (!match)
                    {
                        if (!this.MoveNext())
                        {
                            return(false);
                        }
                    }
                }

                return(match);
            }
        }
コード例 #8
0
        private void MergeTester(CanvasDocument baseDoc, BranchChange branchAChange, BranchChange branchBChange, ResultValidator resultValidator)
        {
            var branchADoc = new CanvasDocument(baseDoc);
            var branchBDoc = new CanvasDocument(baseDoc);

            branchAChange(branchADoc);
            branchBChange(branchBDoc);

            var mergeResult = CanvasMerger.Merge(branchADoc, branchBDoc, baseDoc);

            resultValidator(mergeResult);
        }
コード例 #9
0
ファイル: ResultProxyTests.cs プロジェクト: ZHJEE/OpenTAP
        public void ResultsProxyTest()
        {
            TestPlan tp = new TestPlan();

            tp.ChildTestSteps.Add(new DelegateTestStep
            {
                RunAction = (r) =>
                {
                    var rand = new Random();

                    IConvertible[] values = new IConvertible[3];
                    values[0]             = rand.NextDouble();
                    values[1]             = rand.NextDouble();
                    values[2]             = rand.NextDouble();

                    r.Publish("Publish1", new List <string> {
                        "a", "b", "c"
                    }, values);
                    r.Publish("Publish2", new List <string> {
                        "a", "b", "c"
                    }, values);
                    r.PublishTable("PublishTable", new List <string> {
                        "a", "b", "c"
                    }, values.Select(v => new IConvertible[1] {
                        v
                    }).ToArray());

                    values[0] = rand.NextDouble();
                    values[1] = rand.NextDouble();
                    values[2] = rand.NextDouble();

                    values[0] = "abc";
                    values[1] = "rand";
                    values[2] = "rand.NextDouble()";
                    r.Publish("PublishStrings", new List <string> {
                        "a", "b", "c"
                    }, values);

                    values[0] = null;
                    values[1] = "rand";
                    values[2] = true;
                    r.Publish("PublishMixed", new List <string> {
                        "a", "b", "c"
                    }, values);
                }
            });

            var rl = new ResultValidator();

            tp.Execute(new List <ResultListener> {
                rl
            });

            Assert.AreEqual(5, rl.Results.Count, "Number of results");
            foreach (var res in rl.Results)
            {
                Assert.IsTrue(res.Name.StartsWith("Publish"), "Name of result");
                Assert.AreEqual(3, res.Columns.Length, "Number of columns in " + res.Name);

                Assert.AreEqual(1, res.Columns[0].Data.Length);
                Assert.AreEqual(1, res.Columns[1].Data.Length);
                Assert.AreEqual(1, res.Columns[2].Data.Length);

                Assert.AreEqual("a", res.Columns[0].Name);
                Assert.AreEqual("b", res.Columns[1].Name);
                Assert.AreEqual("c", res.Columns[2].Name);
            }
        }
コード例 #10
0
 public bool ValidMinLengthTest(string StringValue, int MinLength)
 {
     return(ResultValidator.ValidMinLength(StringValue, MinLength));
 }
コード例 #11
0
 public string RemoveInvalidTest(string StringValue, string InvalidChars)
 {
     return(ResultValidator.RemoveInvalid(StringValue, InvalidChars));
 }
コード例 #12
0
 public bool DoesStringContainCharactersTest(string StringValue, string InvalidChars, bool CaseSensitive)
 {
     return(ResultValidator.DoesStringContainCharacters(StringValue, InvalidChars, CaseSensitive));
 }
コード例 #13
0
 public string TruncateTest(string StringValue, int Length)
 {
     return(ResultValidator.Truncate(StringValue, Length));
 }