Merge branch '3.6-dev' into 3.7-dev
diff --git a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphTraversal.cs b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphTraversal.cs
index 2c38967..ea63567 100644
--- a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphTraversal.cs
+++ b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphTraversal.cs
@@ -22,6 +22,7 @@
#endregion
using System;
+using System.Collections;
using System.Collections.Generic;
using System.Linq;
using Gremlin.Net.Driver;
@@ -1761,6 +1762,15 @@
}
/// <summary>
+ /// Adds the property step to this <see cref="GraphTraversal{SType, EType}" />.
+ /// </summary>
+ public GraphTraversal<S, E> Property(IDictionary value)
+ {
+ Bytecode.AddStep("property", value);
+ return Wrap<S, E>(this);
+ }
+
+ /// <summary>
/// Adds the propertyMap step to this <see cref="GraphTraversal{SType, EType}" />.
/// </summary>
public GraphTraversal<TStart, IDictionary<string, TNewEnd>> PropertyMap<TNewEnd> (params string?[] propertyKeys)
diff --git a/gremlin-dotnet/test/Gremlin.Net.UnitTest/Process/Traversal/Translator/GroovyTranslatorTests.cs b/gremlin-dotnet/test/Gremlin.Net.UnitTest/Process/Traversal/Translator/GroovyTranslatorTests.cs
index 057e4f5..f3f0dfc 100644
--- a/gremlin-dotnet/test/Gremlin.Net.UnitTest/Process/Traversal/Translator/GroovyTranslatorTests.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.UnitTest/Process/Traversal/Translator/GroovyTranslatorTests.cs
@@ -36,24 +36,24 @@
public class GroovyTranslatorTests
{
private readonly GraphTraversalSource _g = AnonymousTraversalSource.Traversal();
-
+
[Fact]
public void ShouldTranslateStepsWithSingleArguments()
{
var translator = GroovyTranslator.Of("g");
var translated = translator.Translate(_g.V().Values<string>("name").Bytecode);
-
+
Assert.Equal("g.V().values('name')", translated);
}
-
+
[Fact]
public void ShouldTranslateStepsWithMultipleArguments()
{
var translator = GroovyTranslator.Of("g");
var translated = translator.Translate(_g.V().Values<string>("name", "age").Bytecode);
-
+
Assert.Equal("g.V().values('name', 'age')", translated);
}
@@ -62,7 +62,7 @@
{
AssertTranslation("null", null);
}
-
+
[Theory]
[InlineData("3, 5", 3, 5)]
[InlineData("3.2, 5.1", 3.2, 5.1)]
@@ -79,7 +79,7 @@
{
AssertTranslation("new Date(122, 11, 30, 12, 0, 1)", DateTimeOffset.Parse("2022-12-30T12:00:01Z"));
}
-
+
[Fact]
public void ShouldTranslateDateTimeArgument()
{
@@ -115,25 +115,25 @@
{
AssertTranslation("Column.keys", Column.Keys);
}
-
+
[Fact]
public void ShouldTranslateDirection()
{
AssertTranslation("Direction.BOTH", Direction.Both);
}
-
+
[Fact]
public void ShouldTranslateOrder()
{
AssertTranslation("Order.desc", Order.Desc);
}
-
+
[Fact]
public void ShouldTranslatePop()
{
AssertTranslation("Pop.last", Pop.Last);
}
-
+
[Fact]
public void ShouldTranslateScope()
{
@@ -151,14 +151,14 @@
{
AssertTranslation("P.between([20, 30])", P.Between(20, 30));
}
-
+
[Fact]
public void ShouldTranslateValueMapOptions()
{
AssertTraversalTranslation("g.V().valueMap().with(WithOptions.tokens, WithOptions.all).V()",
_g.V().ValueMap<object, object>().With(WithOptions.Tokens, WithOptions.All).V());
}
-
+
[Fact]
public void ShouldTranslateIndexerOptions()
{
@@ -172,7 +172,7 @@
AssertTraversalTranslation("g.withStrategies(new OptionsStrategy('~tinkerpop.valueMap.tokens': true)).V()",
_g.With(WithOptions.Tokens).V());
}
-
+
[Fact]
public void TranslationTest()
{
@@ -420,6 +420,10 @@
{ _g.V().Has("runways", P.Inside(3, 5)), "g.V().has('runways', P.inside([3, 5]))" },
{ _g.V("44").OutE().ElementMap<object>(), "g.V('44').outE().elementMap()" },
{ _g.V("44").ValueMap<object, object>().By(__.Unfold<object>()), "g.V('44').valueMap().by(__.unfold())" },
+ {
+ _g.V().Property(new Dictionary<string, object> { { "name", "test" }, { "age", 30 } }),
+ "g.V().property(['name': 'test', 'age': 30])"
+ },
{ _g.V().E("1"), "g.V().E('1')" },
// TODO: Support WithOptions
@@ -455,7 +459,8 @@
"g.withStrategies(new ReadOnlyStrategy(), new SubgraphStrategy(vertices: __.has('region', 'US-TX'), edges: __.hasLabel('route'))).V().count()"
},
{
- _g.WithStrategies(new ReadOnlyStrategy(), new SubgraphStrategy(vertices: __.Has("region", "US-TX"), checkAdjacentVertices: true)).V()
+ _g.WithStrategies(new ReadOnlyStrategy(),
+ new SubgraphStrategy(vertices: __.Has("region", "US-TX"), checkAdjacentVertices: true)).V()
.Count(),
"g.withStrategies(new ReadOnlyStrategy(), new SubgraphStrategy(vertices: __.has('region', 'US-TX'), checkAdjacentVertices: true)).V().count()"
},
@@ -490,13 +495,13 @@
{
AssertTraversalTranslation($"g.inject({expectedTranslation})", _g.Inject(objs));
}
-
+
private static void AssertTraversalTranslation(string expectedTranslation, ITraversal traversal)
{
var translator = GroovyTranslator.Of("g");
-
+
var translated = translator.Translate(traversal);
-
+
Assert.Equal(expectedTranslation, translated);
}
}
\ No newline at end of file