public void ReturnInviteWhenFound()
        {
            // Setup the client such that it will claim there is an associated invite with the given id.
            _mockMemoryStoreClient.Setup(client => client.GetAsync <InviteDataModel>(_storedInvite.Id))
            .ReturnsAsync(_storedInvite);

            // Verify that the expected invite was returned as a response.
            var context = Util.CreateFakeCallContext(SenderPlayerId, "");
            var request = new GetInviteRequest {
                InviteId = _storedInvite.Id
            };
            var invite = _inviteService.GetInvite(request, context).Result.Invite;

            Assert.NotNull(invite);
            InviteComparator.AssertEquivalent(_storedInvite, invite);
        }
Example #2
0
        public void ReturnPlayerInvitesIfTheyExist()
        {
            // Setup the client such that it will claim the user making this request is not involved in the invite.
            _mockMemoryStoreClient.Setup(client => client.GetAsync <PlayerInvites>(PlayerId2)).ReturnsAsync(_storedPlayerInvites);
            _mockMemoryStoreClient.Setup(client => client.GetAsync <InviteDataModel>(_storedOutboundInvite.Id))
            .ReturnsAsync(_storedOutboundInvite);
            _mockMemoryStoreClient.Setup(client => client.GetAsync <InviteDataModel>(_storedInboundInvite.Id))
            .ReturnsAsync(_storedInboundInvite);

            // Check that the expected invites have been returned.
            var context       = Util.CreateFakeCallContext(PlayerId2, "");
            var playerInvites = _inviteService.ListAllInvites(new ListAllInvitesRequest(), context).Result;

            Assert.AreEqual(1, playerInvites.InboundInvites.Count);
            var inboundInvite = playerInvites.InboundInvites[0];

            InviteComparator.AssertEquivalent(_storedInboundInvite, inboundInvite);

            Assert.AreEqual(1, playerInvites.OutboundInvites.Count);
            var outboundInvite = playerInvites.OutboundInvites[0];

            InviteComparator.AssertEquivalent(_storedOutboundInvite, outboundInvite);
        }