public void ResolveSpecRefGenericThrow()
        {
            AndSpecification and = new AndSpecification(
                new EqualSpecification("qwe", SpecificationValue.Single(1)),
                new ReferenceSpecification("qwe"));

            Dictionary <string, object> values = new Dictionary <string, object> {
                { "qwe", 1 }
            };

            var exc = Assert.Throws <InvalidOperationException>(() => and.ResolveSpecificationRefs(values));

            Assert.Contains("Unable to resolve specification reference for ref(qwe). Unable to resolve specification reference for qwe. Value 1 of type System.Int32 is not a specification", exc.Message);
        }
        public void ResolveSpecRefGenericError()
        {
            ReferenceSpecification referenceSpecification = new ReferenceSpecification("qwe");
            AndSpecification       and = new AndSpecification(
                new EqualSpecification("qwe", SpecificationValue.Single(1)),
                referenceSpecification);

            Dictionary <string, object> values = new Dictionary <string, object> {
                { "qwe", 1 }
            };

            AndSpecification result = and.ResolveSpecificationRefs(
                values,
                new ReferenceResolutionSettings {
                ThrowReferenceErrors = false
            });

            Assert.Same(referenceSpecification, result.Specifications.Last());
        }
        public void ResolveSpecRefGeneric()
        {
            AndSpecification and = new AndSpecification(
                new EqualSpecification("qwe", SpecificationValue.Single(1)),
                new ReferenceSpecification("qwe"));

            LessOrEqualSpecification    specification = new LessOrEqualSpecification("qwe", SpecificationValue.Single(1));
            Dictionary <string, object> values        =
                new Dictionary <string, object>
            {
                {
                    "qwe",
                    specification
                }
            };

            AndSpecification resolved = and.ResolveSpecificationRefs(values);
            var kv = Assert.IsType <LessOrEqualSpecification>(resolved.Specifications.Last());

            Assert.Same(specification, kv);
        }