1- import 'dart:typed_data' ;
2-
31import 'package:bson/bson.dart' hide Timestamp;
42import 'package:fixnum/fixnum.dart' ;
53import 'package:flutter_test/flutter_test.dart' ;
@@ -101,14 +99,20 @@ void main() {
10199 const limit = 10 ;
102100 const last = 'last' ;
103101 const sortOrder = Order .ORDER_ASCENDING ;
102+ bool includeBinary = false ;
104103
105- when (serviceClient.binaryDataByFilter (any)).thenAnswer ((_) => MockResponseFuture .value (BinaryDataByFilterResponse ()
106- ..count = Int64 (limit)
107- ..last = last));
104+ when (serviceClient.binaryDataByFilter (any)).thenAnswer ((invocation) {
105+ includeBinary = (invocation.positionalArguments[0 ] as BinaryDataByFilterRequest ).includeBinary;
106+ return MockResponseFuture .value (BinaryDataByFilterResponse ()
107+ ..count = Int64 (limit)
108+ ..last = last);
109+ });
108110
109- final response = await dataClient.binaryDataByFilter (filter: filter, limit: limit, sortOrder: sortOrder, last: last);
111+ final response =
112+ await dataClient.binaryDataByFilter (filter: filter, limit: limit, sortOrder: sortOrder, last: last, includeBinary: true );
110113 expect (response.count, equals (Int64 (limit)));
111114 expect (response.last, equals (last));
115+ expect (includeBinary, isTrue);
112116 });
113117
114118 test ('binaryDataByFilter_countOnly' , () async {
@@ -135,11 +139,16 @@ void main() {
135139 BinaryData ()..binary = [2 , 3 , 4 , 5 ],
136140 BinaryData ()..binary = [3 , 4 , 5 , 6 ],
137141 ];
142+ bool includeBinary = false ;
138143
139- when (serviceClient.binaryDataByIDs (any)).thenAnswer ((_) => MockResponseFuture .value (BinaryDataByIDsResponse ()..data.addAll (data)));
144+ when (serviceClient.binaryDataByIDs (any)).thenAnswer ((invocation) {
145+ includeBinary = (invocation.positionalArguments[0 ] as BinaryDataByIDsRequest ).includeBinary;
146+ return MockResponseFuture .value (BinaryDataByIDsResponse ()..data.addAll (data));
147+ });
140148
141- final response = await dataClient.binaryDataByIds (ids);
142- expect (response, equals (data));
149+ final response = await dataClient.binaryDataByIds (ids, includeBinary: true );
150+ expect (response.data, equals (data));
151+ expect (includeBinary, isTrue);
143152 });
144153
145154 test ('tabularDataBySql' , () async {
0 commit comments