public void TestSetDiplomaticEntityState()
        {
            //Empty relations
            UserRelations relations = instance.userRelations;

            User u1 = Mock.MockUser(id: (int)instance.identities.allianceId.getNext());

            instance.users.TryAdd(u1.id, u1);
            User u2 = Mock.MockUser(id: (int)instance.identities.allianceId.getNext());

            instance.users.TryAdd(u2.id, u2);

            relations.setDiplomaticEntityState(u1, u2, Relation.Neutral);
            Assert.AreEqual(relations.getUserRelationsForUser(u1)[0].Value, Relation.Neutral);
            Assert.AreEqual(relations.getRelation(u1, u2), Relation.Neutral);

            relations.setDiplomaticEntityState(u2, u1, Relation.Neutral);
            Assert.AreEqual(relations.getUserRelationsForUser(u2)[0].Value, Relation.Neutral);

            //set an existing erlation to a new value -> proposal
            relations.setDiplomaticEntityState(u1, u2, Relation.Trade);
            //the overall relation keeps on 1 (proposal)
            Assert.AreEqual(relations.getUserRelationsForUser(u1)[0].Value, Relation.Neutral);
            Assert.AreEqual(relations.getUserRelationsForUser(u2)[0].Value, Relation.Neutral);
            Assert.AreEqual(relations.getRelation(u1, u2), Relation.Neutral);

            //set an existing erlation to a new value 1 -> 3 -> accept + proposal
            relations.setDiplomaticEntityState(u2, u1, Relation.Pact);
            //the overall relation is now 2
            Assert.AreEqual(relations.getUserRelationsForUser(u1)[0].Value, Relation.Trade);
            Assert.AreEqual(relations.getUserRelationsForUser(u2)[0].Value, Relation.Trade);
            Assert.AreEqual(relations.getRelation(u1, u2), Relation.Trade);
        }
        public void TestSetAllianceDiplomaticEntityState()
        {
            //Empty relations
            UserRelations relations = instance.userRelations;

            User User1 = Mock.MockUser(id: (int)instance.identities.allianceId.getNext());

            instance.users.TryAdd(User1.id, User1);
            User User2 = Mock.MockUser(id: (int)instance.identities.allianceId.getNext());

            instance.users.TryAdd(User2.id, User2);

            relations.setDiplomaticEntityState(User1, User2, Relation.Neutral);
            relations.setDiplomaticEntityState(User2, User1, Relation.Neutral);

            //create Alliance for both users:
            Alliance.createAlliance(User1, "a1");
            var Alliance1 = instance.alliances[User1.allianceId];

            Alliance.createAlliance(User2, "a2");
            var Alliance2 = instance.alliances[User2.allianceId];

            // test status
            Assert.AreEqual(Relation.Neutral, relations.getUserRelationsForUser(User1)[0].Value);
            Assert.AreEqual(Relation.Neutral, relations.getUserRelationsForUser(User2)[0].Value);

            //change relationships, check status
            relations.setDiplomaticEntityState(Alliance1, Alliance2, Relation.Trade);
            relations.setDiplomaticEntityState(Alliance2, Alliance1, Relation.Trade);

            Assert.AreEqual(Relation.Neutral, relations.getUserRelationsForUser(User1)[0].Value);
            Assert.AreEqual(Relation.Neutral, relations.getUserRelationsForUser(User2)[0].Value);

            List <FullDiplomaticRelationProposals> diplomatics = relations.getAllDiplomatics(User1, null);
            FullDiplomaticRelationProposals        ToTarget    = diplomatics.Where(e => e.target == User2).First();

            Assert.AreEqual((int)Relation.Trade, ToTarget.relation);
        }