Added basic unit tests for all controllers

This commit is contained in:
watsonb8
2020-02-02 13:05:14 -05:00
parent 8231a18c3e
commit 2a7e10364e
11 changed files with 255 additions and 62 deletions

View File

@ -3,7 +3,9 @@ using System.Collections.ObjectModel;
using System.Collections.Generic;
using Aurora.Proto.PartyV2;
using Aurora.Services.Library;
using Aurora.Services.Settings;
using Aurora.Models.Media;
using Aurora.Services.Server.EventManager;
using Autofac;
namespace Aurora.Services.Server.Controllers
@ -11,11 +13,13 @@ namespace Aurora.Services.Server.Controllers
public partial class RemotePartyController : RemotePartyService.RemotePartyServiceBase
{
private ILibraryService _libraryService;
private ISettingsService _settingsService;
private IEventManager _eventManager;
/// <summary>
/// Constructor for partial class
/// </summary>
public RemotePartyController(string partyName, string description, ILibraryService libraryService)
public RemotePartyController(string partyName, string description, ILibraryService libraryService, ISettingsService settingsService, IEventManager eventManager)
{
this._startDateTime = DateTime.UtcNow;
this._displayName = partyName;
@ -24,10 +28,11 @@ namespace Aurora.Services.Server.Controllers
this._mediaList = new SortedList<string, Media>();
_libraryService = libraryService;
this._settingsService = settingsService;
string userName = "testUser";
string userName = _settingsService.Username;
this._eventManager = new EventManager.EventManager();
this._eventManager = eventManager;
this._hostMember = new Member()
{
@ -54,7 +59,7 @@ namespace Aurora.Services.Server.Controllers
metadata = media.Metadata as AudioMetadata;
Media data = new Media();
data.Name = media.Id;
data.Name = string.Format("{0}/{1}", partyName, media.Id);
if (metadata.Title != null)
{
data.Title = metadata.Title;

View File

@ -15,8 +15,6 @@ namespace Aurora.Services.Server.Controllers
private Member _hostMember;
private DateTime _startDateTime;
private EventManager.EventManager _eventManager;
public override Task<Party> GetParty(Proto.General.Empty request, Grpc.Core.ServerCallContext context)
{
Party party = new Party()