Skip to content

Commit e20f71f

Browse files
committed
Cloud Test -- add in missing SearchAsync function in mock tests needed for ICloudLibWrapper
1 parent 9888173 commit e20f71f

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

api/Tests/CESMII.ProfileDesigner.Api.Tests/CloudLibMock/CloudLibMock.cs

+26
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,32 @@ int IEqualityComparer<SearchInputs>.GetHashCode(SearchInputs obj)
9191
public OnNodeSet OnNodeSetFound { get; set; }
9292
public OnNodeSet OnNodeSetNotFound { get; set; }
9393

94+
public async Task<GraphQlResult<Nodeset>> SearchAsync(int? limit, string cursor, bool pageBackwards, List<string> keywords, List<string> exclude, bool noTotalCount, object? order)
95+
{
96+
var inputs = new SearchInputs
97+
{
98+
Keywords = keywords?.ToArray(),
99+
Cursor = cursor,
100+
PageBackwards = pageBackwards,
101+
Limit = limit,
102+
};
103+
if (_wrapper != null)
104+
{
105+
var result = await _wrapper.SearchAsync(limit, cursor, pageBackwards, keywords, exclude, noTotalCount, order);
106+
107+
if (!_searchData.ContainsKey(inputs))
108+
{
109+
_searchData.Add(inputs, result);
110+
}
111+
return result;
112+
}
113+
if (_searchData.TryGetValue(inputs, out var data))
114+
{
115+
return data;
116+
}
117+
throw new Exception($"Request not in mock data: {inputs}");
118+
}
119+
94120
public async Task<GraphQlResult<Nodeset>> SearchAsync(int? limit, string cursor, bool pageBackwards, List<string> keywords, List<string> exclude, bool noTotalCount)
95121
{
96122
var inputs = new SearchInputs

0 commit comments

Comments
 (0)