|
|
@ -7,6 +7,7 @@ using Microsoft.Data.Sqlite;
|
|
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
using Model;
|
|
|
|
using Model;
|
|
|
|
using StubContext;
|
|
|
|
using StubContext;
|
|
|
|
|
|
|
|
using Xunit.Abstractions;
|
|
|
|
|
|
|
|
|
|
|
|
namespace UnitTests;
|
|
|
|
namespace UnitTests;
|
|
|
|
|
|
|
|
|
|
|
@ -56,4 +57,29 @@ public class UsersControllerTest
|
|
|
|
var result = await controller.ShareTactic(new UsersController.ShareTacticToUserRequest(1, 2));
|
|
|
|
var result = await controller.ShareTactic(new UsersController.ShareTacticToUserRequest(1, 2));
|
|
|
|
result.Should().BeOfType<OkResult>();
|
|
|
|
result.Should().BeOfType<OkResult>();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[Fact]
|
|
|
|
|
|
|
|
public async Task GetSharedTacticsToUserTest()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var controller = GetUserController(2);
|
|
|
|
|
|
|
|
var result = await controller.GetSharedTacticsToUser(2);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var okResult = result as OkObjectResult;
|
|
|
|
|
|
|
|
var sharedTactics = okResult.Value as IEnumerable<Tactic>;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sharedTactics.Should().NotBeNull();
|
|
|
|
|
|
|
|
sharedTactics.Should().ContainSingle();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var tactic = sharedTactics.First();
|
|
|
|
|
|
|
|
tactic.Id.Should().Be(1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[Fact]
|
|
|
|
|
|
|
|
public async Task UnshareTacticTest()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var controller = GetUserController(1);
|
|
|
|
|
|
|
|
var result = await controller.UnshareTactic(1, 2);
|
|
|
|
|
|
|
|
result.Should().BeOfType<OkResult>();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|