Beispiel #1
0
        public void CanRT_Being_full(ColorEn fgEn, ColorEn bgEn, char glyph, uint id, string name, int awareness, int health, string type)
        {
            //DBG();
            var fg    = ColorOf(fgEn);
            var bg    = ColorOf(bgEn);
            var being = _beingCreator.CreateBeing(fg, bg, glyph, id: id);

            being.Name      = name;
            being.Awareness = awareness;
            being.Health    = health;
            being.BeingType = type;

            var yaml = _serializer.Serialize(being);

            Assert.That(yaml, Is.Not.Null);
            var newBeing = _deserializer.Deserialize <IBeing>(yaml);

            Assert.That(newBeing, Is.TypeOf <Model.Being>());

            Assert.That(newBeing.Foreground, Is.EqualTo(fg));
            Assert.That(newBeing.Background, Is.EqualTo(bg));
            Assert.That(newBeing.Glyph, Is.EqualTo(glyph));
            Assert.That(newBeing.ID, Is.EqualTo(id));
            Assert.That(newBeing.Name, Is.EqualTo(name));
            Assert.That(newBeing.Awareness, Is.EqualTo(awareness));
            Assert.That(newBeing.Health, Is.EqualTo(health));
            Assert.That(newBeing.BeingType, Is.EqualTo(type));
        }
Beispiel #2
0
        public Color ColorOf(ColorEn colorEn)
        {
            var index = (int)colorEn;

            return(DefinedColors[index]);
        }