コード例 #1
0
        public void PlayerCanDeleteAnEventThatTheySubmitted()
        {
            SubmitGameEventResponse eventResponse = client.SubmitGameEvent(new SubmitGameEventRequest()
            {
                EventData = new GameEventRequest()
                {
                    EventData    = ByteString.CopyFromUtf8("MyEventData"),
                    OccursAtTick = 42,
                },
                RoomId = gameId,
            });

            Assert.AreEqual(eventResponse.Status.IsSuccess, true);
            Assert.IsTrue(eventResponse.EventId != null);

            GetGameRoomEventsResponse gameEventsBeforeDelete = client.GetGameRoomEvents(new GetGameRoomEventsRequest()
            {
                RoomId = gameId
            });

            Assert.AreEqual(gameEventsBeforeDelete.Status.IsSuccess, true);
            Assert.AreEqual(1, gameEventsBeforeDelete.GameEvents.Count);
            Assert.IsTrue(gameEventsBeforeDelete.GameEvents.Any(it => it.Id == eventResponse.EventId));

            DeleteGameEventResponse deleteResponse = client.DeleteGameEvent(new DeleteGameEventRequest()
            {
                EventId = eventResponse.EventId,
                RoomId  = gameId,
            });

            Assert.AreEqual(deleteResponse.Status.IsSuccess, true);

            GetGameRoomEventsResponse gameEventsAfterDelete = client.GetGameRoomEvents(new GetGameRoomEventsRequest()
            {
                RoomId = gameId
            });

            Assert.AreEqual(gameEventsAfterDelete.Status.IsSuccess, true);
            Assert.AreEqual(0, gameEventsAfterDelete.GameEvents.Count);
        }