forked from Blazored/SessionStorage
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIndexPageTests.cs
More file actions
27 lines (23 loc) · 723 Bytes
/
Copy pathIndexPageTests.cs
File metadata and controls
27 lines (23 loc) · 723 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
using System.Threading.Tasks;
using Bunit;
using Xunit;
namespace bUnitExample
{
public class IndexPageTests : TestContext
{
[Fact]
public async Task SavesNameToSessionStorage()
{
// Arrange
const string inputName = "John Smith";
var sessionStorage = this.AddBlazoredSessionStorage();
var cut = RenderComponent<BlazorWebAssembly.Pages.Index>();
// Act
cut.Find("#Name").Change(inputName);
cut.Find("#NameButton").Click();
// Assert
var name = await sessionStorage.GetItemAsync<string>("name");
Assert.Equal(inputName, name);
}
}
}