コード例 #1
0
        public void TestInvalidAtomicValue()
        {
            var          ap            = new IsAAttributeParser();
            const string attIdentifier = "isa";

            var e = Assert.Catch(() => {
                ap.ParsedAttribute(attIdentifier,
                                   null,
                                   new NParsedAttributeAtomic(new NameExpression("")));
            });

            Assert.IsInstanceOf(typeof(InvalidAttributeValueException), e);
            StringAssert.AreEqualIgnoringCase(
                string.Format(InvalidAttributeValueException.IDENTIFIER, attIdentifier),
                e.Message
                );
        }
コード例 #2
0
        public void TestNotAtomicValue(NParsedAttributeValue v)
        {
            var          ap            = new IsAAttributeParser();
            const string attIdentifier = "isa";

            var e = Assert.Catch(() => {
                ap.ParsedAttribute(attIdentifier,
                                   null,
                                   v);
            });

            Assert.IsInstanceOf(typeof(InvalidAttributeValueException), e);
            StringAssert.AreEqualIgnoringCase(
                string.Format(InvalidAttributeValueException.ATOMIC_ONLY, attIdentifier),
                e.Message
                );
        }
コード例 #3
0
        public void TestNullParameter()
        {
            var          ap            = new IsAAttributeParser();
            const string attIdentifier = "isa";

            var e = Assert.Catch(() => {
                ap.ParsedAttribute(attIdentifier,
                                   new NParsedAttributeAtomic(new ParsedFloat()),
                                   new NParsedAttributeAtomic(new IdentifierExpression("software")));
            });

            Assert.IsInstanceOf(typeof(InvalidParameterAttributeException), e);
            StringAssert.AreEqualIgnoringCase(
                string.Format(InvalidParameterAttributeException.NO_PARAM, attIdentifier),
                e.Message
                );
        }