Skip to content

Commit 2ebcc08

Browse files
committed
Adapted to 12 items in the sample data collection
1 parent 791665d commit 2ebcc08

33 files changed

+81
-72
lines changed

samples/SharedSampleObjects/Models/Widget.cs

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,27 @@ public static Widget[] Widgets(int n)
3232
return widgets;
3333
}
3434

35-
public static Widget[] SimpleWidgetList
36-
{
37-
get
38-
{
39-
return new Widget[]
40-
{
41-
new Widget { Id=1, Name="First Widget", Price=7.99M, LastUpdate=DateTime.Today.AddHours(-6)},
42-
new Widget { Id=2, Name="Second Widget", Price=13.99M, LastUpdate=DateTime.Today.AddHours(-7)},
43-
new Widget { Id=3, Name="Third Widget", Price=100.99M, LastUpdate=DateTime.Today.AddHours(-14)},
35+
public static Widget[] SimpleWidgetList
36+
{
37+
get
38+
{
39+
return new Widget[]
40+
{
41+
new Widget { Id=1, Name="First Widget", Price=7.99M, LastUpdate=DateTime.Today.AddHours(6)},
42+
new Widget { Id=2, Name="Second Widget", Price=13.99M, LastUpdate=DateTime.Today.AddHours(7)},
43+
new Widget { Id=3, Name="Third Widget", Price=100.99M, LastUpdate=DateTime.Today.AddHours(14)},
44+
new Widget { Id=4, Name="Fourth Widget", Price=10.99M, LastUpdate=DateTime.Today.AddHours(4)},
45+
new Widget { Id=5, Name="Fifth Widget", Price=5.99M, LastUpdate=DateTime.Today.AddHours(5)},
46+
new Widget { Id=6, Name="Sixth Widget", Price=6.99M, LastUpdate=DateTime.Today.AddHours(6)},
47+
new Widget { Id=7, Name="Seventh Widget", Price=12.99M, LastUpdate=DateTime.Today.AddHours(7)},
48+
new Widget { Id=8, Name="Eighth Widget", Price=8.99M, LastUpdate=DateTime.Today.AddHours(8)},
49+
new Widget { Id=9, Name="Ninth Widget", Price=2.99M, LastUpdate=DateTime.Today.AddHours(9)},
50+
new Widget { Id=10, Name="Tenth Widget", Price=3.99M, LastUpdate=DateTime.Today.AddHours(10)},
51+
new Widget { Id=11, Name="Eleventh Widget", Price=16.99M, LastUpdate=DateTime.Today.AddHours(11)},
52+
new Widget { Id=12, Name="Fritz's Widget", Price=52.70M, LastUpdate=DateTime.Today.AddHours(8)},
4453
};
45-
}
46-
}
54+
}
55+
}
4756

4857
}
4958
}

src/BlazorWebFormsComponents.Test/DataBinder/Eval_SimpleDataList.razor

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
var cut = fixture.GetComponentUnderTest();
2424

25-
cut.FindAll("span").Count().ShouldBe(5);
25+
cut.FindAll("span").Count().ShouldBe(Widget.SimpleWidgetList.Length+2);
2626
cut.FindAll("span").Skip(1).First().TextContent.ShouldBe("My Widget List");
2727

2828
cut.Find("span").HasAttribute("title").ShouldBeFalse();

src/BlazorWebFormsComponents.Test/DataBinder/Eval_SimpleRepeater.razor

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818

1919
var cut = fixture.GetComponentUnderTest();
2020

21-
cut.FindAll("span").Count().ShouldBe(3);
22-
cut.FindAll("hr").Count().ShouldBe(3);
21+
cut.FindAll("span").Count().ShouldBe(Widget.SimpleWidgetList.Length);
22+
cut.FindAll("hr").Count().ShouldBe(Widget.SimpleWidgetList.Length);
2323

2424
}
2525

src/BlazorWebFormsComponents.Test/DataList/FlowLayout/AlternatingTemplate.razor

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@
2222

2323
var cut = fixture.GetComponentUnderTest();
2424

25-
cut.FindAll("span").Count().ShouldBe(5);
25+
cut.FindAll("span").Count().ShouldBe(Widget.SimpleWidgetList.Length+2);
2626
cut.FindAll("span").Skip(1).First().TextContent.ShouldBe("My Widget List");
2727

28-
cut.FindAll("span").Count(c => c.TextContent.StartsWith("== ") && c.TextContent.EndsWith(" ==")).ShouldBe(1);
28+
cut.FindAll("span").Count(c => c.TextContent.StartsWith("== ") && c.TextContent.EndsWith(" ==")).ShouldBe((int)Math.Floor(Widget.SimpleWidgetList.Length/2.0m));
2929

