public void Should_create_PropertyAccessor_for_property() { // Arrange var property = new ClassWithPropertiesOnly() .Property(o => o.StringPropertyWithGetSet); // Act IPropertyAccessor accessor = sut.Create(property); // Assert accessor.Should().NotBeNull(); }
public void Returns_name_of_the_property() { // Arrange var property = new ClassWithPropertiesOnly() .Property(o => o.StringPropertyWithGetSet); IPropertyAccessor sut = sutFactory.Create(property); // Act var actual = sut.Name; // Assert actual.Should().Be(property.Name); }
/// <inheritdoc cref="IPropertyAccessorFactory.Create"/> public IPropertyAccessor Create(PropertyInfo property) { var key = objectCache.GetKey(property); var accessor = objectCache.GetOrAdd(key, () => decorated.Create(property)); return(accessor as IPropertyAccessor); }
private IPropertyAccessor CreatePropertyAccessor(ILocation declaration, ILocation bodyStart, ILocation bodyEnd, BlockSyntax body) { var underlyingSyntaxNode = underlyingObjectFactory.Create(body); return(propertyAccessorFactory.Create(declaration, bodyStart, bodyEnd, underlyingSyntaxNode)); }
/// <inheritdoc cref="IPropertyProvider.GetProperties"/> public IEnumerable <IPropertyAccessor> GetProperties(object source) { return(typePropertyProvider .GetProperties(source) .Select(property => propertyAccessorFactory.Create(property))); }