Skip to content

Commit 0de87cc

Browse files
committed
updated tests
1 parent e3d0877 commit 0de87cc

File tree

2 files changed

+33
-1
lines changed

2 files changed

+33
-1
lines changed

BugTrackerUI.Tests/CreatingNavigationAndComponents/AddNavigationNavLinkTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public void AddNavigationNavLinkTest()
3333

3434
var firstNavLink = firstLi.Descendants("NavLink").FirstOrDefault();
3535
Assert.True(firstNavLink != null && firstNavLink.Attributes["href"]?.Value == "" && firstNavLink.InnerText == "Home",
36-
"The first `li` element should contain a `NavLink` component with with an `href` set to `\" \"` and contain the text `\"Home\"`.");
36+
"The first `li` element should contain a `NavLink` component with with an `href` set to `\"\"` and contain the text `\"Home\"`.");
3737

3838
var secondNavLink = secondLi.Descendants("NavLink").FirstOrDefault();
3939
Assert.True(secondNavLink != null && secondNavLink.Attributes["href"]?.Value == "/new-bug" && secondNavLink.InnerText == "New Bug",
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
using HtmlAgilityPack;
2+
using System;
3+
using System.Collections.Generic;
4+
using System.IO;
5+
using System.Linq;
6+
using System.Text;
7+
using Xunit;
8+
using BugTrackerUI.Tests;
9+
10+
namespace M3_BugTrackerUI.Tests.CreatingNewBugForm
11+
{
12+
public class M4_07_UpdateEditFormSubmitTests
13+
{
14+
[Fact(DisplayName = "Update the EditForm Component submit @update-editform-submit")]
15+
public void M4_07_UpdateEditFormSubmitTest()
16+
{
17+
var filePath = TestHelpers.GetRootString() + "BugTrackerUI"
18+
+ Path.DirectorySeparatorChar + "Pages"
19+
+ Path.DirectorySeparatorChar + "NewBug.razor";
20+
21+
Assert.True(File.Exists(filePath), "`NewBug.razor` should exist in the `Pages` folder.");
22+
23+
var doc = new HtmlDocument();
24+
doc.Load(filePath);
25+
26+
var editForm = doc.DocumentNode.Descendants("EditForm")?.FirstOrDefault();
27+
28+
Assert.True(editForm != null && editForm.Attributes["OnValidSubmit"]?.Value == "@HandleValidSubmit",
29+
@"The `NewBug` component element should contain an `EditForm` component with with a `OnValidSubmit` attribute set to `@HandleValidSubmit`.");
30+
}
31+
}
32+
}

0 commit comments

Comments
 (0)