3030
}
3131

src/BlazorWebFormsComponents.Test/DataList/FlowLayout/DataBind.razor

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
// Assert
5151
databinding.ShouldBeGreaterThan(0);
5252
databound.ShouldBeGreaterThan(0);
53-
itemDatabound.ShouldBeGreaterThanOrEqualTo(3);
54-
cut.FindAll("item").Count().ShouldBe(3);
53+
itemDatabound.ShouldBeGreaterThanOrEqualTo(Widget.SimpleWidgetList.Length);
54+
cut.FindAll("item").Count().ShouldBe(Widget.SimpleWidgetList.Length);
5555
}
5656
}

src/BlazorWebFormsComponents.Test/DataList/FlowLayout/FooterTemplate.razor

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
{
1818
var cut = fixture.GetComponentUnderTest();
1919
System.Diagnostics.Debug.WriteLine(cut.Markup);
20-
cut.FindAll("span").Count().ShouldBe(5);
20+
cut.FindAll("span").Count().ShouldBe(Widget.SimpleWidgetList.Length+2);
2121
cut.FindAll("span").Count(c => c.TextContent == "FooterTemplate").ShouldBe(1);
2222
cut.FindAll("span").Last().TextContent.ShouldBe("FooterTemplate");
2323
}

src/BlazorWebFormsComponents.Test/DataList/FlowLayout/ItemStyleTest.razor

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@
2525

2626
var cut = fixture.GetComponentUnderTest();
2727

28-
cut.FindAll("span").Count().ShouldBe(5);
29-
cut.FindAll("span").Count(c => c.HasAttribute("style")).ShouldBe(3);
28+
cut.FindAll("span").Count().ShouldBe(Widget.SimpleWidgetList.Length+2);
29+
cut.FindAll("span").Count(c => c.HasAttribute("style")).ShouldBe(Widget.SimpleWidgetList.Length);
3030

31-
cut.FindAll("span").Count(c => c.HasAttribute("style") && c.GetAttribute("style").Contains("background-color")).ShouldBe(3);
31+
cut.FindAll("span").Count(c => c.HasAttribute("style") && c.GetAttribute("style").Contains("background-color")).ShouldBe(Widget.SimpleWidgetList.Length);
3232

3333
}
3434

src/BlazorWebFormsComponents.Test/DataList/FlowLayout/SeparatorTemplate.razor

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@
2222

2323
var cut = fixture.GetComponentUnderTest();
2424

25-
cut.FindAll("span").Count().ShouldBe(7);
25+
cut.FindAll("span").Count().ShouldBe(Widget.SimpleWidgetList.Length*2+1);
2626

27-
cut.FindAll("span").Count(c => c.TextContent == "====").ShouldBe(2);
27+
cut.FindAll("span").Count(c => c.TextContent == "====").ShouldBe(Widget.SimpleWidgetList.Length-1);
2828

2929
cut.FindAll("span")[3].TextContent.ShouldBe("====");
30-
cut.FindAll("span")[5].TextContent.ShouldBe("====");
30+
cut.FindAll("span")[7].TextContent.ShouldBe("====");
3131

3232
}
3333

3434

35-
}
35+
}

src/BlazorWebFormsComponents.Test/DataList/FlowLayout/Simple.razor

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@
2121

2222
var cut = fixture.GetComponentUnderTest();
2323

24-
cut.FindAll("span").Count().ShouldBe(5);
24+
cut.FindAll("span").Count().ShouldBe(Widget.SimpleWidgetList.Length+2);
2525
cut.FindAll("span").Skip(1).First().TextContent.ShouldBe("My Widget List");
2626

2727
cut.Find("span").HasAttribute("title").ShouldBeFalse();
2828

2929
}
3030

3131

32-
}
32+
}

src/BlazorWebFormsComponents.Test/DataList/FlowLayout/SimpleStyle.razor

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
var cut = fixture.GetComponentUnderTest();
2424

25-
cut.FindAll("span").Count().ShouldBe(5);
25+
cut.FindAll("span").Count().ShouldBe(Widget.SimpleWidgetList.Length+2);
2626
cut.FindAll("span").Skip(1).First().TextContent.ShouldBe("My Widget List");
2727

2828
cut.Find("span").HasAttribute("style").ShouldBeTrue();
@@ -31,4 +31,4 @@
3131
}
3232

3333

34-
}
34+
}

0 commit comments

Comments
 (0)