|
17 | 17 | </Fixture> |
18 | 18 |
|
19 | 19 | @code { |
20 | | - IEnumerable<Person> people = null; |
21 | | - |
22 | | - void FirstTest(Fixture fixture) |
23 | | - { |
24 | | - var cut = fixture.GetComponentUnderTest(); |
25 | | - var tableHeaders = cut.FindAll("th"); |
26 | | - tableHeaders.Count.ShouldBe(4, "Did not render 4 TH elements"); |
27 | | - tableHeaders[0].TextContent.ShouldBe("Id"); |
28 | | - tableHeaders[1].TextContent.ShouldBe("Name"); |
29 | | - tableHeaders[2].TextContent.ShouldBe("Price"); |
30 | | - tableHeaders[3].TextContent.ShouldBe("LastUpdate"); |
31 | | - } |
32 | | - |
33 | | - void SecondTest(Fixture fixture) |
34 | | - { |
35 | | - people = GetPeople(); |
36 | | - |
37 | | - var cut = fixture.GetComponentUnderTest(); |
38 | | - var tableHeaders = cut.FindAll("th"); |
39 | | - tableHeaders[0].TextContent.ShouldBe("FirstName"); |
40 | | - tableHeaders[1].TextContent.ShouldBe("LastName"); |
41 | | - tableHeaders.Count.ShouldBe(2, "Did not render 2 TH elements"); |
42 | | - } |
43 | | - |
44 | | - IQueryable<Widget> GetWidgets(int maxRows, int startRowIndex, string sortByExpression, out int totalRowCount) |
45 | | - { |
46 | | - totalRowCount = Widget.SimpleWidgetList.Length; |
47 | | - return Widget.SimpleWidgetList.AsQueryable(); |
48 | | - } |
49 | | - |
50 | | - IEnumerable<Person> GetPeople() |
51 | | - => new List<Person> |
| 20 | + IEnumerable<Person> people = null; |
| 21 | + |
| 22 | + void FirstTest(Fixture fixture) |
| 23 | + { |
| 24 | + var cut = fixture.GetComponentUnderTest(); |
| 25 | + var tableHeaders = cut.FindAll("th"); |
| 26 | + tableHeaders.Count.ShouldBe(4, "Did not render 4 TH elements"); |
| 27 | + tableHeaders[0].TextContent.ShouldBe("Id"); |
| 28 | + tableHeaders[1].TextContent.ShouldBe("Name"); |
| 29 | + tableHeaders[2].TextContent.ShouldBe("Price"); |
| 30 | + tableHeaders[3].TextContent.ShouldBe("LastUpdate"); |
| 31 | + } |
| 32 | + |
| 33 | + void SecondTest(Fixture fixture) |
52 | 34 | { |
| 35 | + people = GetPeople(); |
| 36 | + |
| 37 | + var cut = fixture.GetComponentUnderTest(); |
| 38 | + var tableHeaders = cut.FindAll("th"); |
| 39 | + tableHeaders[0].TextContent.ShouldBe("FirstName"); |
| 40 | + tableHeaders[1].TextContent.ShouldBe("LastName"); |
| 41 | + tableHeaders.Count.ShouldBe(2, "Did not render 2 TH elements"); |
| 42 | + } |
| 43 | + |
| 44 | + IQueryable<Widget> GetWidgets(int maxRows, int startRowIndex, string sortByExpression, out int totalRowCount) |
| 45 | + { |
| 46 | + totalRowCount = Widget.SimpleWidgetList.Length; |
| 47 | + return Widget.SimpleWidgetList.AsQueryable(); |
| 48 | + } |
| 49 | + |
| 50 | + IEnumerable<Person> GetPeople() |
| 51 | + => new List<Person> |
| 52 | + { |
53 | 53 | new Person { FirstName = "Jeff", LastName = "Fritz" }, |
54 | 54 | new Person { FirstName = "Hisham", LastName = "Bin Ateya" } |
55 | | - }; |
| 55 | + }; |
56 | 56 |
|
57 | | - class Person |
58 | | - { |
59 | | - private int _id; |
| 57 | + class Person |
| 58 | + { |
| 59 | + private int _id; |
| 60 | + |
| 61 | + private int Id { get => _id; set => _id = value; } |
| 62 | + |
| 63 | + public string FirstName { get; set; } |
60 | 64 |
|
61 | | - private int Id { get => _id; set => _id = value; } |
| 65 | + public string LastName { get; set; } |
62 | 66 |
|
63 | | - public string FirstName { get; set; } |
| 67 | + public Person this[int id] => null; |
64 | 68 |
|
65 | | - public string LastName { get; set; } |
| 69 | + public Person this[string name] => null; |
66 | 70 |
|
67 | | - public Person this[int id] => null; |
| 71 | + public static int Count { get; } |
| 72 | + |
| 73 | + public IEnumerable<Address> Addresses { get; set; } |
| 74 | + } |
| 75 | + |
| 76 | + public class Address |
| 77 | + { |
| 78 | + public string City { get; set; } |
68 | 79 |
|
69 | | - public Person this[string name] => null; |
| 80 | + public string District { get; set; } |
70 | 81 |
|
71 | | - public static int Count { get; } |
72 | | - } |
| 82 | + public string Street { get; set; } |
| 83 | + } |
73 | 84 | } |
0 commit comments