-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test for TeamSettingsManialinkController
- Loading branch information
Showing
1 changed file
with
37 additions
and
0 deletions.
There are no files selected for viewing
37 changes: 37 additions & 0 deletions
37
tests/Modules/TeamSettingsModule.Tests/Controllers/TeamSettingsManialinkControllerTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
using EvoSC.Common.Interfaces.Localization; | ||
using EvoSC.Common.Interfaces.Models; | ||
using EvoSC.Manialinks.Interfaces.Models; | ||
using EvoSC.Modules.Official.TeamSettingsModule.Controllers; | ||
using EvoSC.Modules.Official.TeamSettingsModule.Interfaces; | ||
using EvoSC.Modules.Official.TeamSettingsModule.Models; | ||
using EvoSC.Testing; | ||
using EvoSC.Testing.Controllers; | ||
using Moq; | ||
using Xunit; | ||
|
||
namespace EvoSC.Modules.Official.TeamSettingsModule.Tests.Controllers; | ||
|
||
public class TeamSettingsManialinkControllerTests : ManialinkControllerTestBase<TeamSettingsManialinkController> | ||
{ | ||
private Mock<IOnlinePlayer> _player = new(); | ||
private Mock<IManialinkActionContext> _manialinkActionContext = new(); | ||
private Mock<ITeamSettingsService> _teamSettingsService = new(); | ||
|
||
public TeamSettingsManialinkControllerTests() | ||
{ | ||
InitMock(_player.Object, _manialinkActionContext.Object, _teamSettingsService, | ||
Mocking.NewLocaleMock(ContextService.Object)); | ||
} | ||
|
||
[Fact] | ||
public async Task Team_Settings_Updated() | ||
{ | ||
var teamSettings = new TeamSettingsModel(); | ||
|
||
await Controller.SaveTeamSettingsAsync(teamSettings); | ||
|
||
_teamSettingsService.Verify(m => m.SetTeamSettingsAsync(teamSettings)); | ||
_teamSettingsService.Verify(m => m.HideTeamSettingsAsync(Context.Object.Player)); | ||
AuditEventBuilder.Verify(m => m.Success()); | ||
} | ||
} |