Skip to content

Commit

Permalink
[ksqlDb.RestApi.Client]: PropertyInfoExtractor renamed to MemberInfoE…
Browse files Browse the repository at this point in the history
…xtractor
  • Loading branch information
tomasfabian committed Apr 8, 2024
1 parent d9c24f7 commit 66f9f16
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 39 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
using System.Linq.Expressions;
using FluentAssertions;
using ksqlDb.RestApi.Client.Metadata;
using ksqlDb.RestApi.Client.Tests.FluentAPI.Builders;
using NUnit.Framework;

namespace ksqlDb.RestApi.Client.Tests.Metadata
{
public class MemberInfoExtractorTests
{
[Test]
public void GetMembers()
{
//Arrange
Expression<Func<Payment, decimal>> propertyExpression = c => c.Amount;

//Act
var memberInfos = propertyExpression.GetMembers().ToList();

//Assert
memberInfos.Count().Should().Be(1);
memberInfos.First().Item1.Should().Be(nameof(Payment.Amount));
}

[Test]
public void GetPropertyMemberInfo()
{
//Arrange
Expression<Func<Payment, decimal>> propertyExpression = c => c.Amount;

//Act
var memberInfo = propertyExpression.GetMemberInfo();

//Assert
memberInfo.Name.Should().Be(nameof(Payment.Amount));
}

internal record PaymentWithFields
{
public string Id = null!;
public decimal Amount;
}

[Test]
public void GetFieldMembers()
{
//Arrange
Expression<Func<PaymentWithFields, decimal>> propertyExpression = c => c.Amount;

//Act
var memberInfos = propertyExpression.GetMembers().ToList();

//Assert
memberInfos.Count().Should().Be(1);
memberInfos.First().Item1.Should().Be(nameof(PaymentWithFields.Amount));
}

[Test]
public void GetFieldMemberInfo()
{
//Arrange
Expression<Func<PaymentWithFields, decimal>> propertyExpression = c => c.Amount;

//Act
var memberInfo = propertyExpression.GetMemberInfo();

//Assert
memberInfo.Name.Should().Be(nameof(PaymentWithFields.Amount));
}
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace ksqlDb.RestApi.Client.Metadata
{
internal static class PropertyInfoExtractor
internal static class MemberInfoExtractor
{
internal static IEnumerable<(string, MemberInfo)> GetMembers<TEntity, TProperty>(this Expression<Func<TEntity, TProperty>> propertyExpression)
{
Expand Down

0 comments on commit 66f9f16

Please sign in to comment.