Skip to content

Commit a6dadd6

Browse files
authored
Increasing code coverage (#56)
* Cover FTSearch * delete IndexIndexDataType * add TestQueryCommandBuilder * more cover to equal & ToString of graph data types * cover more equal/ToString/Hash functions * fix test * fix infinity * start covering command builder * Add TestInsertArgsError * Cover Reducer * Cover Document * Cover limit * Delete ExplainScore * Cover CuckooCommandBuilder * Cover TopK * Cover Search Query * Cover All search Query * Cover search schema * Cover FT._List * mark as Comment CallProcedureReadOnly * בםצצקמא ValueToStringNoQuotes * cover more from AddVectorField * More cover to timeSeries * Comment TsDuplicatePolicy AsPolicy * delete unnecessary code from graph * delete unnecessary code from search * delete unnecessary code from TimeSeries
1 parent 0aa7b92 commit a6dadd6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+590
-448
lines changed

src/NRedisStack/Graph/DataTypes/Edge.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ public class Edge : GraphEntity
2626
/// <value></value>
2727
public long Destination { get; set; }
2828

29-
// TODO: check if this is needed:
3029
/// <summary>
3130
/// Overriden from the base `Equals` implementation. In addition to the expected behavior of checking
3231
/// reference equality, we'll also fall back and check to see if the: Source, Destination, and RelationshipType

src/NRedisStack/Graph/DataTypes/GraphEntity.cs

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ public abstract class GraphEntity
1212

1313
public IDictionary<string, object> PropertyMap = new Dictionary<string, object>();
1414

15-
// TODO: check if this is needed:
1615
/// <summary>
1716
/// Overriden Equals that considers the equality of the entity ID as well as the equality of the
1817
/// properties that each entity has.
@@ -49,7 +48,7 @@ public override int GetHashCode()
4948

5049
hash = hash * 31 + Id.GetHashCode();
5150

52-
foreach(var prop in PropertyMap)
51+
foreach (var prop in PropertyMap)
5352
{
5453
hash = hash * 31 + prop.Key.GetHashCode();
5554
hash = hash * 31 + prop.Value.GetHashCode();
@@ -59,23 +58,6 @@ public override int GetHashCode()
5958
}
6059
}
6160

62-
/// <summary>
63-
/// Overriden ToString that emits a string containing the ID and property map of the entity.
64-
/// </summary>
65-
/// <returns></returns>
66-
public override string ToString()
67-
{
68-
var sb = new StringBuilder();
69-
70-
sb.Append("GraphEntity{id=");
71-
sb.Append(Id);
72-
sb.Append(", propertyMap=");
73-
sb.Append(PropertyMap);
74-
sb.Append('}');
75-
76-
return sb.ToString();
77-
}
78-
7961
public string PropertyMapToString()
8062
{
8163
var sb = new StringBuilder();

src/NRedisStack/Graph/DataTypes/Node.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ public Node()
1616
Labels = new List<string>();
1717
}
1818

19-
// TODO: check if this is needed:
2019
/// <summary>
2120
/// Overriden member that checks to see if the names of the labels of a node are equal
2221
/// (in addition to base `Equals` functionality).

src/NRedisStack/Graph/DataTypes/Path.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ public Path(IList<Node> nodes, IList<Edge> edges)
2020
Edges = new ReadOnlyCollection<Edge>(edges);
2121
}
2222

23-
// TODO: check if this is needed:
2423
/// <summary>
2524
/// Overriden `Equals` method that will consider the equality of the Nodes and Edges between two paths.
2625
/// </summary>
@@ -68,7 +67,6 @@ public override int GetHashCode()
6867
}
6968
}
7069

71-
// TODO: check if this is needed:
7270
/// <summary>
7371
/// Overridden `ToString` method that will emit a string based on the string values of the nodes and edges
7472
/// on the path.

src/NRedisStack/Graph/GraphCacheList.cs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,4 @@ private void GetProcedureInfo()
5252
protected virtual ResultSet CallProcedure() =>
5353
graph.CallProcedure(GraphName, Procedure);
5454
}
55-
56-
internal class ReadOnlyGraphCacheList : GraphCacheList
57-
{
58-
internal ReadOnlyGraphCacheList(string graphName, string procedure, GraphCommands redisGraph) :
59-
base(graphName, procedure, redisGraph)
60-
{
61-
}
62-
63-
protected override ResultSet CallProcedure() =>
64-
graph.CallProcedureReadOnly(GraphName, Procedure);
65-
}
6655
}

src/NRedisStack/Graph/GraphCommandBuilder.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using NRedisStack.Literals;
22
using NRedisStack.RedisStackCommands;
3-
using static NRedisStack.Graph.RedisGraphUtilities;
43

