Skip to content

Commit 644b29a

Browse files
committed
[ksqlDB.RestApi.Client]: fixed creation of multiple FieldMetadata for primitive field in Base class unit test #102
1 parent f1ad422 commit 644b29a

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

Tests/ksqlDB.RestApi.Client.Tests/FluentAPI/Builders/EntityTypeBuilderTests.cs

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public void RowTime_Property_ShouldBeIgnoredInDDL()
5555
builder.Metadata.FieldsMetadata.First(c => c.MemberInfo.Name == nameof(Tweet.RowTime)).IgnoreInDDL.Should().BeTrue();
5656
}
5757

58-
public class Foo
58+
public class Row
5959
{
6060
public long RowTime;
6161
}
@@ -66,10 +66,10 @@ public void RowTime_Field_ShouldBeIgnoredInDDL()
6666
//Arrange
6767

6868
//Act
69-
EntityTypeBuilder<Foo> fooBuilder = new();
69+
EntityTypeBuilder<Row> rowBuilder = new();
7070

7171
//Assert
72-
fooBuilder.Metadata.FieldsMetadata.First(c => c.MemberInfo.Name == nameof(Foo.RowTime)).IgnoreInDDL.Should().BeTrue();
72+
rowBuilder.Metadata.FieldsMetadata.First(c => c.MemberInfo.Name == nameof(Row.RowTime)).IgnoreInDDL.Should().BeTrue();
7373
}
7474

7575
[Test]
@@ -87,5 +87,24 @@ public void DecimalType_ShouldHaveDecimalFieldMetadata()
8787
.First(c => c.MemberInfo.Name == nameof(Tweet.AccountBalance))
8888
.Should().NotBeNull();
8989
}
90+
91+
public class MyValue : Row
92+
{
93+
public int Id { get; set; }
94+
}
95+
96+
[Test]
97+
public void RowTimeField_AsPseudoColumn_ShouldBeRegisteredOnce()
98+
{
99+
//Arrange
100+
EntityTypeBuilder<MyValue> customBuilder = new();
101+
102+
//Act
103+
customBuilder.Property(c => c.RowTime)
104+
.AsPseudoColumn();
105+
106+
//Assert
107+
customBuilder.Metadata.FieldsMetadata.Count(c => c.MemberInfo.Name == nameof(Row.RowTime)).Should().Be(1);
108+
}
90109
}
91110
}

0 commit comments

Comments
 (0)