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(); }
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(); }
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); }