Tester for System.Web.UI.WebControls.Repeater. Generally, you don't test through this tester. Instead, you use the Item method to use as a container for testing controls that are inside the repeater. The ItemCount method may also be useful. This example demonstrates how to test a button that's in the third item of a repeater: RepeaterTester repeater = new RepeaterTester("repeater"); ButtonTester button = new ButtonTester("button", repeater.Item(2));
Inheritance: NamingContainerTester
コード例 #1
0
ファイル: RepeaterTest.cs プロジェクト: vcsjones/NUnitAsp
 public void TestAllTemplates()
 {
     RepeaterTester all = new RepeaterTester("allRepeater", true, true, true);
     AssertFiveThings(all, "allLabel");
     AssertFourSeparators(all, "allSeparatorTemplateLabel");
     Assert.AreEqual("header", new LabelTester("allHeaderTemplateLabel", all.Header).Text);
     Assert.AreEqual("footer", new LabelTester("allFooterTemplateLabel", all.Footer).Text);
 }
コード例 #2
0
ファイル: RepeaterTester.cs プロジェクト: jamesshore/NUnitAsp
 private static string GetMessage(string aspId, RepeaterTester repeater) 
 {
   return String.Format(
     "Tester '{0}' has RepeaterTester '{1}' as its container. That isn't allowed. "
     + "It should be a RepeaterTester.RepeaterTemplateTester.  "
     + "When constructing {0}, pass '{1}.Item(#)', '{1}.Header', '{1}.Footer', "
     + "or '{1}.GetSeparator(#)' as the container argument.",
     aspId, repeater.AspId);
 }
コード例 #3
0
ファイル: RepeaterTest.cs プロジェクト: vcsjones/NUnitAsp
        public void TestDescriptions()
        {
            RepeaterTester all = new RepeaterTester("allRepeater", true, true, true);

            AssertDescription("RepeaterTester 'allRepeater'", all);
            AssertDescription("HeaderTemplate in RepeaterTester 'allRepeater'", all.Header);
            AssertDescription("Item #3 in RepeaterTester 'allRepeater'", all.Item(2));
            AssertDescription("Separator #2 in RepeaterTester 'allRepeater'", all.Separator(1));
            AssertDescription("FooterTemplate in RepeaterTester 'allRepeater'", all.Footer);
        }
コード例 #4
0
ファイル: RepeaterTest.cs プロジェクト: vcsjones/NUnitAsp
 public void TestAlternatingItemTemplate()
 {
     RepeaterTester alternating = new RepeaterTester("alternatingRepeater");
     AssertFiveThings(alternating, "alternatingLabel");
 }
コード例 #5
0
ファイル: RepeaterTest.cs プロジェクト: vcsjones/NUnitAsp
 private void AssertFourSeparators(RepeaterTester tester, string separatorLabelId)
 {
     Assert.AreEqual(" | ", new LabelTester(separatorLabelId, tester.Separator(0)).Text);
     Assert.AreEqual(" | ", new LabelTester(separatorLabelId, tester.Separator(1)).Text);
     Assert.AreEqual(" | ", new LabelTester(separatorLabelId, tester.Separator(2)).Text);
     Assert.AreEqual(" | ", new LabelTester(separatorLabelId, tester.Separator(3)).Text);
 }
コード例 #6
0
ファイル: RepeaterTester.cs プロジェクト: jamesshore/NUnitAsp
 /// <summary>
 /// Create a tester for a specific item in a repeater.
 /// </summary>
 /// <param name="itemNum">The item number to test (zero-based).</param>
 /// <param name="container">The repeater tester this item is contained
 /// within.</param>
 public RepeaterItemTester(int itemNum, RepeaterTester container) : base(container)
 {
   this.container = container;
   this.itemNum = itemNum;
 }
コード例 #7
0
ファイル: RepeaterTester.cs プロジェクト: vcsjones/NUnitAsp
 /// <summary>
 /// Create a tester for a specific item in a repeater.
 /// </summary>
 /// <param name="separatorNum">The index of the separator to test (zero-based).</param>
 /// <param name="container">The repeater tester this item is contained
 /// within.</param>
 public RepeaterSeparatorTester(int separatorNum, RepeaterTester container)
     : base(container)
 {
     this.container = container;
     this.separatorNum = separatorNum;
 }
コード例 #8
0
ファイル: RepeaterTester.cs プロジェクト: vcsjones/NUnitAsp
 /// <summary>
 /// Create a tester for a repeater's HeaderTemplate.
 /// </summary>
 /// <param name="container">The repeater tester that contains this HeaderTemplate</param>
 public RepeaterHeaderTester(RepeaterTester container)
     : base(container)
 {
     this.container = container;
 }
コード例 #9
0
ファイル: RepeaterTest.cs プロジェクト: vcsjones/NUnitAsp
        public void TestNestedRepeater()
        {
            RepeaterTester innerRepeater1 = new RepeaterTester("innerRepeater1", repeater1.Item(0));
            RepeaterTester innerRepeater2 = new RepeaterTester("innerRepeater1", repeater1.Item(1));

            Assert.AreEqual(2, innerRepeater1.ItemCount);
            Assert.AreEqual(4, innerRepeater2.ItemCount);
        }
コード例 #10
0
ファイル: RepeaterTest.cs プロジェクト: vcsjones/NUnitAsp
 public void TestHeaderTemplate()
 {
     RepeaterTester header = new RepeaterTester("headerRepeater", true, false, false);
     AssertFiveThings(header, "headerLabel");
     Assert.AreEqual("header", new LabelTester("nestedHeaderLabel", header.Header).Text);
 }
