public void ObjectWithUAttributeIsSupporter() { var parser = new Parser(); parser.Parse("Jason [u]"); Assert.That(parser.Objects.First().IsSupporter, Is.True); }
public void ObjectWithCAttributeIsContainer() { var parser = new Parser(); parser.Parse("Jason [c]"); Assert.That(parser.Objects.First().IsContainer, Is.True); }
public void ObjectWithBothMaleAndNeutralAttributesThrows() { var parser = new Parser(); var testDel = new TestDelegate(() => parser.Parse("Jason [mp]")); Assert.That(testDel, Throws.TypeOf<PersonCannotBeTwoGenders>()); }
public void ObjectWithFAttributeIsFemalePerson() { var parser = new Parser(); parser.Parse("Jason [f]"); Assert.That(parser.Objects.First().IsPerson() , Is.True); Assert.That(((Person)parser.Objects.First()).IsFemale() , Is.True); }
public void ObjectWithPAttributeIsNeutralPerson() { var parser = new Parser(); parser.Parse("Jason [p]"); Assert.That(parser.Objects.First().IsPerson() , Is.True); Assert.That(((Person)parser.Objects.First()).IsNeutral() , Is.True); }
public void ObjectWithPersonAndSupporterAttributesThrows() { var parser = new Parser(); var testDel = new TestDelegate(() => parser.Parse("Jason [up]")); Assert.That(testDel, Throws.TypeOf<PersonCannotBeSupporter>()); }
static void Main(string[] args) { var parser = new Parser(); var tree = parser.Parse("Lamp [ABC]"); }
public void ObjectWithSAttributeIsASceneryThing() { var parser = new Parser(); parser.Parse("Jason [s]"); Assert.That(parser.Objects.First().IsThing, Is.True); Assert.That(((Thing)parser.Objects.First()).IsScenery(), Is.True); }
public void ParseStringWithTwoLinesReturnsTwoObjects() { var parser = new Parser(); parser.Parse("Lamp" + Environment.NewLine + "Table"); Assert.That(parser.Objects.Count, Is.EqualTo(2)); }
public void ParseStringWithOneItemAndAttributesReturnsOneWithNameSet() { var parser = new Parser(); parser.Parse("Lamp [ABC]" + Environment.NewLine); Assert.That(parser.Objects.First().Name, Is.EqualTo("Lamp")); }
public void ParseStringWithOneLineEndsInCarriageReturnRetunsOneObject() { var parser = new Parser(); parser.Parse("Lamp" + Environment.NewLine); Assert.That(parser.Objects.Count, Is.EqualTo(1)); }
public void ParseStringWithOneLineReturnsOneObject() { var parser = new Parser(); parser.Parse("Lamp"); Assert.That(parser.Objects.Count, Is.EqualTo(1)); }
public void ParseEmptyStringReturnsEmptyObjectList() { var parser = new Parser(); parser.Parse(string.Empty); Assert.That(parser.Objects.Count, Is.EqualTo(0)); }
public void NewParserHasEmptyObjectList() { var parser = new Parser(); Assert.That(parser.Objects.Count == 0, Is.True); }
public void SetObjectTextReturnsObjectText() { var parser = new Parser(); parser.Parse("this is a test"); Assert.That(parser.ObjectText == "this is a test", Is.True); }