public void TestInsufficentWordsResultsInEmptyEvent() {
            var called = false;

            var protocol = new SecondGame();

            protocol.ProtocolEvent += (protocol1, args) => { called = true; };

            var request = new FrostbitePacket();

            var response = new FrostbitePacket();

            protocol.PlayerOnKillDispatchHandler(request, response);

            Assert.IsFalse(called);
        }
        public void TestWords4NotABooleanResultsInEmptyEvent() {
            var called = false;
            var protocol = new SecondGame();

            protocol.ProtocolEvent += (protocol1, args) => { called = true; };

            var request = new FrostbitePacket() {
                Packet = new Packet() {
                    Words = new List<String>() {
                        "a",
                        "b",
                        "c",
                        "d",
                        "e"
                    }
                }
            };

            var response = new FrostbitePacket();

            protocol.PlayerOnKillDispatchHandler(request, response);

            Assert.IsFalse(called);
        }
        public void TestPassingThroughCorrectFormatResultsInEvent() {
            var called = false;
            var protocol = new SecondGame();

            protocol.State.Players.TryAdd("EA_1", new PlayerModel() {
                Name = "Phogue",
                Uid = "EA_1",
                Score = 100,
                Kills = 5,
                Deaths = 5
            });

            protocol.State.Players.TryAdd("EA_2", new PlayerModel() {
                Name = "Zaeed",
                Uid = "EA_2",
                Score = 100,
                Kills = 5,
                Deaths = 5
            });

            protocol.ProtocolEvent += (protocol1, args) => { called = true; };

            var request = new FrostbitePacket() {
                Packet = new Packet() {
                    Words = new List<String>() {
                        "player.onKill",
                        "Phogue",
                        "Zaeed",
                        "Fairyfloss",
                        "true"
                    }
                }
            };

            var response = new FrostbitePacket();

            protocol.PlayerOnKillDispatchHandler(request, response);

            Assert.IsTrue(called);
        }
        public void TestHeadshotFalseYieldsCorrectFlags() {
            var protocol = new SecondGame();

            protocol.ProtocolEvent += (protocol1, args) => Assert.AreEqual(FrostbiteGame.Bodyshot, args.Now.Kills.First().Scope.HumanHitLocations.First());

            var request = new FrostbitePacket() {
                Packet = new Packet() {
                    Words = new List<String>() {
                        "player.onKill",
                        "Phogue",
                        "Zaeed",
                        "Fairyfloss",
                        "false"
                    }
                }
            };

            var response = new FrostbitePacket();

            protocol.PlayerOnKillDispatchHandler(request, response);
        }
        public void TestAKnownVictimWillHaveTheirDeathsIncremented() {
            var called = false;
            var protocol = new SecondGame();

            protocol.State.Players.TryAdd("EA_1", new PlayerModel() {
                Name = "Phogue",
                Uid = "EA_1",
                Score = 100,
                Kills = 5,
                Deaths = 5
            });

            protocol.State.Players.TryAdd("EA_2", new PlayerModel() {
                Name = "Zaeed",
                Uid = "EA_2",
                Score = 100,
                Kills = 5,
                Deaths = 5
            });

            protocol.ProtocolEvent += (protocol1, args) => {
                called = true;

                Assert.AreEqual("EA_2", args.Now.Kills.First().Scope.Players.First().Uid);
                Assert.AreEqual(6, args.Now.Kills.First().Scope.Players.First().Deaths);
            };

            var request = new FrostbitePacket() {
                Packet = new Packet() {
                    Words = new List<String>() {
                        "player.onKill",
                        "Phogue",
                        "Zaeed",
                        "fairyfloss",
                        "true"
                    }
                }
            };

            var response = new FrostbitePacket();

            protocol.PlayerOnKillDispatchHandler(request, response);

            Assert.IsTrue(called);
        }
        public void TestAnUnknownItemResultsInThatItemInTheKillerInventory() {
            var called = false;
            var protocol = new SecondGame();

            protocol.State.Players.TryAdd("EA_1", new PlayerModel() {
                Name = "Phogue",
                Uid = "EA_1",
                Score = 100,
                Kills = 5,
                Deaths = 5
            });

            protocol.State.Players.TryAdd("EA_2", new PlayerModel() {
                Name = "Zaeed",
                Uid = "EA_2",
                Score = 100,
                Kills = 5,
                Deaths = 5
            });

            protocol.ProtocolEvent += (protocol1, args) => {
                called = true;

                Assert.AreEqual("fairyfloss", args.Now.Kills.First().Now.Players.First().Inventory.Now.Items.First().Name);
                Assert.IsEmpty(args.Now.Kills.First().Now.Players.First().Inventory.Now.Items.First().FriendlyName);
            };

            var request = new FrostbitePacket() {
                Packet = new Packet() {
                    Words = new List<String>() {
                        "player.onKill",
                        "Phogue",
                        "Zaeed",
                        "fairyfloss",
                        "true"
                    }
                }
            };

            var response = new FrostbitePacket();

            protocol.PlayerOnKillDispatchHandler(request, response);

            Assert.IsTrue(called);
        }