public void TestNullParameter() { var ap = new FormalSpecAttributeParser(); const string attIdentifier = "formalspec"; var e = Assert.Catch(() => { ap.ParsedAttribute(attIdentifier, new NParsedAttributeColon(), new NParsedAttributeAtomic(new ParsedBool(true))); }); Assert.IsInstanceOf(typeof(InvalidParameterAttributeException), e); StringAssert.AreEqualIgnoringCase( string.Format(InvalidParameterAttributeException.NO_PARAM, attIdentifier), e.Message ); }
public void TestNotColonValue(NParsedAttributeValue v) { var ap = new FormalSpecAttributeParser(); const string attIdentifier = "formalspec"; var e = Assert.Catch(() => { ap.ParsedAttribute(attIdentifier, null, v); }); Assert.IsInstanceOf(typeof(InvalidAttributeValueException), e); StringAssert.AreEqualIgnoringCase( string.Format(InvalidAttributeValueException.ATOMIC_ONLY, attIdentifier), e.Message ); }
public void TestValidValue() { var ap = new FormalSpecAttributeParser(); const string attIdentifier = "formalspec"; var e = ap.ParsedAttribute(attIdentifier, null, new NParsedAttributeAtomic(new ParsedBool(true))); Assert.IsInstanceOf(typeof(ParsedFormalSpecAttribute), e); var pa = (ParsedFormalSpecAttribute)e; Assert.IsInstanceOf(typeof(ParsedBool), pa.Value); var b = (ParsedBool)pa.Value; Assert.AreEqual(true, b.Value); }