public void GetInputValue_ByName(string name, object expected) { var doc = new CustomHtmlDocument(); doc.LoadHtml(_nodeTestHtml); var output = doc.GetInputValue(name); output.Should().Be(expected); }
public void GetInputEnumValue_WrongName_OutOfRange_Returns_Null() { var doc = new CustomHtmlDocument(); doc.LoadHtml(_nodeTestHtml); var output = doc.GetInputEnumValue <DigestVolumeFrequencyOption>("xyz"); output.Should().BeNull(); }
public void SafeSelectNodes_BadPath_Should_Return_Empty() { var doc = new CustomHtmlDocument(); doc.LoadHtml(File.ReadAllText("general.html")); var safeNodes = doc.DocumentNode.SafeSelectNodes("//tdxxx"); safeNodes.Should().NotBeNull().And.BeEmpty(); }
public void GetInputEnumValue_EmptyFlags_ShouldBeDefault() { var doc = new CustomHtmlDocument(); doc.LoadHtml(_nodeTestHtml); var output = doc.GetInputEnumValue <NewMemberOptions>("empty_flags"); output.Should().Be(default(NewMemberOptions)); }
public void GetInputEnumValue_WrongType_ArgumentException() { var doc = new CustomHtmlDocument(); doc.LoadHtml(_nodeTestHtml); Action act = () => doc.GetInputEnumValue <int>("enum_prop"); act.Should().Throw <ArgumentException>(); }
public void GetInputEnumValue_WrongValue_ArgumentException() { var doc = new CustomHtmlDocument(); doc.LoadHtml(_nodeTestHtml); Action act = () => doc.GetInputEnumValue <DigestVolumeFrequencyOption>("bad_enum_prop"); act.Should().Throw <ArgumentException>(); }
public void GetInputEnumValue_Flags() { var doc = new CustomHtmlDocument(); doc.LoadHtml(_nodeTestHtml); var output = doc.GetInputEnumValue <NewMemberOptions>("flags_prop"); output.Should().HaveFlag(NewMemberOptions.Hide); output.Should().HaveFlag(NewMemberOptions.Ack); }
public void SafeSelectNodes_ValidPath_Should_Work() { var doc = new CustomHtmlDocument(); doc.LoadHtml(File.ReadAllText("general.html")); var safeNodes = doc.DocumentNode.SafeSelectNodes("//td"); var nodes = doc.DocumentNode.SelectNodes("//td"); safeNodes.Should().BeEquivalentTo(nodes); }
public void GetInputEnumValue_ByName() { var doc = new CustomHtmlDocument(); doc.LoadHtml(_nodeTestHtml); var obj = new NodeTestClass(); var output = doc.GetInputEnumValue <DigestVolumeFrequencyOption>("enum_prop"); output.Should().Be(obj.EnumProp); }
public void GetTextareaStringValue_ByName() { var doc = new CustomHtmlDocument(); doc.LoadHtml(_nodeTestHtml); var obj = new NodeTestClass(); var output = doc.GetTextAreaStringValue("list_prop"); output.Should().Be(obj.StringProp2); }
public void GetTextareaListValue_ByName() { var doc = new CustomHtmlDocument(); doc.LoadHtml(_nodeTestHtml); var obj = new NodeTestClass(); var output = doc.GetTextAreaListValue("list_prop"); output.Should().BeEquivalentTo(obj.ListProp); }
public void GetInputEnumValue() { var doc = new CustomHtmlDocument(); doc.LoadHtml(_nodeTestHtml); var obj = new NodeTestClass(); var prop = typeof(NodeTestClass).GetProperty("EnumProp"); var output = doc.GetInputEnumValue(prop); output.Should().Be(obj.EnumProp); }
public void GetTextAreaStringValue() { var doc = new CustomHtmlDocument(); doc.LoadHtml(_nodeTestHtml); var obj = new NodeTestClass(); var prop = typeof(NodeTestClass).GetProperty("ListProp"); var output = doc.GetTextAreaStringValue(prop); output.Should().Be(obj.StringProp2); }
public void GetInputValue_ByProp(string name, object expected) { var doc = new CustomHtmlDocument(); doc.LoadHtml(_nodeTestHtml); var prop = typeof(NodeTestClass).GetProperty(name); var output = doc.GetInputValue(prop); output.Should().Be(expected); }