Added more unit tests for members resource
This commit is contained in:
parent
df2a6b4bfc
commit
f8ad2f459e
@ -3,6 +3,7 @@ using Aurora.Proto.PartyV2;
|
||||
using Aurora.Services.Server;
|
||||
using Grpc.Core;
|
||||
using System.Threading.Tasks;
|
||||
using System.Linq;
|
||||
|
||||
namespace Aurora.test.ControllerTests
|
||||
{
|
||||
@ -56,5 +57,87 @@ namespace Aurora.test.ControllerTests
|
||||
|
||||
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"));
|
||||
}
|
||||
}
|
||||
}
|
@ -163,7 +163,10 @@ namespace Aurora.Services.Server.EventManager
|
||||
public void CancelEventStream(string sessionIdentifierId)
|
||||
{
|
||||
_actionList.TryGetValue(sessionIdentifierId, out EventAction value);
|
||||
value.Cancel();
|
||||
if (value != null)
|
||||
{
|
||||
value.Cancel();
|
||||
}
|
||||
|
||||
RemoveEventHandler(sessionIdentifierId);
|
||||
}
|
||||
|
Reference in New Issue
Block a user