private void MockEvent(string reference, string uri, string expectedType, bool pass = true) { ContentEvent mockItem = new ContentEvent(); mockItem.eventType = expectedType; mockItem.id = Guid.NewGuid().ToString(); mockItem.subject = "/content/sharedcontent/29849536-f716-468d-bf49-41446cb68284"; mockItem.eventTime = ""; mockItem.dataVersion = ""; mockItem.metadataVersion = ""; mockItem.topic = ""; mockItem.data.itemId = reference; mockItem.data.api = uri; mockItem.data.versionId = Guid.NewGuid().ToString(); mockItem.data.displayText = "some content"; mockItem.data.author = "Fred"; string response; CosmosHelper.Initialise(_scenarioContext.GetEnv().eventStoreEndPoint, _scenarioContext.GetEnv().eventStoreKey); CosmosHelper.InsertDocumentFromJson <ContentEvent>("EventStore", "events", mockItem, out response); }
private List <ContentEvent> GetMatchingDocuments(string id, string eventType = "") { string additionalClause = eventType.Equals(string.Empty) ? string.Empty : $" and c.eventType = '{eventType.ToLower()}'"; string query = $"SELECT * FROM c where c.subject = '{id}'{additionalClause}"; CosmosHelper.Initialise(_scenarioContext.GetEnv().eventStoreEndPoint, _scenarioContext.GetEnv().eventStoreKey); List <ContentEvent> list = CosmosHelper.SearchForDocuments <ContentEvent>("dfc-eventstore", "events", query); Console.WriteLine($"Check Event Store: found {list.Count} with query '{query}'"); return(list); }