Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New tests #1818

Merged
merged 5 commits into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "9.0.100",
"version": "9.0.101",
"rollForward": "disable"
}
}
3 changes: 1 addition & 2 deletions src/Core/Models/GraphElementModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@
catch (ReflectionTypeLoadException ex)
{
return ex.Types
.Where(static x => x is not null)
.Select(static x => x!);
.OfType<Type>();

Check warning on line 50 in src/Core/Models/GraphElementModel.cs

View check run for this annotation

Codecov / codecov/patch

src/Core/Models/GraphElementModel.cs#L50

Added line #L50 was not covered by tests
}
})
.Where(static type => type is { IsNestedPrivate: false, IsClass: true, IsAbstract: false } && typeof(TBaseType).IsAssignableFrom(type));
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
StringArg: stringValue,
IntArg: 42
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
StringArg: stringValue,
IntArg: 42,
SettableString: settableValue
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
42
41 changes: 41 additions & 0 deletions test/Tests.Infrastructure/GraphSon/GraphsonSupportTestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,24 @@ public class ClassWithField
public string? Property;
}

public class ClassWithFieldsAndConstructor
{
public ClassWithFieldsAndConstructor(string stringArg, string? nullableStringArg, int intArg, int? nullableIntArg)
{
StringArg = stringArg;
NullableStringArg = nullableStringArg;
IntArg = intArg;
NullableIntArg = nullableIntArg;
}

public string StringArg { get; }
public string? NullableStringArg { get; }
public int IntArg { get; }
public int? NullableIntArg { get; }

public string? SettableString { get; set; }
}

public abstract class GraphsonSupportTestBase<TNativeToken> : VerifyBase
{
protected readonly IGremlinQueryEnvironment _environment;
Expand Down Expand Up @@ -52,6 +70,29 @@ protected virtual Task Verify<T>(string token, Func<IGremlinQueryEnvironment, IG

protected abstract TNativeToken CreateNativeToken(string str);

[Fact]
public Task Constructor_assertion_1() => Verify<ClassWithFieldsAndConstructor>("{ }");

[Fact]
public Task Constructor_assertion_2() => Verify<ClassWithFieldsAndConstructor>("""
{
"stringArg": "stringValue",
"intArg": 42
}
""");

[Fact]
public Task Constructor_assertion_3() => Verify<ClassWithFieldsAndConstructor>("""
{
"stringArg": "stringValue",
"intArg": 42,
"settableString": "settableValue"
}
""");

[Fact]
public Task String_from_int() => Verify<string>("42");

[Fact]
public Task Everything() => Verify<EverythingAllAtOnce>(EverythingAllAtOnceData);

Expand Down
8 changes: 4 additions & 4 deletions test/Tests.Infrastructure/QueryExecutionTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2152,10 +2152,10 @@ public virtual Task Properties_Values_Label() => _g

[Fact]
public virtual Task Properties_Values_typed() => _g
.V()
.Properties()
.Values<string>()
.Verify();
.V()
.Properties()
.Values<string>()
.Verify();

[Fact]
public virtual Task Properties_Values_untyped() => _g
Expand Down
Loading