How to use ReferenceXml class of NBi.Xml.Settings package

Best NBi code snippet using NBi.Xml.Settings.ReferenceXml

SharedDatasetXml.cs

Source:SharedDatasetXml.cs Github

copy

Full Screen

...33 if (!Parameters.Exists(p => p.Name == param.Name))34 list.Add(param);35 return list;36 }37 public void AssignReferences(IEnumerable<ReferenceXml> references)38 {39 if (string.IsNullOrEmpty(Source))40 Source = Default.Report.Source;41 if (string.IsNullOrEmpty(Path))42 Path = Default.Report.Path;43 if (!string.IsNullOrEmpty(Source) && Source.StartsWith("@"))44 Source = InitializeFromReferences(references, Source, "source");45 if (!string.IsNullOrEmpty(Path) && Path.StartsWith("@"))46 Path = InitializeFromReferences(references, Path, "path");47 }48 protected virtual string InitializeFromReferences(IEnumerable<ReferenceXml> references, string refName, string attribute)49 {50 if (refName.StartsWith("@"))51 refName = refName.Substring(1);52 var refChoice = GetReference(references, refName);53 if (refChoice.Report == null)54 throw new NullReferenceException(string.Format("A reference named '{0}' has been found, but no element 'report' has been defined", refName));55 if (attribute=="source")56 return refChoice.Report.Source;57 if (attribute=="path")58 return refChoice.Report.Path;59 throw new ArgumentOutOfRangeException();60 }61 protected ReferenceXml GetReference(IEnumerable<ReferenceXml> references, string value)62 {63 if (references == null || references.Count() == 0)64 throw new InvalidOperationException("No reference has been defined for this constraint");65 var refChoice = references.FirstOrDefault(r => r.Name == value);66 if (refChoice == null)67 throw new IndexOutOfRangeException(string.Format("No reference named '{0}' has been defined.", value));68 return refChoice;69 }70 }71}...

Full Screen

Full Screen

NumericFormatXml.cs

Source:NumericFormatXml.cs Github

copy

Full Screen

...1920 [XmlAttribute("ref")]21 public string Reference {get; set;}2223 internal void AssignReferences(IEnumerable<ReferenceXml> references)24 {25 if (!string.IsNullOrEmpty(Reference))26 InitializeFromReferences(references, Reference);27 }2829 protected virtual void InitializeFromReferences(IEnumerable<ReferenceXml> references, string value)30 {31 var refChoice = GetReference(references, value);3233 if (refChoice.NumericFormat==null)34 throw new NullReferenceException(string.Format("A reference named '{0}' has been defined, but it's numeric-format is not defined", value));3536 Initialize(refChoice.NumericFormat);37 }3839 protected void Initialize(INumericFormat format)40 { 41 DecimalDigits = format.DecimalDigits;42 DecimalSeparator = format.DecimalSeparator;43 GroupSeparator = format.GroupSeparator;44 }4546 protected ReferenceXml GetReference(IEnumerable<ReferenceXml> references, string value)47 {48 if (references == null || references.Count() == 0)49 throw new InvalidOperationException("No reference has been defined for this constraint");5051 var refChoice = references.FirstOrDefault(r => r.Name == value);52 if (refChoice == null)53 throw new IndexOutOfRangeException(string.Format("No reference named '{0}' has been defined.", value));54 return refChoice;55 }56 57 [XmlAttribute("decimal-digits")]58 public int DecimalDigits { get; set; }5960 [XmlAttribute("decimal-separator")] ...

Full Screen

Full Screen

PerspectiveXmlTest.cs

Source:PerspectiveXmlTest.cs Github

copy

Full Screen

...21 perspectiveXml.Caption = "My Caption";22 perspectiveXml.Default = new DefaultXml() { ApplyTo = SettingsXml.DefaultScope.Assert, ConnectionString = "connStr" };23 perspectiveXml.Settings = new SettingsXml()24 {25 References = new List<ReferenceXml>() 26 { new ReferenceXml() 27 { Name = "Bob", ConnectionString = "connStr" } 28 }29 };3031 var serializer = new XmlSerializer(typeof(PerspectiveXml));32 var stream = new MemoryStream();33 var writer = new StreamWriter(stream, Encoding.UTF8);34 serializer.Serialize(writer, perspectiveXml);35 var content = Encoding.UTF8.GetString(stream.ToArray());36 writer.Close();37 stream.Close();3839 Debug.WriteLine(content);40 ...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run NBi automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Most used methods in ReferenceXml

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful