コード例 #1
0
        public void IsSupportedReturnsFalseWithNullBuildChainTest()
        {
            var context = new SlimModel();
            var buildChain = new LinkedList<object>();

            buildChain.AddFirst(context);

            var target = new GeneratorWrapper(PropertyExpression.FirstName, typeof(string));

            var actual = target.IsSupported(typeof(string), "FirstName", null);

            actual.Should().BeFalse();
        }
コード例 #2
0
        public void IsSupportedReturnsTrueWhenTargetExpressionMatchesReferenceNameTest()
        {
            var context = new SlimModel();
            var buildChain = new LinkedList<object>();

            buildChain.AddFirst(context);

            var target = new GeneratorWrapper(PropertyExpression.FirstName, typeof(string));

            var actual = target.IsSupported(typeof(string), "FirstName", buildChain);

            actual.Should().BeTrue();
        }
コード例 #3
0
        public void IsSupportedReturnsFalseForUnsupportedScenariosTest(
            Type type,
            string referenceName,
            Type contextType,
            bool expected)
        {
            var buildChain = new LinkedList<object>();

            if (contextType != null)
            {
                var context = Activator.CreateInstance(contextType);

                buildChain.AddFirst(context);
            }

            var target = new GeneratorWrapper(PropertyExpression.FirstName, PropertyExpression.Gender);

            var actual = target.IsSupported(type, referenceName, buildChain);

            actual.Should().Be(expected);
        }