コード例 #11
0
ファイル: RepeaterTest.cs プロジェクト: vcsjones/NUnitAsp
 public void TestFooterTemplate()
 {
     RepeaterTester footer = new RepeaterTester("footerRepeater", false, false, true);
     AssertFiveThings(footer, "footerLabel");
     Assert.AreEqual("footer", new LabelTester("nestedFooterLabel", footer.Footer).Text);
 }
コード例 #12
0
ファイル: RepeaterTester.cs プロジェクト: jamesshore/NUnitAsp
 internal ContainerMustBeItemException(string aspId, RepeaterTester repeater) 
   : base(GetMessage(aspId, repeater))
 {
 }
コード例 #13
0
ファイル: RepeaterTester.cs プロジェクト: jamesshore/NUnitAsp
 /// <summary>
 /// Create a tester for a specific item in a repeater.
 /// </summary>
 /// <param name="container">The repeater tester this item is contained
 /// within.</param>
 public RepeaterFooterTester(RepeaterTester container) : base(container)
 {
   this.container = container;
 }
コード例 #14
0
ファイル: RepeaterTester.cs プロジェクト: jamesshore/NUnitAsp
 /// <summary>
 /// Create a tester for a specific item in a repeater.
 /// </summary>
 /// <param name="separatorNum">The index of the separator to test (zero-based).</param>
 /// <param name="container">The repeater tester this item is contained
 /// within.</param>
 public RepeaterSeparatorTester(int separatorNum, RepeaterTester container) : base(container)
 {
   this.container = container;
   this.separatorNum = separatorNum;
 }
コード例 #15
0
ファイル: RepeaterTester.cs プロジェクト: vcsjones/NUnitAsp
 internal ContainerMustBeItemException(string aspId, RepeaterTester repeater)
     : base(GetMessage(aspId, repeater))
 {
 }
コード例 #16
0
ファイル: RepeaterTest.cs プロジェクト: vcsjones/NUnitAsp
 public void TestSeparatorTemplate()
 {
     RepeaterTester separator = new RepeaterTester("separatorRepeater", false, true, false);
     AssertFiveThings(separator, "separatorLabel");
     AssertFourSeparators(separator, "nestedSeparatorLabel");
 }
コード例 #17
0
ファイル: RepeaterTester.cs プロジェクト: vcsjones/NUnitAsp
 private static string GetMessage(string aspId, RepeaterTester repeater)
 {
     return String.Format(
       "Tester '{0}' has RepeaterTester '{1}' as its container. That isn't allowed. "
       + "It should be a RepeaterTester.RepeaterTemplateTester.  "
       + "When constructing {0}, pass '{1}.Item(#)', '{1}.Header', '{1}.Footer', "
       + "or '{1}.GetSeparator(#)' as the container argument.",
       aspId, repeater.AspId);
 }
コード例 #18
0
ファイル: RepeaterTest.cs プロジェクト: vcsjones/NUnitAsp
        protected override void SetUp()
        {
            base.SetUp();

            repeater1 = new RepeaterTester("Repeater1", CurrentWebForm);
            repeater2 = new RepeaterTester("Repeater2", CurrentWebForm);
            repeater3 = new RepeaterTester("Repeater3", CurrentWebForm);

            Browser.GetPage(BaseUrl + "/AspTester/RepeaterTestPage.aspx");
        }
コード例 #19
0
ファイル: RepeaterTester.cs プロジェクト: vcsjones/NUnitAsp
 /// <summary>
 /// Create a tester for a specific item in a repeater.
 /// </summary>
 /// <param name="itemNum">The item number to test (zero-based).</param>
 /// <param name="container">The repeater tester this item is contained
 /// within.</param>
 public RepeaterItemTester(int itemNum, RepeaterTester container)
     : base(container)
 {
     this.container = container;
     this.itemNum = itemNum;
 }
コード例 #20
0
ファイル: RepeaterTest.cs プロジェクト: vcsjones/NUnitAsp
 private void AssertFiveThings(RepeaterTester tester, string labelId)
 {
     Assert.AreEqual(5, tester.ItemCount);
     Assert.AreEqual("one", new LabelTester(labelId, tester.Item(0)).Text);
     Assert.AreEqual("two", new LabelTester(labelId, tester.Item(1)).Text);
     Assert.AreEqual("three", new LabelTester(labelId, tester.Item(2)).Text);
     Assert.AreEqual("four", new LabelTester(labelId, tester.Item(3)).Text);
     Assert.AreEqual("five", new LabelTester(labelId, tester.Item(4)).Text);
 }
コード例 #21
0
ファイル: RepeaterTester.cs プロジェクト: vcsjones/NUnitAsp
 /// <summary>
 /// Create a tester for a specific template in a repeater.
 /// </summary>
 /// <param name="container">The repeater tester this item is contained
 /// within.</param>
 public RepeaterTemplateTester(RepeaterTester container)
     : base(null, container)
 {
 }
コード例 #22
0
ファイル: RepeaterTester.cs プロジェクト: jamesshore/NUnitAsp
 /// <summary>
 /// Create a tester for a specific template in a repeater.
 /// </summary>
 /// <param name="container">The repeater tester this item is contained
 /// within.</param>
 public RepeaterTemplateTester(RepeaterTester container) : base(null, container)
 {
 }