예제 #1
0
        private void GetAndDispatchMessages()
        {
            List <PlayerMessage> msg = _quoridorServiceConnector.GetMessages();

            msg = FilterGameEvents(msg);
            _msgs.AddRange(msg);
            if (msg.Count > 0)
            {
                Debug.WriteLine(msg[0].Message);
                GamePage.UpdateMessages(msg);
            }
        }
예제 #2
0
        public void ServiceConnectorGetMessagesTest()
        {
            // arrange
            IServiceConnector serviceConnector = ServiceConnector.GetInstance();

            serviceConnector.SetAddress("http://localhost:5000/");
            serviceConnector.TrySetUsername("testUser", out var testUser);

            // act
            var result = serviceConnector.GetMessages(_adminUserId);

            // assert
            Assert.IsNotNull(result);
            Assert.IsTrue(result.Any());
            Assert.AreEqual("Hallo ich bin der Admin Benutzer", result.First().Text);
        }
예제 #3
0
        public void ServiceConnectorSendMessageAndGetMessageTest()
        {
            // arrange
            IServiceConnector serviceConnector = ServiceConnector.GetInstance();

            serviceConnector.SetAddress("http://localhost:5000/");
            serviceConnector.TrySetUsername("testUser", out _);

            // act
            serviceConnector.SendMessage(_adminUserId, "Hallo test");
            var result = serviceConnector.GetMessages(_adminUserId);

            // assert
            Assert.IsNotNull(result);
            Assert.IsTrue(result.Any());
            Assert.AreEqual("Hallo test", result.Last().Text);
        }