using System.Threading.Tasks; using NUnit.Framework; using Aurora.Proto.Party; using Aurora.Services.Server; using Grpc.Core; using Autofac; namespace Aurora.test.ControllerTests { public class PartyControllerTests { 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 DefaultTest() { Party party = _remotePartyService.GetParty(new Proto.General.Empty()); Assert.NotNull(party); Assert.AreEqual(party.Name, "party/party1"); } } }