Migrated aurora-sharp-desktop to /aurora-sharp-desktop
This commit is contained in:
117
aurora-sharp-desktop/Aurora.test/Aurora.test.csproj
Normal file
117
aurora-sharp-desktop/Aurora.test/Aurora.test.csproj
Normal file
@ -0,0 +1,117 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||
<IsPackable>false</IsPackable>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="nunit" Version="3.12.0" />
|
||||
<PackageReference Include="NUnit3TestAdapter" Version="3.13.0" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
|
||||
<PackageReference Include="Grpc.Core" Version="2.26.0" />
|
||||
<PackageReference Include="Grpc.Tools" Version="2.26.0">
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Grpc" Version="2.26.0" />
|
||||
<PackageReference Include="Autofac" Version="5.0.0" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Protobuf Remove="..\Aurora\Proto\general.proto" />
|
||||
<Protobuf Remove="..\Aurora\Proto\party.v2.proto" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Aurora\Aurora.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Update="Resources\Jidenna\The Chief\01 A Bull%27s Tale.mp3">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Resources\Jidenna\The Chief\04 Bambi.mp3">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Resources\Jidenna\The Chief\14 Bully Of The Earth.mp3">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Resources\Jidenna\The Chief\12 Some Kind Of Way.mp3">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Resources\Jidenna\The Chief\03 Trampoline.mp3">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Resources\Jidenna\The Chief\09 Safari.mp3">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Resources\Jidenna\The Chief\05 Helicopters _ Beware.mp3">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Resources\Jidenna\The Chief\08 The Let Out.mp3">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Resources\Jidenna\The Chief\10 Adaora.mp3">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Resources\Jidenna\The Chief\07 2 Points.mp3">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Resources\Jidenna\The Chief\06 Long Live The Chief.mp3">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Resources\Jidenna\The Chief\02 Chief Don%27t Run.mp3">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Resources\Jidenna\The Chief\11 Little Bit More.mp3">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Resources\Jidenna\The Chief\13 White Niggas.mp3">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Resources\Mac Miller\Best Day Ever\16 BDE Bonus %28Prod. By_ ID Labs%29.mp3">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Resources\Mac Miller\Best Day Ever\11 Play Ya Cards %28Prod By_ Chuck Inglish%29.m4a">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Resources\Mac Miller\Best Day Ever\08 All Around The World %28Prod. By_ Just Blaze%29.m4a">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Resources\Mac Miller\Best Day Ever\10 In The Air %28Prod By_ Ritz Reynolds%29.m4a">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Resources\Mac Miller\Best Day Ever\05 I%27ll Be There %28feat. Phonte%29 %28Prod. By_ Beanz %27n%27 Kornbread%29.mp3">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Resources\Mac Miller\Best Day Ever\03 Donald Trump %28Prod. By_ Sap%29.m4a">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Resources\Mac Miller\Best Day Ever\13 Life Ain%27t Easy %28Prod. By_ ID Labs%29.m4a">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Resources\Mac Miller\Best Day Ever\09 Down The Rabbit Hole %28Prod. By_ Blue of The Sore Losers%29.m4a">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Resources\Mac Miller\Best Day Ever\07 Wake Up %28Prod By_ Sap & ID Labs%29.m4a">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Resources\Mac Miller\Best Day Ever\04 Oy Vey %28Prod By_ ID Labs%29.mp3">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Resources\Mac Miller\Best Day Ever\01 Best Day Ever %28Prod. By_ ID Labs%29.m4a">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Resources\Mac Miller\Best Day Ever\02 Get Up %28Prod. By_ Teddy Roxpin%29.m4a">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Resources\Mac Miller\Best Day Ever\14 Snooze %28Prod By_ ID Labs%29.m4a">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Resources\Mac Miller\Best Day Ever\12 She Said %28Prod By_ Khrysis%29.m4a">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Resources\Mac Miller\Best Day Ever\15 Keep Floatin%27 %28feat. Wiz Khalifa%29 %28Prod. By_ ID Labs%29.mp3">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Resources\Mac Miller\Best Day Ever\06 Wear My Hat %28Prod. By_ Chuck Inglish%29.m4a">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
</Project>
|
100
aurora-sharp-desktop/Aurora.test/ControllerTests/EventTests.cs
Normal file
100
aurora-sharp-desktop/Aurora.test/ControllerTests/EventTests.cs
Normal file
@ -0,0 +1,100 @@
|
||||
|
||||
using NUnit.Framework;
|
||||
using Aurora.Proto.Party;
|
||||
using Aurora.Services.Server;
|
||||
using Aurora.Services.EventManager;
|
||||
using Grpc.Core;
|
||||
using System.Threading.Tasks;
|
||||
using System.Threading;
|
||||
using Autofac;
|
||||
namespace Aurora.test.ControllerTests
|
||||
{
|
||||
public class EventTest
|
||||
{
|
||||
private RemotePartyService.RemotePartyServiceClient _remotePartyService;
|
||||
private Channel _channel;
|
||||
private IContainer _container;
|
||||
private IServerService _serverService;
|
||||
|
||||
#region Setup
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
_container = SetupUtil.SetupOneTime();
|
||||
_remotePartyService = SetupUtil.Setup(ref _container, ref _serverService, ref _channel);
|
||||
}
|
||||
|
||||
[TearDown]
|
||||
public async Task TearDown()
|
||||
{
|
||||
await _serverService.Stop();
|
||||
await _channel.ShutdownAsync();
|
||||
_container.Dispose();
|
||||
}
|
||||
#endregion Setup
|
||||
[Test]
|
||||
[TestCase(EventType.MediaPlaying)]
|
||||
public void Asdf(EventType value)
|
||||
{
|
||||
Assert.AreEqual(1, 1);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[TestCase(EventType.MediaPlaying)]
|
||||
[TestCase(EventType.MediaStopped)]
|
||||
[TestCase(EventType.MemberCreated)]
|
||||
[TestCase(EventType.MemberDeleted)]
|
||||
public async Task TestEventSubscriptions(EventType value)
|
||||
{
|
||||
using (var scope = _container.BeginLifetimeScope())
|
||||
{
|
||||
IEventManager eventManager = scope.Resolve<IEventManager>();
|
||||
|
||||
//Create new party member
|
||||
Member member = _remotePartyService.CreateMember(new CreateMemberRequest()
|
||||
{
|
||||
Parent = "party1",
|
||||
Member = new Member()
|
||||
{
|
||||
UserName = "newMember1",
|
||||
IpAddress = ServerService.GetLocalIPAddress(),
|
||||
}
|
||||
});
|
||||
|
||||
//Subscribe to event type
|
||||
_remotePartyService.CreateEventSubscription(new CreateEventSubscriptionRequest()
|
||||
{
|
||||
Parent = member.Name,
|
||||
EventSubscription = new EventSubscription()
|
||||
{
|
||||
Type = value
|
||||
}
|
||||
});
|
||||
|
||||
BaseEvent @event = new BaseEvent
|
||||
{
|
||||
EventType = value,
|
||||
};
|
||||
//Fire event
|
||||
|
||||
CancellationTokenSource eventCancellationTokenSource = new CancellationTokenSource();
|
||||
BaseEvent newEvent = null;
|
||||
|
||||
Task.Run(async () => { await Task.Delay(1000); eventManager.FireEvent(@event); });
|
||||
|
||||
using (AsyncServerStreamingCall<BaseEvent> eventStream = _remotePartyService
|
||||
.GetEvents(new GetEventsRequest() { Parent = member.Name }))
|
||||
{
|
||||
while ((!eventCancellationTokenSource.Token.IsCancellationRequested &&
|
||||
await eventStream.ResponseStream.MoveNext(eventCancellationTokenSource.Token)))
|
||||
{
|
||||
newEvent = new BaseEvent(eventStream.ResponseStream.Current);
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
Assert.AreEqual(newEvent.EventType, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,78 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,206 @@
|
||||
using NUnit.Framework;
|
||||
using Aurora.Proto.Party;
|
||||
using Aurora.Services.Server;
|
||||
using Grpc.Core;
|
||||
using System.Threading.Tasks;
|
||||
using System.Linq;
|
||||
using Autofac;
|
||||
|
||||
namespace Aurora.test.ControllerTests
|
||||
{
|
||||
public class MemberControllerTests
|
||||
{
|
||||
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()
|
||||
{
|
||||
ListMembersResponse resp = _remotePartyService.ListMembers(new ListMembersRequest()
|
||||
{
|
||||
Parent = "party1",
|
||||
PageSize = 10,
|
||||
});
|
||||
Assert.NotNull(resp);
|
||||
Assert.GreaterOrEqual(resp.Members.Count, 1);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[TestCase("Alex")]
|
||||
[TestCase("Alex Goldberg")]
|
||||
[TestCase("Alex/goldberg")]
|
||||
[TestCase("alex@welcome.com")]
|
||||
public void CreateMemberTest(string value)
|
||||
{
|
||||
Member member = _remotePartyService.CreateMember(new CreateMemberRequest()
|
||||
{
|
||||
Parent = "party1",
|
||||
Member = new Member()
|
||||
{
|
||||
UserName = value,
|
||||
IpAddress = ServerService.GetLocalIPAddress(),
|
||||
}
|
||||
});
|
||||
|
||||
Assert.NotNull(member);
|
||||
}
|
||||
|
||||
static object[] MultipleMembersCases =
|
||||
{
|
||||
new object[] {"Tupac", "Aubrey Grahm", "Beyonce Knowls", "Ke$ha", "A$ap Ferg"},
|
||||
};
|
||||
|
||||
[Test]
|
||||
[TestCaseSource("MultipleMembersCases")]
|
||||
public void CreateMultiplMembersTest(object[] memberNames)
|
||||
{
|
||||
//Add members
|
||||
foreach (string name in memberNames)
|
||||
{
|
||||
Member member = _remotePartyService.CreateMember(new CreateMemberRequest()
|
||||
{
|
||||
Parent = "party1",
|
||||
Member = new Member()
|
||||
{
|
||||
UserName = name
|
||||
}
|
||||
});
|
||||
|
||||
Assert.NotNull(member);
|
||||
}
|
||||
|
||||
//List members
|
||||
ListMembersResponse resp = _remotePartyService.ListMembers(new ListMembersRequest()
|
||||
{
|
||||
Parent = "party1",
|
||||
PageSize = 10,
|
||||
});
|
||||
Assert.NotNull(resp);
|
||||
Assert.AreEqual(resp.Members.Count, 6);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[TestCaseSource("MultipleMembersCases")]
|
||||
public void DeleteMemberTest(object[] memberNames)
|
||||
{
|
||||
//Add members
|
||||
foreach (string name in memberNames)
|
||||
{
|
||||
Member member = _remotePartyService.CreateMember(new CreateMemberRequest()
|
||||
{
|
||||
Parent = "party1",
|
||||
Member = new Member()
|
||||
{
|
||||
UserName = name
|
||||
}
|
||||
});
|
||||
|
||||
Assert.NotNull(member);
|
||||
}
|
||||
|
||||
//List members
|
||||
ListMembersResponse resp = _remotePartyService.ListMembers(new ListMembersRequest()
|
||||
{
|
||||
Parent = "party1",
|
||||
PageSize = 10,
|
||||
});
|
||||
Assert.NotNull(resp);
|
||||
Assert.AreEqual(resp.Members.Count, 6);
|
||||
|
||||
string keshaResourceName = resp.Members.First(member => member.UserName == "Ke$ha").Name;
|
||||
|
||||
//Delete member
|
||||
|
||||
_remotePartyService.DeleteMember(new DeleteMemberRequest()
|
||||
{
|
||||
Name = keshaResourceName
|
||||
});
|
||||
|
||||
//List members
|
||||
resp = _remotePartyService.ListMembers(new ListMembersRequest()
|
||||
{
|
||||
Parent = "party1",
|
||||
PageSize = 10,
|
||||
});
|
||||
Assert.NotNull(resp);
|
||||
Assert.AreEqual(resp.Members.Count, 5);
|
||||
Assert.False(resp.Members.Any(member => member.UserName == "Ke$sha"));
|
||||
}
|
||||
|
||||
static object[] PagingCases =
|
||||
{
|
||||
new object[] {"Tupac", "Aubrey Grahm", "Beyonce Knowls", "Ke$ha", "A$ap Ferg", "asdf", "sdfa", "dfas", "fasd"},
|
||||
};
|
||||
|
||||
[Test]
|
||||
[TestCaseSource("PagingCases")]
|
||||
public void MemberPagingTest(object[] members)
|
||||
{
|
||||
foreach (string name in members)
|
||||
{
|
||||
Member member = _remotePartyService.CreateMember(new CreateMemberRequest()
|
||||
{
|
||||
Parent = "party1",
|
||||
Member = new Member()
|
||||
{
|
||||
UserName = name
|
||||
}
|
||||
});
|
||||
|
||||
Assert.NotNull(member);
|
||||
}
|
||||
|
||||
//List members
|
||||
ListMembersResponse resp = _remotePartyService.ListMembers(new ListMembersRequest()
|
||||
{
|
||||
Parent = "party1",
|
||||
PageSize = 2,
|
||||
});
|
||||
|
||||
string nextPageToken = resp.NextPageToken;
|
||||
|
||||
Assert.AreEqual(resp.Members.Count, 2);
|
||||
|
||||
//List members
|
||||
resp = _remotePartyService.ListMembers(new ListMembersRequest()
|
||||
{
|
||||
Parent = "party1",
|
||||
PageSize = 2,
|
||||
PageToken = nextPageToken,
|
||||
});
|
||||
|
||||
Assert.AreEqual(resp.Members.Count, 2);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,53 @@
|
||||
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");
|
||||
}
|
||||
}
|
||||
}
|
39
aurora-sharp-desktop/Aurora.test/ControllerTests/Setup.cs
Normal file
39
aurora-sharp-desktop/Aurora.test/ControllerTests/Setup.cs
Normal file
@ -0,0 +1,39 @@
|
||||
using Autofac;
|
||||
using Aurora.Proto.Party;
|
||||
using Aurora.Services.Server;
|
||||
using Aurora.Services.Library;
|
||||
using Aurora.Services.Settings;
|
||||
using Aurora.Services.EventManager;
|
||||
using Aurora.test.Models.Mock;
|
||||
using System.IO;
|
||||
using Grpc.Core;
|
||||
|
||||
namespace Aurora.test.ControllerTests
|
||||
{
|
||||
public class SetupUtil
|
||||
{
|
||||
public static IContainer SetupOneTime()
|
||||
{
|
||||
ContainerBuilder builder = new ContainerBuilder();
|
||||
builder.RegisterType<ServerService>().As<IServerService>().SingleInstance();
|
||||
builder.RegisterInstance<ISettingsService>(new SettingsServiceMock()
|
||||
{
|
||||
Username = "Test User 1",
|
||||
DefaultPort = 4005,
|
||||
LibraryLocation = string.Format("{0}/Resources", Directory.GetCurrentDirectory())
|
||||
}).SingleInstance();
|
||||
builder.RegisterType<LibraryService>().As<ILibraryService>().SingleInstance();
|
||||
builder.RegisterType<EventManager>().As<IEventManager>().SingleInstance();
|
||||
return builder.Build();
|
||||
}
|
||||
|
||||
public static RemotePartyService.RemotePartyServiceClient Setup(ref IContainer container, ref IServerService serverService, ref Channel channel)
|
||||
{
|
||||
serverService = container.Resolve<IServerService>();
|
||||
serverService.Start("testParty", "asdf");
|
||||
channel = new Channel(string.Format("{0}:{1}", ServerService.GetLocalIPAddress(), 8080), ChannelCredentials.Insecure);
|
||||
return new RemotePartyService.RemotePartyServiceClient(channel);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
39
aurora-sharp-desktop/Aurora.test/Models/CallContext.cs
Normal file
39
aurora-sharp-desktop/Aurora.test/Models/CallContext.cs
Normal file
@ -0,0 +1,39 @@
|
||||
using System;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Grpc.Core;
|
||||
|
||||
namespace Aurora.test.Models
|
||||
{
|
||||
public class CallContext : ServerCallContext
|
||||
{
|
||||
protected override string MethodCore => throw new NotImplementedException();
|
||||
|
||||
protected override string HostCore => throw new NotImplementedException();
|
||||
|
||||
protected override string PeerCore => throw new NotImplementedException();
|
||||
|
||||
protected override DateTime DeadlineCore => throw new NotImplementedException();
|
||||
|
||||
protected override Metadata RequestHeadersCore => throw new NotImplementedException();
|
||||
|
||||
protected override CancellationToken CancellationTokenCore => throw new NotImplementedException();
|
||||
|
||||
protected override Metadata ResponseTrailersCore => throw new NotImplementedException();
|
||||
|
||||
protected override Status StatusCore { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
|
||||
protected override WriteOptions WriteOptionsCore { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
|
||||
|
||||
protected override AuthContext AuthContextCore => throw new NotImplementedException();
|
||||
|
||||
protected override ContextPropagationToken CreatePropagationTokenCore(ContextPropagationOptions options)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
protected override Task WriteResponseHeadersAsyncCore(Metadata responseHeaders)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
using Aurora.Services.Settings;
|
||||
using Plugin.Settings.Abstractions;
|
||||
|
||||
namespace Aurora.test.Models.Mock
|
||||
{
|
||||
public class SettingsServiceMock : ISettingsService
|
||||
{
|
||||
public SettingsServiceMock()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public ISettings AppSettings { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The user's username. This is persisted.
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
public string Username { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The default port to use. This is persisted.
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
public int DefaultPort { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The current sessions clientId. This is assigned by the server. This is not persisted.
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
public string ClientName { get; set; }
|
||||
|
||||
public string LibraryLocation { get; set; }
|
||||
}
|
||||
}
|
Binary file not shown.
Binary file not shown.
BIN
aurora-sharp-desktop/Aurora.test/Resources/Jidenna/The Chief/03 Trampoline.mp3
Executable file
BIN
aurora-sharp-desktop/Aurora.test/Resources/Jidenna/The Chief/03 Trampoline.mp3
Executable file
Binary file not shown.
BIN
aurora-sharp-desktop/Aurora.test/Resources/Jidenna/The Chief/04 Bambi.mp3
Executable file
BIN
aurora-sharp-desktop/Aurora.test/Resources/Jidenna/The Chief/04 Bambi.mp3
Executable file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
aurora-sharp-desktop/Aurora.test/Resources/Jidenna/The Chief/07 2 Points.mp3
Executable file
BIN
aurora-sharp-desktop/Aurora.test/Resources/Jidenna/The Chief/07 2 Points.mp3
Executable file
Binary file not shown.
BIN
aurora-sharp-desktop/Aurora.test/Resources/Jidenna/The Chief/08 The Let Out.mp3
Executable file
BIN
aurora-sharp-desktop/Aurora.test/Resources/Jidenna/The Chief/08 The Let Out.mp3
Executable file
Binary file not shown.
BIN
aurora-sharp-desktop/Aurora.test/Resources/Jidenna/The Chief/09 Safari.mp3
Executable file
BIN
aurora-sharp-desktop/Aurora.test/Resources/Jidenna/The Chief/09 Safari.mp3
Executable file
Binary file not shown.
BIN
aurora-sharp-desktop/Aurora.test/Resources/Jidenna/The Chief/10 Adaora.mp3
Executable file
BIN
aurora-sharp-desktop/Aurora.test/Resources/Jidenna/The Chief/10 Adaora.mp3
Executable file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
aurora-sharp-desktop/Aurora.test/Resources/Jidenna/The Chief/13 White Niggas.mp3
Executable file
BIN
aurora-sharp-desktop/Aurora.test/Resources/Jidenna/The Chief/13 White Niggas.mp3
Executable file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user