Skip to content

Commit ae18a9b

Browse files
committed
aliencube#235 Add inheritance relationship test for UpstageConnector
- Add test to verify UpstageConnector inherits from LanguageModelConnector - Add using statement for OpenChat.PlaygroundApp.Abstractions namespace - Implement Theory test with InlineData for both inheritance directions: - LanguageModelConnector.IsAssignableFrom(UpstageConnector) should be true - UpstageConnector.IsAssignableFrom(LanguageModelConnector) should be false - Ensures proper polymorphism and type safety in connector architecture - Validates adherence to Liskov Substitution Principle
1 parent 52f4d46 commit ae18a9b

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

test/OpenChat.PlaygroundApp.Tests/Connectors/UpstageConnectorTests.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using OpenChat.PlaygroundApp.Abstractions;
12
using OpenChat.PlaygroundApp.Configurations;
23
using OpenChat.PlaygroundApp.Connectors;
34

@@ -25,6 +26,19 @@ private static AppSettings BuildAppSettings(string? baseUrl = BaseUrl, string? a
2526
};
2627
}
2728

29+
[Trait("Category", "UnitTest")]
30+
[Theory]
31+
[InlineData(typeof(LanguageModelConnector), typeof(UpstageConnector), true)]
32+
[InlineData(typeof(UpstageConnector), typeof(LanguageModelConnector), false)]
33+
public void Given_BaseType_Then_It_Should_Be_AssignableFrom_DerivedType(Type baseType, Type derivedType, bool expected)
34+
{
35+
// Act
36+
var result = baseType.IsAssignableFrom(derivedType);
37+
38+
// Assert
39+
result.ShouldBe(expected);
40+
}
41+
2842
[Trait("Category", "UnitTest")]
2943
[Fact]
3044
public void Given_Settings_Is_Null_When_EnsureLanguageModelSettingsValid_Invoked_Then_It_Should_Throw()

0 commit comments

Comments
 (0)