diff --git a/StpFoodBlazor/StpFoodBlazorTest/Pages/DealsTest.razor b/StpFoodBlazor/StpFoodBlazorTest/Pages/DealsTest.razor index 201f429..60661bf 100644 --- a/StpFoodBlazor/StpFoodBlazorTest/Pages/DealsTest.razor +++ b/StpFoodBlazor/StpFoodBlazorTest/Pages/DealsTest.razor @@ -26,7 +26,7 @@ var elements = getElements(cut); Assert.Equal("1881 by Lake Elmo Inn", elements.Children[0].Children[0].InnerHtml); - Assert.Equal("$10 select craft cocktail", elements.Children[0].Children[1].InnerHtml); + Assert.Equal("50% off wild rice duck egg soup appetizer when you mention email", elements.Children[0].Children[1].InnerHtml); } [Fact] @@ -37,7 +37,7 @@ var elements = getElements(cut); Assert.Equal("1881 by Lake Elmo Inn", elements.Children[0].Children[0].InnerHtml); - Assert.Equal("$10 select craft cocktail", elements.Children[0].Children[1].InnerHtml); + Assert.Equal("50% off wild rice duck egg soup appetizer when you mention email", elements.Children[0].Children[1].InnerHtml); } [Fact] @@ -61,29 +61,30 @@ Assert.Equal("1881 by Lake Elmo Inn", elements.Children[0].Children[0].InnerHtml); Assert.Equal("50% off wild rice duck egg soup appetizer when you mention email", elements.Children[0].Children[1].InnerHtml); } - + [Fact] public void DealsShouldIncludeHappyHourWhenCheckedThursday() { timeService.DayOfWeek = DayOfWeek.Thursday.ToString(); var cut = ctx.Render(@); var elements = getElements(cut); + cut.Find("#happy-hour-checkbox").Change(true); - Assert.Equal("1881 by Lake Elmo Inn", elements.Children[0].Children[0].InnerHtml); - Assert.Equal("Discounted apps", elements.Children[0].Children[1].InnerHtml); - Assert.Equal("bi bi-clock", elements.Children[0].Children[1].ClassName); - Assert.Equal("bi bi-clock", elements.Children[0].Children[1].GetAttribute("title")); + Assert.Equal("1881 by Lake Elmo Inn", elements.Children[1].Children[0].InnerHtml); + Assert.Equal("Discounted apps", elements.Children[1].Children[1].InnerHtml); + Assert.Equal("bi bi-clock", elements.Children[1].Children[1].ClassName); + Assert.Equal("14:00 - 17:00", elements.Children[1].Children[1].GetAttribute("title")); } [Fact] - public void DealsShouldDisplayOnlyDealsForSelectedDay() + public void DealsShouldDisplayOnlyDealsForSelectedDayWednesday() { timeService.DayOfWeek = DayOfWeek.Wednesday.ToString(); var cut = ctx.Render(@); var elements = getElements(cut); - Assert.Equal(55, elements.ChildElementCount); + Assert.Equal(21, elements.ChildElementCount); } [Fact] @@ -105,7 +106,7 @@ dowSelect.Change("Monday"); var elements = getElements(cut); - Assert.Equal(45, elements.ChildElementCount); + Assert.Equal(16, elements.ChildElementCount); } [Fact] @@ -117,7 +118,7 @@ dowSelect.Change("Friday"); var elements = getElements(cut); - Assert.Equal(51, elements.ChildElementCount); + Assert.Equal(18, elements.ChildElementCount); } [Fact] @@ -129,9 +130,9 @@ dowSelect.Change(""); // All value in the select is "" var elements = getElements(cut); - Assert.Equal(299, elements.ChildElementCount); + Assert.Equal(97, elements.ChildElementCount); Assert.Equal("Sunday", elements.Children[0].Children[0].InnerHtml); - Assert.Equal("Saturday", elements.Children[298].Children[0].InnerHtml); + Assert.Equal("Saturday", elements.Children[96].Children[0].InnerHtml); } [Fact] @@ -143,9 +144,9 @@ dowSelect.Change(""); // All value in the select is "" var elements = getElements(cut); - Assert.Equal(299, elements.ChildElementCount); + Assert.Equal(97, elements.ChildElementCount); Assert.Equal("Sunday", elements.Children[0].Children[0].InnerHtml); - Assert.Equal("Saturday", elements.Children[298].Children[0].InnerHtml); + Assert.Equal("Saturday", elements.Children[96].Children[0].InnerHtml); Assert.Equal("Day", cut.Find("#deals_table_header").Children[0].InnerHtml); } @@ -158,9 +159,9 @@ dowSelect.Change("Friday"); var elements = getElements(cut); - Assert.Equal(51, elements.ChildElementCount); + Assert.Equal(18, elements.ChildElementCount); Assert.Equal("1881 by Lake Elmo Inn", elements.Children[0].Children[0].InnerHtml); - Assert.Equal("Wrestaurant at the Palace", elements.Children[50].Children[0].InnerHtml); + Assert.Equal("Urban Wok", elements.Children[17].Children[0].InnerHtml); Assert.Equal("Place", cut.Find("#deals_table_header").Children[0].InnerHtml); }