public void GetSourceValueThrowsExceptionWithNullContextTest() { var target = new GeneratorWrapper(PropertyExpression.FirstName, PropertyExpression.LastName); Action action = () => target.ReadSourceValue(null); action.ShouldThrow<ArgumentNullException>(); }
public void GetSourceValueThrowsExceptionWhenNoSourceExpressionProvidedTest() { var context = new Person(); var target = new GeneratorWrapper(PropertyExpression.FirstName, (Regex)null, (Type)null); Action action = () => target.ReadSourceValue(context); action.ShouldThrow<InvalidOperationException>(); }
public void GetSourceValueReturnsNullWhenPropertyNotFoundTest() { var context = new SlimModel(); var target = new GeneratorWrapper(PropertyExpression.FirstName, PropertyExpression.LastName); var actual = target.ReadSourceValue(context); actual.Should().BeNull(); }
public void GetSourceValueReturnsNullFromSourcePropertyTest() { var context = new Person(); var target = new GeneratorWrapper(PropertyExpression.FirstName, PropertyExpression.LastName); var actual = target.ReadSourceValue(context); actual.Should().BeNull(); }
public void GetSourceValueReturnsValueFromSourceStringPropertyTest() { var context = new Person { LastName = Guid.NewGuid().ToString() }; var target = new GeneratorWrapper(PropertyExpression.FirstName, PropertyExpression.LastName); var actual = target.ReadSourceValue(context); actual.Should().Be(context.LastName); }
public void GetSourceValueReturnsValueFromSourcePropertyTest(Gender gender, string expected) { var context = new Person { Gender = gender }; var target = new GeneratorWrapper(PropertyExpression.FirstName, PropertyExpression.Gender); var actual = target.ReadSourceValue(context); actual.Should().Be(expected); }