public void WriteToFile_OmniscienceFile_FileWritten()
        {
            //ARRANGE
            OmniscienceFileController controller = new OmniscienceFileController();

            if (controller.FileExists())
            {
                controller.DeleteFile();
            }

            var referenceData = MemoryContentInitializer.CreateItemsAndLinkThem(new ItemLinkFactory());
            Dictionary <Guid, MemoryItem> dataDictionary = new Dictionary <Guid, MemoryItem>();

            foreach (var item in referenceData)
            {
                dataDictionary.Add(Guid.NewGuid(), item);
            }

            Omniscience allKnowledge = new Omniscience(dataDictionary);

            for (int i = 0; i < 50; i++)
            {
                Person newPerson = new Person("NPC" + i, Gender.Agender, Sex.Undefined, Orientation.Asexual, Guid.Empty);
                var    newNpc    = new global::RNPC.Core.Character(newPerson, Archetype.None);

                for (int j = 0; j < referenceData.Count; j++)
                {
                    if (RandomValueGenerator.GeneratePercentileIntegerValue() < 34)
                    {
                        newNpc.AddContentToLongTermMemory(dataDictionary.ElementAt(j).Value);
                    }
                }

                allKnowledge.AddFollower(newNpc);
            }
            //ACT
            controller.WriteToFile(allKnowledge);
            //ASSERT
            controller.FileExists();
        }
예제 #2
0
 /// <summary>
 /// Only followers get to hear the divine word!
 /// They're also the only ones who get to sleep...
 /// </summary>
 /// <param name="newCharacter">Character to add to the list of characters to be notified of events,
 /// including passage of time, natural events, nearby events, and also the directive to go to sleep.</param>
 public void AddFollower(Character newCharacter)
 {
     MyOmniscience.AddFollower(newCharacter);
 }