Added unit test project
This commit is contained in:
parent
320967be89
commit
28afcf12e4
14
Aurora.sln
14
Aurora.sln
@ -5,6 +5,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Aurora", "Aurora\Aurora.csp
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Aurora.gtk", "Aurora.gtk\Aurora.gtk.csproj", "{E8C8C24A-5C51-47CB-B241-F5A9F0E808B1}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Aurora.test", "Aurora.test\Aurora.test.csproj", "{45680D8A-1AF1-4D93-AAC0-59CDB01CED5D}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|iPhoneSimulator = Debug|iPhoneSimulator
|
||||
@ -39,5 +41,17 @@ Global
|
||||
{E8C8C24A-5C51-47CB-B241-F5A9F0E808B1}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator
|
||||
{E8C8C24A-5C51-47CB-B241-F5A9F0E808B1}.Release|Any CPU.ActiveCfg = Release|iPhoneSimulator
|
||||
{E8C8C24A-5C51-47CB-B241-F5A9F0E808B1}.Release|Any CPU.Build.0 = Release|iPhoneSimulator
|
||||
{45680D8A-1AF1-4D93-AAC0-59CDB01CED5D}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
|
||||
{45680D8A-1AF1-4D93-AAC0-59CDB01CED5D}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
|
||||
{45680D8A-1AF1-4D93-AAC0-59CDB01CED5D}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
|
||||
{45680D8A-1AF1-4D93-AAC0-59CDB01CED5D}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
|
||||
{45680D8A-1AF1-4D93-AAC0-59CDB01CED5D}.Debug|iPhone.ActiveCfg = Debug|Any CPU
|
||||
{45680D8A-1AF1-4D93-AAC0-59CDB01CED5D}.Debug|iPhone.Build.0 = Debug|Any CPU
|
||||
{45680D8A-1AF1-4D93-AAC0-59CDB01CED5D}.Release|iPhone.ActiveCfg = Release|Any CPU
|
||||
{45680D8A-1AF1-4D93-AAC0-59CDB01CED5D}.Release|iPhone.Build.0 = Release|Any CPU
|
||||
{45680D8A-1AF1-4D93-AAC0-59CDB01CED5D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{45680D8A-1AF1-4D93-AAC0-59CDB01CED5D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{45680D8A-1AF1-4D93-AAC0-59CDB01CED5D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{45680D8A-1AF1-4D93-AAC0-59CDB01CED5D}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
24
Aurora.test/Aurora.test.csproj
Normal file
24
Aurora.test/Aurora.test.csproj
Normal file
@ -0,0 +1,24 @@
|
||||
<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" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Protobuf Remove="..\Aurora\Proto\general.proto" />
|
||||
<Protobuf Remove="..\Aurora\Proto\party.v2.proto" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Aurora\Aurora.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
31
Aurora.test/UnitTest1.cs
Normal file
31
Aurora.test/UnitTest1.cs
Normal file
@ -0,0 +1,31 @@
|
||||
using NUnit.Framework;
|
||||
using Aurora.Proto.PartyV2;
|
||||
using Aurora.Services.Server;
|
||||
using Grpc.Core;
|
||||
|
||||
namespace Aurora.test
|
||||
{
|
||||
public class Tests
|
||||
{
|
||||
private RemotePartyService.RemotePartyServiceClient _remotePartyService;
|
||||
private Channel _channel;
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
ServerService.Instance.Start("testParty", "asdf");
|
||||
_channel = new Channel(string.Format("{0}:{1}", ServerService.GetLocalIPAddress(), 8080), ChannelCredentials.Insecure);
|
||||
_remotePartyService = new RemotePartyService.RemotePartyServiceClient(_channel);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Test2()
|
||||
{
|
||||
ListMembersResponse resp = _remotePartyService.ListMembers(new ListMembersRequest()
|
||||
{
|
||||
Parent = "party1",
|
||||
PageSize = 10,
|
||||
});
|
||||
Assert.NotNull(resp);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,158 +1,88 @@
|
||||
<Project
|
||||
Sdk="Microsoft.NET.Sdk">
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
<ProduceAssemblyReference>true</ProduceAssemblyReference>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup
|
||||
Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference
|
||||
Include="Xamarin.Forms"
|
||||
Version="4.3.0.991211"/>
|
||||
<PackageReference
|
||||
Include="Xamarin.Essentials"
|
||||
Version="1.3.1"/>
|
||||
<PackageReference
|
||||
Include="taglib-sharp-netstandard2.0"
|
||||
Version="2.1.0"/>
|
||||
<PackageReference
|
||||
Include="LibVLCSharp.Forms"
|
||||
Version="3.3.1"/>
|
||||
<PackageReference
|
||||
Include="VideoLAN.LibVLC.Mac"
|
||||
Version="3.1.3.1"/>
|
||||
<PackageReference
|
||||
Include="Grpc"
|
||||
Version="2.25.0"/>
|
||||
<PackageReference
|
||||
Include="Grpc.Tools"
|
||||
Version="2.25.0"
|
||||
PrivateAssests="All">
|
||||
<PackageReference Include="Xamarin.Forms" Version="4.3.0.991211" />
|
||||
<PackageReference Include="Xamarin.Essentials" Version="1.3.1" />
|
||||
<PackageReference Include="taglib-sharp-netstandard2.0" Version="2.1.0" />
|
||||
<PackageReference Include="LibVLCSharp.Forms" Version="3.3.1" />
|
||||
<PackageReference Include="VideoLAN.LibVLC.Mac" Version="3.1.3.1" />
|
||||
<PackageReference Include="Grpc" Version="2.25.0" />
|
||||
<PackageReference Include="Grpc.Tools" Version="2.25.0" PrivateAssests="All">
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
</PackageReference>
|
||||
<PackageReference
|
||||
Include="Google.Protobuf"
|
||||
Version="3.10.1"/>
|
||||
<PackageReference
|
||||
Include="Xam.Plugins.Settings"
|
||||
Version="3.1.1"/>
|
||||
<PackageReference
|
||||
Include="Sharpnado.Forms.HorizontalListView"
|
||||
Version="1.3.0"/>
|
||||
<PackageReference
|
||||
Include="DLToolkit.Forms.Controls.FlowListView"
|
||||
Version="2.0.11"/>
|
||||
<PackageReference
|
||||
Include="CarouselView.FormsPlugin"
|
||||
Version="5.2.0"/>
|
||||
<PackageReference Include="Google.Protobuf" Version="3.10.1" />
|
||||
<PackageReference Include="Xam.Plugins.Settings" Version="3.1.1" />
|
||||
<PackageReference Include="Sharpnado.Forms.HorizontalListView" Version="1.3.0" />
|
||||
<PackageReference Include="DLToolkit.Forms.Controls.FlowListView" Version="2.0.11" />
|
||||
<PackageReference Include="CarouselView.FormsPlugin" Version="5.2.0" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder
|
||||
Include="Design\"/>
|
||||
<Folder
|
||||
Include="Design\Components\"/>
|
||||
<Folder
|
||||
Include="Design\Views\"/>
|
||||
<Folder
|
||||
Include="Design\Views\Songs\"/>
|
||||
<Folder
|
||||
Include="Design\Views\MainView\"/>
|
||||
<Folder
|
||||
Include="Design\Behaviors\"/>
|
||||
<Folder
|
||||
Include="Design\Components\NavigationMenu\"/>
|
||||
<Folder
|
||||
Include="Design\Views\Albums\"/>
|
||||
<Folder
|
||||
Include="Design\Views\Artists\"/>
|
||||
<Folder
|
||||
Include="Design\Views\Stations\"/>
|
||||
<Folder
|
||||
Include="Utils\"/>
|
||||
<Folder
|
||||
Include="Models\"/>
|
||||
<Folder
|
||||
Include="Services\"/>
|
||||
<Folder
|
||||
Include="Design\Views\Party\"/>
|
||||
<Folder
|
||||
Include="Design\Components\MemberList\"/>
|
||||
<Folder
|
||||
Include="Design\Components\Library\"/>
|
||||
<Folder
|
||||
Include="Design\Views\Profile\"/>
|
||||
<Folder
|
||||
Include="Design\Components\DataGrid\"/>
|
||||
<Folder
|
||||
Include="Resources\"/>
|
||||
<Folder
|
||||
Include="Design\Extensions\"/>
|
||||
<Folder
|
||||
Include="Design\Components\ImageButton\"/>
|
||||
<Folder
|
||||
Include="Design\Components\Dialogs\"/>
|
||||
<Folder
|
||||
Include="Design\Views\Party\NewPartyDialog\"/>
|
||||
<Folder
|
||||
Include="Design\Components\TabView\"/>
|
||||
<Folder Include="Design\" />
|
||||
<Folder Include="Design\Components\" />
|
||||
<Folder Include="Design\Views\" />
|
||||
<Folder Include="Design\Views\Songs\" />
|
||||
<Folder Include="Design\Views\MainView\" />
|
||||
<Folder Include="Design\Behaviors\" />
|
||||
<Folder Include="Design\Components\NavigationMenu\" />
|
||||
<Folder Include="Design\Views\Albums\" />
|
||||
<Folder Include="Design\Views\Artists\" />
|
||||
<Folder Include="Design\Views\Stations\" />
|
||||
<Folder Include="Utils\" />
|
||||
<Folder Include="Models\" />
|
||||
<Folder Include="Services\" />
|
||||
<Folder Include="Design\Views\Party\" />
|
||||
<Folder Include="Design\Components\MemberList\" />
|
||||
<Folder Include="Design\Components\Library\" />
|
||||
<Folder Include="Design\Views\Profile\" />
|
||||
<Folder Include="Design\Components\DataGrid\" />
|
||||
<Folder Include="Resources\" />
|
||||
<Folder Include="Design\Extensions\" />
|
||||
<Folder Include="Design\Components\ImageButton\" />
|
||||
<Folder Include="Design\Components\Dialogs\" />
|
||||
<Folder Include="Design\Views\Party\NewPartyDialog\" />
|
||||
<Folder Include="Design\Components\TabView\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile
|
||||
Remove="Design\Behaviors\DeselectItemBehaviorBase.cs"/>
|
||||
<Compile Remove="Design\Behaviors\DeselectItemBehaviorBase.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile
|
||||
Update="Design\Components\MusicPlayer\Player.xaml.cs">
|
||||
<Compile Update="Design\Components\MusicPlayer\Player.xaml.cs">
|
||||
<DependentUpon>Player.xaml</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Protobuf
|
||||
Include="Proto\general.proto"/>
|
||||
<Protobuf
|
||||
Include="Proto\party.proto"/>
|
||||
<Protobuf
|
||||
Include="Proto\events.proto"/>
|
||||
<Protobuf
|
||||
Include="Proto\playback.proto"/>
|
||||
<Protobuf
|
||||
Include="Proto\sync.proto"/>
|
||||
<Protobuf
|
||||
Include="Proto\party.v2.proto"/>
|
||||
<Protobuf Include="Proto\general.proto" />
|
||||
<Protobuf Include="Proto\party.proto" />
|
||||
<Protobuf Include="Proto\events.proto" />
|
||||
<Protobuf Include="Proto\playback.proto" />
|
||||
<Protobuf Include="Proto\sync.proto" />
|
||||
<Protobuf Include="Proto\party.v2.proto" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource
|
||||
Include="Resources\backward.png"/>
|
||||
<EmbeddedResource
|
||||
Include="Resources\forwards.png"/>
|
||||
<EmbeddedResource
|
||||
Include="Resources\like.png"/>
|
||||
<EmbeddedResource
|
||||
Include="Resources\play.png"/>
|
||||
<EmbeddedResource Include="Resources\backward.png" />
|
||||
<EmbeddedResource Include="Resources\forwards.png" />
|
||||
<EmbeddedResource Include="Resources\like.png" />
|
||||
<EmbeddedResource Include="Resources\play.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource
|
||||
Update="Design\Components\NavigationMenu\NavigationMenu.css">
|
||||
<EmbeddedResource Update="Design\Components\NavigationMenu\NavigationMenu.css">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None
|
||||
Remove="Design\Resources\unselected.png"/>
|
||||
<None
|
||||
Remove="Design\Components\MediaPlayer\play.png"/>
|
||||
<None
|
||||
Remove="Resources\backward.png"/>
|
||||
<None
|
||||
Remove="Resources\forwards.png"/>
|
||||
<None
|
||||
Remove="Resources\like.png"/>
|
||||
<None
|
||||
Remove="Resources\play.png"/>
|
||||
<None Remove="Design\Resources\unselected.png" />
|
||||
<None Remove="Design\Components\MediaPlayer\play.png" />
|
||||
<None Remove="Resources\backward.png" />
|
||||
<None Remove="Resources\forwards.png" />
|
||||
<None Remove="Resources\like.png" />
|
||||
<None Remove="Resources\play.png" />
|
||||
</ItemGroup>
|
||||
</Project>
|
@ -25,8 +25,15 @@ namespace Aurora.Services.Server.Controllers
|
||||
startIdx = _memberList.IndexOfKey(request.PageToken) + 1;
|
||||
}
|
||||
|
||||
//Assign pageSize
|
||||
if (request.PageSize > _memberList.Count)
|
||||
{
|
||||
request.PageSize = _memberList.Count;
|
||||
}
|
||||
|
||||
|
||||
//Gather page
|
||||
List<Member> members = (List<Member>)_memberList.Values;
|
||||
List<Member> members = new List<Member>(_memberList.Values);
|
||||
resp.Members.AddRange(members.GetRange(startIdx, request.PageSize));
|
||||
|
||||
//Set next page token
|
||||
|
@ -26,7 +26,7 @@ namespace Aurora.Services.Server.Controllers
|
||||
this._description = description;
|
||||
this._memberList = new SortedList<string, Member>();
|
||||
|
||||
string userName = SettingsService.Instance.Username;
|
||||
string userName = "testUser";
|
||||
|
||||
this._eventManager = new EventManager.EventManager();
|
||||
|
||||
@ -36,6 +36,8 @@ namespace Aurora.Services.Server.Controllers
|
||||
UserName = userName,
|
||||
IpAddress = ServerService.GetLocalIPAddress(),
|
||||
};
|
||||
|
||||
this._memberList.Add(_hostMember.Name, _hostMember);
|
||||
}
|
||||
|
||||
public override Task<Party> GetParty(Proto.General.Empty request, Grpc.Core.ServerCallContext context)
|
||||
|
@ -11,7 +11,7 @@ namespace Aurora.Services.Server
|
||||
{
|
||||
public class ServerService : BaseService<ServerService>
|
||||
{
|
||||
private int _port = SettingsService.Instance.DefaultPort;
|
||||
private int _port = 8080;
|
||||
private string _hostname;
|
||||
private Grpc.Core.Server _server;
|
||||
|
||||
|
@ -9,6 +9,9 @@
|
||||
"**/bin": true,
|
||||
"**/obj": true,
|
||||
"**/packages": true
|
||||
}
|
||||
},
|
||||
"nxunitExplorer.nunit": "/Users/brandonwatson/Documents/Gitlab/Aurora/aurora-sharp-desktop/Aurora.test/bin/Debug/nunit.framework.dll",
|
||||
"nxunitExplorer.logpanel": true,
|
||||
"dotnet-test-explorer.testProjectPath": "./Aurora.test"
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user