public void ValueFormat_Set_ValueIsSet() { var descriptor = new PathSingleValueDescriptor(); descriptor.ValueFormat = new ValueFormat(typeof(double), "0.00"); Assert.That(descriptor.ValueFormat.Format, Is.EqualTo("0.00")); }
public void Path_Set_ValueIsSet() { var descriptor = new PathSingleValueDescriptor(); descriptor.Path = "123"; Assert.That(descriptor.Path, Is.EqualTo("123")); }
private static IFigureDescriptor CreatePathSingleValueDescriptor() { var descriptor = new PathSingleValueDescriptor(); descriptor.ValueFormat = new FormatColumn("value", typeof(double), "000,000.0000"); return(descriptor); }
public void ValueFormat_Set_ChangeIsNotified() { var descriptor = new PathSingleValueDescriptor(); var counter = new PropertyChangedCounter(descriptor); descriptor.ValueFormat = new ValueFormat(typeof(double), "0.00"); Assert.That(counter.GetCount(nameof(descriptor.ValueFormat)), Is.EqualTo(1)); }
public void Path_Set_ChangeIsNotified() { var descriptor = new PathSingleValueDescriptor(); var counter = new PropertyChangedCounter(descriptor); descriptor.Path = "123"; Assert.That(counter.GetCount(nameof(descriptor.Path)), Is.EqualTo(1)); }
private static IHtmlMarker TryCreateMarker(PathSingleValueDescriptor descriptor) { if (descriptor == null) { return(null); } return(new HtmlElementMarker(HtmlTableMarker.DefaultCellColor)); }
public void Validate_IsValid_DoesNotThrows() { var descriptor = new PathSingleValueDescriptor(); descriptor.Figure = "Price"; descriptor.Path = "123"; descriptor.ValueFormat = new FormatColumn("values", typeof(double), "0.00"); RecursiveValidator.Validate(descriptor); }
public void Validate_MisingValueFormat_Throws() { var descriptor = new PathSingleValueDescriptor(); descriptor.Figure = "Price"; descriptor.Path = "123"; descriptor.ValueFormat = null; var ex = Assert.Throws <ValidationException>(() => RecursiveValidator.Validate(descriptor)); Assert.That(ex.Message, Does.Contain("The ValueFormat field is required")); }
public void Validate_InvalidPath_Throws([Values(null, "")] string path) { var descriptor = new PathSingleValueDescriptor(); descriptor.Figure = "Price"; descriptor.Path = path; descriptor.ValueFormat = new FormatColumn("values", typeof(double), "0.00"); var ex = Assert.Throws <ValidationException>(() => RecursiveValidator.Validate(descriptor)); Assert.That(ex.Message, Does.Contain("The Path field is required")); }
public void Clone_WhenCalled_AllMembersAreCloned() { var descriptor = new PathSingleValueDescriptor(); descriptor.Path = "111"; descriptor.ValueFormat = new ValueFormat(typeof(int), "0.xx"); var clone = FigureDescriptorFactory.Clone(descriptor); Assert.That(clone.Path, Is.EqualTo("111")); Assert.That(clone.ValueFormat.Format, Is.EqualTo("0.xx")); }
public void GetSingleValue() { var doc = LoadDocument <IHtmlDocument>("Html", "ariva.overview.US0138171014.html"); var descriptor = new PathSingleValueDescriptor(); descriptor.Path = @"/BODY[0]/DIV[4]/DIV[0]/DIV[3]/DIV[0]"; descriptor.ValueFormat = new ValueFormat(typeof(int), "00000000") { ExtractionPattern = new Regex(@"WKN: (\d+)") }; var parser = DocumentProcessingFactory.CreateParser(doc, descriptor); var table = parser.ExtractTable(); Assert.AreEqual(1, table.Rows.Count); Assert.AreEqual(850206, table.Rows[0][0]); }