fix: replace deprecated TestContext with BunitContext
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
@inherits Bunit.TestContext
|
||||
@inherits Bunit.BunitContext
|
||||
|
||||
@code
|
||||
@code
|
||||
{
|
||||
private Mock<IPostService> _postServiceMock = new();
|
||||
|
||||
@@ -8,10 +8,10 @@
|
||||
public void Feed_WhenRendedAndNoPosts_ItShouldRenderNoPostsMessage()
|
||||
{
|
||||
_postServiceMock
|
||||
.Setup(x => x.GetPostsAsync())
|
||||
.ReturnsAsync(new List<Post>());
|
||||
.Setup(x => x.GetPostsAsync())
|
||||
.ReturnsAsync(new List<Post>());
|
||||
|
||||
var ctx = new TestContext();
|
||||
var ctx = new BunitContext();
|
||||
|
||||
ctx.Services.AddSingleton(_postServiceMock.Object);
|
||||
|
||||
@@ -24,15 +24,15 @@
|
||||
public void Feed_WhenRendedAndPosts_ItShouldRenderPosts()
|
||||
{
|
||||
List<Post> posts = [
|
||||
new Post() { Title = "Post 1", },
|
||||
new Post() { Title = "Post 2", },
|
||||
];
|
||||
new Post() { Title = "Post 1", },
|
||||
new Post() { Title = "Post 2", },
|
||||
];
|
||||
|
||||
_postServiceMock
|
||||
.Setup(x => x.GetPostsAsync())
|
||||
.ReturnsAsync(posts);
|
||||
.Setup(x => x.GetPostsAsync())
|
||||
.ReturnsAsync(posts);
|
||||
|
||||
var ctx = new TestContext();
|
||||
var ctx = new BunitContext();
|
||||
|
||||
ctx.Services.AddScoped(_ => _postServiceMock.Object);
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
@inherits Bunit.TestContext
|
||||
@inherits Bunit.BunitContext
|
||||
|
||||
@code
|
||||
@code
|
||||
{
|
||||
[Test]
|
||||
public void Footer_WhenRendered_ItShouldRenderFooterWithNavLinks()
|
||||
{
|
||||
var ctx = new TestContext();
|
||||
var ctx = new BunitContext();
|
||||
|
||||
var cut = ctx.Render(@<Footer />);
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@inherits Bunit.TestContext
|
||||
@inherits Bunit.BunitContext
|
||||
|
||||
@code
|
||||
{
|
||||
@@ -29,4 +29,4 @@
|
||||
var image = cut.Find("img[alt='Stevan Freeborn']");
|
||||
image.Should().NotBeNull();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user