public void personWearsNullItemReturnsNull() { Person person = new Person("John"); var item = person.WearItem(null); Assert.That(item, Is.Null); }
public void personCarriesThingReturnsCarriedThing() { Person person = new Person("John"); Thing thing = new Thing("Hat"); var item = person.CarryItem(thing); Assert.That(item, Is.EqualTo(thing)); }
public void personWearsItemItIsWorn() { Person person = new Person("John"); Thing thing = new Thing("Hat"); person.WearItem(thing); var clothes = person.GetClothing(); Assert.That(clothes.First().SameIdentityAs(thing)); }
public void thingIsWorn() { Person person = new Person("Jason"); Thing thing = new Thing("hat"); person.WearItem(thing); Assert.That(thing.IsWorn, Is.True); }
public void personCarriesNullItemReturnsNull() { Person person = new Person("John"); Assert.That(person.CarryItem(null), Is.Null); }
public void createPersonCreatesTwoObjectsSameName() { Person person = new Person("Jason"); Assert.That(person.SameIdentityAs(new Person("Jason")), Is.True); }
public void testPersonIsNotThingType() { Person person = new Person("Jason"); Assert.That(person.IsThing, Is.False); }
public void testPersonIsNotContainerType() { Person person = new Person("Jason"); Assert.That(person.IsContainer, Is.False); }
public void testPersonIsNotSupporterType() { Person person = new Person("Jason"); Assert.That(person.IsSupporter, Is.False); }
public void testPersonIsPersonType() { Person person = new Person("Jason"); Assert.That(person.IsPerson, Is.True); }
public List<IEntity> Parse(string objectString) { ObjectText = objectString; Objects = new List<IEntity>(); if (objectString == string.Empty) { return Objects; } string[] objectArray = objectString.Split(new string[] { Settings.ObjectDelimiter}, StringSplitOptions.RemoveEmptyEntries); foreach (var s in objectArray) { var attributes = getObjectAttributes(s); var sName = attributes != string.Empty ? s.Replace(attributes, string.Empty) : s; IEntity entity = null; if (attributes != string.Empty) { attributes = attributes.Replace("[", string.Empty).Replace("]", string.Empty); if (attributes.IndexOfAny("mM".ToCharArray()) != -1) { entity = new Person(sName); ((Person)entity).Gender = Gender.Male; } if (attributes.IndexOfAny("fF".ToCharArray()) != -1) { if (entity != null && entity.IsPerson()) throw new PersonCannotBeTwoGenders(); entity = new Person(sName); ((Person)entity).Gender = Gender.Female; } if (attributes.IndexOfAny("pP".ToCharArray()) != -1) { if (entity != null && entity.IsPerson()) throw new PersonCannotBeTwoGenders(); entity = new Person(sName); ((Person)entity).Gender = Gender.Neutral; } if (attributes.IndexOfAny("cC".ToCharArray()) != -1) { if (entity != null && entity.IsPerson()) throw new PersonCannotBeContainer(); entity = new Container(sName); } if (attributes.IndexOfAny("uU".ToCharArray()) != -1) { if (entity != null && entity.IsPerson()) throw new PersonCannotBeSupporter(); entity = new Supporter(sName); } if (attributes.IndexOfAny("sS".ToCharArray()) != -1) { if (entity != null && entity.IsPerson()) { throw new PersonCannotBeScenery(); } entity = new Thing(sName) {Scenery = true}; } } else { entity = new Thing(sName); } Objects.Add(entity); } return Objects; }