This repository has been archived on 2020-12-20. You can view files and clone it, but cannot push or open issues or pull requests.
aurora-sharp-desktop/Aurora.test/ControllerTests/MediaControllerTest.cs

78 lines
1.9 KiB
C#
Raw Permalink Normal View History

2020-02-01 01:41:45 +00:00
using NUnit.Framework;
using Aurora.Proto.Party;
2020-02-01 01:41:45 +00:00
using Aurora.Services.Server;
using Grpc.Core;
using System.Threading.Tasks;
using System.Linq;
using System.IO;
using Autofac;
2020-02-01 01:41:45 +00:00
namespace Aurora.test.ControllerTests
{
public class MediaControllerTests
{
private RemotePartyService.RemotePartyServiceClient _remotePartyService;
private Channel _channel;
private IContainer _container;
private IServerService _serverService;
#region Setup
[OneTimeSetUp]
public void SetupOneTime()
{
_container = SetupUtil.SetupOneTime();
}
[OneTimeTearDown]
public void TearDownOneTime()
{
_container.Dispose();
}
2020-02-01 01:41:45 +00:00
[SetUp]
public void Setup()
{
_remotePartyService = SetupUtil.Setup(ref _container, ref _serverService, ref _channel);
2020-02-01 01:41:45 +00:00
}
[TearDown]
public async Task TearDown()
{
await _serverService.Stop();
2020-02-01 01:41:45 +00:00
await _channel.ShutdownAsync();
}
#endregion Setup
[Test]
public void TestNotEmpty()
{
ListMediaResponse resp = _remotePartyService.ListMedia(new ListMediaRequest()
{
Parent = "testParty",
PageSize = 5
});
Assert.NotNull(resp.Media);
Assert.NotZero(resp.Media.Count);
Assert.AreEqual(resp.Media.Count, 5);
}
[Test]
public void GetMediaTest()
{
ListMediaResponse resp = _remotePartyService.ListMedia(new ListMediaRequest()
{
Parent = "testParty",
PageSize = 5
});
Media media = _remotePartyService.GetMedia(new GetMediaRequest()
{
Name = resp.Media[0].Name
});
Assert.NotNull(media);
Assert.AreEqual(media.Name, resp.Media[0].Name);
}
2020-02-01 01:41:45 +00:00
}
}