public NpcProfile GenerateOne()
        {
            var npc = NPC.TransformTo(Npc.Generate(MilitaryUnits.GetServiceBranch()));

            _mongo.InsertOne(npc, new InsertOneOptions {
                BypassDocumentValidation = false
            });
            return(npc);
        }
        public void Base_Address_Is_A_Valid_Address()
        {
            var o = MilitaryUnits.GetBaseAddress(MilitaryBranch.USMC, "Camp Pendleton");

            Assert.IsNotEmpty(o.Address1);
            Assert.IsNotEmpty(o.City);
            Assert.IsNotEmpty(o.State);
            Assert.IsNotEmpty(o.PostalCode);
        }
        public void Get_By_Branch_Returns_A_Unit()
        {
            var o = MilitaryUnits.GetAllByServiceBranch(MilitaryBranch.USMC);

            foreach (var unit in o)
            {
                Assert.IsNotEmpty(unit.Name);
            }
        }
Example #4
0
        public IEnumerable <NPC> Create(InsiderThreatGenerationConfiguration config, CancellationToken ct)
        {
            var createdNPCs = new List <NPC>();

            foreach (var enclave in config.Enclaves)
            {
                foreach (var team in enclave.Teams)
                {
                    for (var i = 0; i < team.Npcs.Number; i++)
                    {
                        var branch = team.Npcs.Configuration.Branch ?? MilitaryUnits.GetServiceBranch();
                        var npc    = NPC.TransformTo(Npc.Generate(branch));
                        npc.Team     = team.Name;
                        npc.Campaign = config.Campaign;
                        npc.Enclave  = enclave.Name;
                        createdNPCs.Add(npc);
                    }
                }
            }

            foreach (var npc in createdNPCs)
            {
                foreach (var job in npc.Employment.EmploymentRecords)
                {
                    //get same company departments and highest ranked in that department

                    var managerList = createdNPCs.Where(x => x.Id != npc.Id &&
                                                        x.Employment.EmploymentRecords.Any(
                                                            x => x.Company == job.Company &&
                                                            x.Department == job.Department &&
                                                            x.Level >= job.Level));

                    if (managerList.Any())
                    {
                        var manager = managerList.RandomElement();
                        job.Manager = manager.Id;
                    }
                }
            }

            _mongo.InsertMany(createdNPCs, new InsertManyOptions {
                IsOrdered = false
            }, ct);
            return(createdNPCs);
        }
Example #5
0
 public NpcTests()
 {
     this._npc = Npc.Generate(MilitaryUnits.GetServiceBranch());
 }
 public void Service_Branch_Is_Not_Null()
 {
     Assert.IsNotNull(MilitaryUnits.GetServiceBranch());
 }
        public void Get_All_Returns_An_Object()
        {
            var o = MilitaryUnits.GetAll();

            Assert.IsNotNull(o.Sub);
        }