Skip to content

Commit

Permalink
savepoint
Browse files Browse the repository at this point in the history
  • Loading branch information
eebbesen committed Nov 7, 2024
1 parent f9afe26 commit 0b02d02
Showing 1 changed file with 18 additions and 17 deletions.
35 changes: 18 additions & 17 deletions StpFoodBlazor/StpFoodBlazorTest/Pages/DealsTest.razor
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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]
Expand All @@ -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(@<Deals />);
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(@<Deals />);
var elements = getElements(cut);

Assert.Equal(55, elements.ChildElementCount);
Assert.Equal(21, elements.ChildElementCount);
}

[Fact]
Expand All @@ -105,7 +106,7 @@
dowSelect.Change("Monday");

var elements = getElements(cut);
Assert.Equal(45, elements.ChildElementCount);
Assert.Equal(16, elements.ChildElementCount);
}

[Fact]
Expand All @@ -117,7 +118,7 @@
dowSelect.Change("Friday");

var elements = getElements(cut);
Assert.Equal(51, elements.ChildElementCount);
Assert.Equal(18, elements.ChildElementCount);
}

[Fact]
Expand All @@ -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]
Expand All @@ -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);
}

Expand All @@ -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);
}

Expand Down

0 comments on commit 0b02d02

Please sign in to comment.