54
namespace NRedisStack
65
{

src/NRedisStack/Graph/GraphCommands.cs

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public async Task<ResultSet> RO_QueryAsync(string graphName, string query, long?
9797
internal static readonly Dictionary<string, List<string>> EmptyKwargsDictionary =
9898
new Dictionary<string, List<string>>();
9999

100-
// TODO: Check if needed
100+
// TODO: Check if this is needed:
101101
/// <inheritdoc/>
102102
public ResultSet CallProcedure(string graphName, string procedure) =>
103103
CallProcedure(graphName, procedure, Enumerable.Empty<string>(), EmptyKwargsDictionary);
@@ -147,32 +147,6 @@ public async Task<ResultSet> DeleteAsync(string graphName)
147147
return processedResult;
148148
}
149149

150-
// TODO: Check if this (CallProcedure) is needed
151-
/// <inheritdoc/>
152-
public ResultSet CallProcedureReadOnly(string graphName, string procedure) =>
153-
CallProcedureReadOnly(graphName, procedure, Enumerable.Empty<string>(), EmptyKwargsDictionary);
154-
155-
/// <inheritdoc/>
156-
public ResultSet CallProcedureReadOnly(string graphName, string procedure, IEnumerable<string> args) =>
157-
CallProcedureReadOnly(graphName, procedure, args, EmptyKwargsDictionary);
158-
159-
/// <inheritdoc/>
160-
public ResultSet CallProcedureReadOnly(string graphName, string procedure, IEnumerable<string> args, Dictionary<string, List<string>> kwargs)
161-
{
162-
args = args.Select(a => QuoteString(a));
163-
164-
var queryBody = new StringBuilder();
165-
166-
queryBody.Append($"CALL {procedure}({string.Join(",", args)})");
167-
168-
if (kwargs.TryGetValue("y", out var kwargsList))
169-
{
170-
queryBody.Append(string.Join(",", kwargsList));
171-
}
172-
173-
return RO_Query(graphName, queryBody.ToString());
174-
}
175-
176150
/// <inheritdoc/>
177151
public IReadOnlyList<string> Explain(string graphName, string query)
178152
{

src/NRedisStack/Graph/Header.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public enum ResultSetColumnTypes
2020
/// <summary>
2121
/// Collection of the schema types present in the header.
2222
/// </summary>
23-
// [Obsolete("SchemaType is no longer supported after RedisGraph 2.1 and will always return COLUMN_SCALAR")] // TODO: it's correct?
23+
[Obsolete("SchemaType is no longer supported after RedisGraph 2.1 and will always return COLUMN_SCALAR")]
2424
public List<ResultSetColumnTypes> SchemaTypes { get; }
2525

2626
/// <summary>
@@ -41,7 +41,6 @@ internal Header(RedisResult result)
4141
}
4242
}
4343

44-
// TODO: check if this is needed:
4544
public override bool Equals(object? obj)
4645
{
4746
if (obj == null) return this == null;

src/NRedisStack/Graph/IGraphCommands.cs

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -133,34 +133,6 @@ public interface IGraphCommands
133133
/// <remarks><seealso href="https://redis.io/commands/graph.delete"/></remarks>
134134
Task<ResultSet> DeleteAsync(string graphName);
135135

136-
// TODO: Check if this (CallProcedure) is needed
137-
/// <summary>
138-
/// Call a saved procedure against a read-only node.
139-
/// </summary>
140-
/// <param name="graphName">The graph containing the saved procedure.</param>
141-
/// <param name="procedure">The procedure name.</param>
142-
/// <returns>A result set.</returns>
143-
ResultSet CallProcedureReadOnly(string graphName, string procedure);
144-
145-
/// <summary>
146-
/// Call a saved procedure with parameters against a read-only node.
147-
/// </summary>
148-
/// <param name="graphName">The graph containing the saved procedure.</param>
149-
/// <param name="procedure">The procedure name.</param>
150-
/// <param name="args">A collection of positional arguments.</param>
151-
/// <returns>A result set.</returns>
152-
ResultSet CallProcedureReadOnly(string graphName, string procedure, IEnumerable<string> args);
153-
154-
/// <summary>
155-
/// Call a saved procedure with parameters against a read-only node.
156-
/// </summary>
157-
/// <param name="graphName">The graph containing the saved procedure.</param>
158-
/// <param name="procedure">The procedure name.</param>
159-
/// <param name="args">A collection of positional arguments.</param>
160-
/// <param name="kwargs">A collection of keyword arguments.</param>
161-
/// <returns>A result set.</returns>
162-
ResultSet CallProcedureReadOnly(string graphName, string procedure, IEnumerable<string> args, Dictionary<string, List<string>> kwargs);
163-
164136
/// <summary>
165137
/// Constructs a query execution plan but does not run it. Inspect this execution plan to better understand how your
166138
/// query will get executed.

src/NRedisStack/Graph/Point.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ public Point(List<double> values)
2323
this.longitude = values[1];
2424
}
2525

26-
// TODO: check if this is needed:
2726
public override bool Equals(object? obj)
2827
{
2928
if (obj == null) return this == null;

0 commit comments

Comments
 (0)