public void Attribute_should_get_matching_attribute() { var path = DomPath.Root.Attribute("one"); Assert.HasCount(1, BElement.Select(path)); Assert.Same(BElement.Attributes["one"], path.Select(BElement)[0]); }
private int RenderElement(RenderTreeBuilder builder, int seq, BElement uiElement) { builder.OpenElement(++seq, uiElement.Tag); if (uiElement.OnClick != null) { builder.AddAttribute(++seq, "class", "btn btn-primary"); builder.AddAttribute(++seq, "onclick", EventCallback.Factory.Create <UIMouseEventArgs>(this, async(e) => { await EventHandlerHandler(uiElement.OnClick, e); })); } if (uiElement.InnerText != null) { builder.AddContent(++seq, uiElement.InnerText); } if (uiElement.InnerElements != null) { foreach (var item in uiElement.InnerElements) { RenderElement(builder, seq, item); } } builder.CloseElement(); return(seq); }
private static BDictionary ReadDictionary(ref string bencodedString, ref int index) { index++; BDictionary dict = new BDictionary(); try { while (bencodedString[index] != 'e') { BString K = ReadString(ref bencodedString, ref index); BElement V = ReadElement(ref bencodedString, ref index); dict.Add(K, V); } } catch (BencodingException) { throw; } catch (Exception e) { throw Error(e); } index++; return(dict); }
/// <summary> /// Reads a dictionary. /// </summary> /// <returns>The dictionary that was read.</returns> private BDictionary ReadDictionary() { this.Index++; BDictionary dict = new BDictionary(); try { while (this.BencodedString[this.Index] != 'e') { BString K = this.ReadString(); BElement V = this.ReadElement(); dict.Add(K, V); } } catch (BencodingException) { throw; } catch (Exception e) { throw this.Error(e); } this.Index++; return(dict); }