Menu

#112 problem with RepeaterTester ItemCount

open
nobody
None
5
2007-09-11
2007-09-11
miko
No

I wanted to test a Repeater, which lies within an UserControl. But now I'm encountering a problem, when I try to get the ItemCount of the Repeater. This produces the following System.ApplicationException:

Expected only one node to match xpath '//*[starts-with(@id, 'ctl_GalleryDetail_rep_Comment_ctl')][position() = last()]' but 4 nodes matched

And here's the Code:
//testcase:
public void TestCommentList()
{
UserControlTester usercontrol = new UserControlTester("ctl_GalleryDetail");
RepeaterTester rep = new RepeaterTester("rep_Comment", usercontrol);
CommentController ccontroller = new CommentController();
int pictureid = 14;
List<IComment> list = ccontroller.LoadCommentList(pictureid);

Browser.GetPage("http://baebsle.web.intranet.rs/GalleryDetailTest.aspx?PictureID=14");

int count = rep.ItemCount;
Assert.AreEqual(list.Count, count);
}

//asp-code:
<div style="background-color:#E1E1E1;">
<asp:Repeater ID="rep_Comment" runat="server">
<ItemTemplate>
<div>
<asp:Label ID="lbl_Autor" runat="server" Text='<%# Eval("AutorID") %>' /> am <asp:Label ID="lbl_Date" runat="server" Text='<%# Eval("CommentDate") %>' />
<br />
<asp:Label ID="lbl_CommentHeadline" runat="server" Text='<%# Eval("CommentHeadline") %>' />
<br />
<asp:Label ID="lbl_CommentText" runat="server" Text='<%# Eval("CommentText") %>' />
</div>
</ItemTemplate>
</asp:Repeater>
</div>

Does anybody have an idea to solve that problem? Tell me :) thanks

Discussion


Log in to post a comment.