public void TestExecuteNoParamsDelegatesCallToTransaction() { IResult actualResult = transactionExecutor.Execute(query); mockTransaction.Verify(transaction => transaction.Execute(query), Times.Exactly(1)); Assert.AreEqual(mockResult.Object, actualResult); }
public async Task TestExecuteNoParamsDelegatesCallToTransaction() { IResult actualResult = await transactionExecutor.Execute(query); mockTransaction.Verify(transaction => transaction.Execute(query, It.IsAny <CancellationToken>()), Times.Exactly(1)); Assert.AreEqual(mockResult.Object, actualResult); }
private bool CheckIfVinAlreadyExists(TransactionExecutor transactionExecutor, string vin) { IIonValue ionVin = this.valueFactory.NewString(vin); IResult selectResult = transactionExecutor.Execute("SELECT VIN FROM VehicleRegistration AS v WHERE v.VIN = ?", ionVin); return(selectResult.Any(x => x.GetField("VIN").StringValue == vin)); }
private bool CheckIfPersonAlreadyExists(TransactionExecutor transactionExecutor, string govId) { IIonValue ionGovId = this.valueFactory.NewString(govId); IEnumerable <IIonValue> selectResult = transactionExecutor.Execute("SELECT GovId FROM Person AS p WHERE p.GovId = ?", ionGovId); return(selectResult.Any(x => x.GetField("GovId").StringValue == govId)); }
public string GetDocumentId(TransactionExecutor transactionExecutor, string tableName, string identifer, string value) { IIonValue ionValue = this.valueFactory.NewString(value); IResult selectResult = transactionExecutor.Execute($"SELECT metadata.id FROM _ql_committed_{tableName} AS p WHERE p.data.{identifer} = ?", ionValue); IEnumerable <string> documentIds = selectResult.Select(x => x.GetField("id").StringValue).ToList(); return(documentIds.Any() ? documentIds.First() : string.Empty); }
private IEnumerable <string> GetSecondaryOwners(TransactionExecutor transactionExecutor, string vin) { IIonValue ionVin = this.valueFactory.NewString(vin); IResult selectResult = transactionExecutor.Execute("SELECT Owners.SecondaryOwners FROM VehicleRegistration AS v WHERE v.VIN = ?", ionVin); IIonList secondaryOwners = selectResult.First().GetField("SecondaryOwners") as IIonList; if (secondaryOwners != null) { List <string> secondaryOwnerIds = new List <string>(); foreach (var owner in secondaryOwners) { secondaryOwnerIds.Add(owner?.GetField("PersonId")?.StringValue); } return(secondaryOwnerIds); } else { return(Enumerable.Empty <string>()); } }
static string testFunc(TransactionExecutor txn) { txn.Execute("testStatement"); return("test"); }