Add editorconfig and analyzers, format backend code
This commit is contained in:
@@ -4,35 +4,34 @@ using Musify.Application.Users;
|
||||
using Musify.Domain.Entities;
|
||||
using Xunit;
|
||||
|
||||
namespace Musify.Application.Tests.Users
|
||||
namespace Musify.Application.Tests.Users;
|
||||
|
||||
public sealed class UnfollowUserCommandHandlerTests : HandlerTestBase
|
||||
{
|
||||
public sealed class UnfollowUserCommandHandlerTests : HandlerTestBase
|
||||
private UnfollowUserCommandHandler CreateHandler() => new(Database, NoOpLogger<UnfollowUserCommandHandler>());
|
||||
|
||||
[Fact]
|
||||
public async Task Handle_ExistingFollow_RemovesIt()
|
||||
{
|
||||
private UnfollowUserCommandHandler CreateHandler() => new(Database, NoOpLogger<UnfollowUserCommandHandler>());
|
||||
var follower = TestEntities.User(1, "follower");
|
||||
var followed = TestEntities.User(2, "followed");
|
||||
await SeedAsync(follower, followed, new UserFollow { FollowerId = follower.Id, FollowedId = followed.Id });
|
||||
|
||||
[Fact]
|
||||
public async Task Handle_ExistingFollow_RemovesIt()
|
||||
{
|
||||
var follower = TestEntities.User(1, "follower");
|
||||
var followed = TestEntities.User(2, "followed");
|
||||
await SeedAsync(follower, followed, new UserFollow { FollowerId = follower.Id, FollowedId = followed.Id });
|
||||
var result = await CreateHandler().Handle(new UnfollowUserCommand(follower.Id, followed.Id), TestContext.Current.CancellationToken);
|
||||
|
||||
var result = await CreateHandler().Handle(new UnfollowUserCommand(follower.Id, followed.Id), TestContext.Current.CancellationToken);
|
||||
Assert.False(result.IsError);
|
||||
Assert.Empty(await Database.UserFollows.ToListAsync(TestContext.Current.CancellationToken));
|
||||
}
|
||||
|
||||
Assert.False(result.IsError);
|
||||
Assert.Empty(await Database.UserFollows.ToListAsync(TestContext.Current.CancellationToken));
|
||||
}
|
||||
[Fact]
|
||||
public async Task Handle_NotFollowing_IsIdempotent()
|
||||
{
|
||||
var follower = TestEntities.User(1, "follower");
|
||||
var followed = TestEntities.User(2, "followed");
|
||||
await SeedAsync(follower, followed);
|
||||
|
||||
[Fact]
|
||||
public async Task Handle_NotFollowing_IsIdempotent()
|
||||
{
|
||||
var follower = TestEntities.User(1, "follower");
|
||||
var followed = TestEntities.User(2, "followed");
|
||||
await SeedAsync(follower, followed);
|
||||
var result = await CreateHandler().Handle(new UnfollowUserCommand(follower.Id, followed.Id), TestContext.Current.CancellationToken);
|
||||
|
||||
var result = await CreateHandler().Handle(new UnfollowUserCommand(follower.Id, followed.Id), TestContext.Current.CancellationToken);
|
||||
|
||||
Assert.False(result.IsError);
|
||||
}
|
||||
Assert.False(result.IsError);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user