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