using NUnit.Framework; using Aurora.Proto.Party; using Aurora.Services.Server; using Grpc.Core; using System.Threading.Tasks; using System.Linq; using System.IO; using Autofac; 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(); } [SetUp] public void Setup() { _remotePartyService = SetupUtil.Setup(ref _container, ref _serverService, ref _channel); } [TearDown] public async Task TearDown() { await _serverService.Stop(); 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); } } }