Example #1
0
        public void TestRedirectionInformationOnNotSafedExchange()
        {
            //given
            var players = new List <(int x, int y, int id, Team team)>()
            {
                (x : 5, y : 5, 1, Team.Red), (x : 4, y : 5, 2, Team.Red)
            };
            var map     = new Map(players: players);
            var message = new Message <ExchangeInformationResponse>()
            {
                AgentId        = 2,
                MessagePayload = new ExchangeInformationResponse()
                {
                    RespondToID = 1
                }
            };
            var exchangeInformationHandler           = new ExchangeInformationResponseHandler();
            Message <NotDefinedError> expectedResult = new Message <NotDefinedError>()
            {
                AgentId        = 2,
                MessagePayload = new NotDefinedError()
                {
                    Position = new Position()
                    {
                        X = 4, Y = 5
                    },
                    HoldingPiece = false
                }
            };
            //when
            Message response = exchangeInformationHandler.ProcessRequest(map, message, config);

            //then
            response.Should().BeEquivalentTo(expectedResult);
        }
Example #2
0
        public void TestRedirectionInformationOnSafedExchange()
        {
            //given
            var players = new List <(int x, int y, int id, Team team)>()
            {
                (x : 5, y : 5, 1, Team.Red), (x : 4, y : 5, 2, Team.Red)
            };
            var map = new Map(players: players);

            map.SaveInformationExchange(1, 2);
            var message = new Message <ExchangeInformationResponse>()
            {
                AgentId        = 2,
                MessagePayload = new ExchangeInformationResponse()
                {
                    RespondToID = 1
                }
            };
            var exchangeInformationHandler = new ExchangeInformationResponseHandler();
            Message <ExchangeInformationGMResponse> expectedResult = new Message <ExchangeInformationGMResponse>()
            {
                AgentId        = 1,
                MessagePayload = new ExchangeInformationGMResponse()
                {
                    RespondToID = 1
                }
            };
            //when
            Message response = exchangeInformationHandler.ProcessRequest(map, message, config);

            //then
            response.Should().BeEquivalentTo(expectedResult);
        }