Exemple #1
0
        public void BreaksDescriptionIntoIndividualComponentsForMoreFlexibleDescriptions()
        {
            // Set up Descriptors
            var descs = new MemoryStore();

            descs.AddListItem(new MemoryStore("pattern", new string[] { "dragon" }));
            descs.AddListItem(new MemoryStore("color", new string[] { "black" }));

            // Set up Templates
            var temps = new MemoryStore();

            temps.AddListItem(new MemoryStore("template", "{{feature}} of a {{descriptor \"color\"}} {{descriptor \"pattern\"}}."));

            // Set up physical Feature
            var mem = new MemoryStore();

            mem.SetValue("name", "tattoo");
            mem.SetValue("descriptors", descs);
            mem.SetValue("templates", temps);
            var phys = new PhysicalFeature(mem);

            var gateway = EntityGateway <PhysicalFeature> .LoadWithSingleItem(phys);

            var subject = new CreatePhysicalFeatures(gateway);

            var character = new CharacterSheet(CharacterStrategy.Default());

            character.Gender = Gender.Female;

            subject.ExecuteStep(character);

            Assert.Equal(character.Appearance.PhysicalAppearance, "Tattoo of a black dragon.");
        }
Exemple #2
0
        public void IfNoTemplateOrLocationJustDoesASimpleFormat()
        {
            var mem = new MemoryStore();

            mem.SetValue("name", "crooked nose");
            var phys    = new PhysicalFeature(mem);
            var gateway = EntityGateway <PhysicalFeature> .LoadWithSingleItem(phys);

            var subject   = new CreatePhysicalFeatures(gateway);
            var character = new CharacterSheet(CharacterStrategy.Default());

            subject.ExecuteStep(character);

            Assert.Equal(character.Appearance.PhysicalAppearance, "He has a crooked nose.");
        }
Exemple #3
0
        public void CombineMultipleDescriptionsTogetherButDoNotRepeat()
        {
            var tattoo = new PhysicalFeature();

            tattoo.AddDescriptor("color", new string[] { "green" });
            tattoo.AddTemplate("Tattoo of a {{descriptor \"color\"}} dragon.");
            var scar = new PhysicalFeature();

            scar.AddDescriptor("location", new string[] { "face" });
            scar.AddTemplate("A scar on {{descriptor \"location\"}}.");

            var gateway = EntityGateway <PhysicalFeature> .LoadFromList(new PhysicalFeature[] { tattoo, scar });

            var subject = new CreatePhysicalFeatures(gateway);

            var character = new CharacterSheet(CharacterStrategy.Default());

            subject.ExecuteStep(character);
            Assert.Contains("Tattoo of a green dragon.", character.Appearance.PhysicalAppearance);
            Assert.Contains("A scar on face.", character.Appearance.PhysicalAppearance);
        }
Exemple #4
0
        public void UsesDescriptorsIfAvailable()
        {
            var descs = new MemoryStore();

            descs.AddListItem(new MemoryStore("descriptor", new string[] { "dragon" }));
            var mem = new MemoryStore();

            mem.SetValue("name", "tattoo");
            mem.SetValue("descriptors", descs);
            var phys = new PhysicalFeature(mem);

            var gateway = EntityGateway <PhysicalFeature> .LoadWithSingleItem(phys);

            var subject = new CreatePhysicalFeatures(gateway);

            var character = new CharacterSheet(CharacterStrategy.Default());

            character.Gender = Gender.Female;

            subject.ExecuteStep(character);

            Assert.Equal(character.Appearance.PhysicalAppearance, "She has a dragon tattoo.");
        }