Esempio n. 1
0
        private static void AssertCanParse(Expression <Func <ExportDefinition, bool> > constraint, string contractName, IEnumerable <KeyValuePair <string, Type> > requiredMetadata)
        {
            Assert.IsNotNull(constraint);

            string contractNameResult = null;
            IEnumerable <KeyValuePair <string, Type> > requiredMetadataResult = null;
            bool success = ContraintParser.TryParseConstraint(constraint, out contractNameResult, out requiredMetadataResult);

            Assert.IsTrue(success);
            Assert.AreEqual(contractName, contractNameResult);
            EnumerableAssert.AreEqual(requiredMetadata, requiredMetadataResult);
        }
Esempio n. 2
0
        private static void AssertCanNotParse(Expression <Func <ExportDefinition, bool> > constraint)
        {
            Assert.IsNotNull(constraint);

            string contractNameResult;
            IEnumerable <KeyValuePair <string, Type> > requiredMetadataResult;

            var success = ContraintParser.TryParseConstraint(constraint, out contractNameResult, out requiredMetadataResult);

            Assert.IsFalse(success);
            Assert.IsNull(contractNameResult);
            Assert.IsNull(requiredMetadataResult);
        }