protected virtual void ExecuteOperations(IMongoClient client, Dictionary <string, object> objectMap, BsonDocument test, EventCapturer eventCapturer = null) { _objectMap = objectMap; var factory = new JsonDrivenTestFactory(client, DatabaseName, CollectionName, bucketName: null, objectMap, eventCapturer); foreach (var operation in test[OperationsKey].AsBsonArray.Cast <BsonDocument>()) { ModifyOperationIfNeeded(operation); var receiver = operation["object"].AsString; var name = operation["name"].AsString; var jsonDrivenTest = factory.CreateTest(receiver, name); jsonDrivenTest.Arrange(operation); if (test["async"].AsBoolean) { jsonDrivenTest.ActAsync(CancellationToken.None).GetAwaiter().GetResult(); } else { jsonDrivenTest.Act(CancellationToken.None); } jsonDrivenTest.Assert(); } }
private void ValidateOperations(BsonDocument test) { Logger.Debug("Validating operations"); foreach (var operation in test["operations"].AsBsonArray.Cast <BsonDocument>()) { var receiver = operation["object"].AsString; var name = operation["name"].AsString; JsonDrivenTestFactory.SkipTestIfNeeded(receiver, name); } }
private void ExecuteOperations(IMongoClient client, Dictionary <string, object> objectMap, BsonDocument test) { var factory = new JsonDrivenTestFactory(client, _databaseName, _collectionName, objectMap); foreach (var operation in test["operations"].AsBsonArray.Cast <BsonDocument>()) { var receiver = operation["object"].AsString; var name = operation["name"].AsString; var jsonDrivenTest = factory.CreateTest(receiver, name); jsonDrivenTest.Arrange(operation); jsonDrivenTest.Act(CancellationToken.None); jsonDrivenTest.Assert(); } }
private void ExecuteOperations(IMongoClient client, Dictionary <string, object> objectMap, BsonDocument test) { var factory = new JsonDrivenTestFactory(this, client, _databaseName, _collectionName, bucketName: null, objectMap); foreach (var operation in test["operations"].AsBsonArray.Cast <BsonDocument>()) { var receiver = operation["object"].AsString; var name = operation["name"].AsString; var jsonDrivenTest = factory.CreateTest(receiver, name); jsonDrivenTest.Arrange(operation); if (test["async"].AsBoolean) { jsonDrivenTest.ActAsync(CancellationToken.None).GetAwaiter().GetResult(); } else { jsonDrivenTest.Act(CancellationToken.None); } jsonDrivenTest.Assert(); } }