private void AssertEvent(object actualEvent, BsonDocument expectedEvent) { if (expectedEvent.ElementCount != 1) { throw new FormatException("Expected event must be a document with a single element with a name the specifies the type of the event."); } var eventType = expectedEvent.GetElement(0).Name; var eventAsserter = EventAsserterFactory.CreateAsserter(eventType); eventAsserter.AssertAspects(actualEvent, expectedEvent[0].AsBsonDocument); }
protected virtual void AssertEvent(object actualEvent, BsonDocument expectedEvent, Action <object, BsonDocument> prepareEventResult, Func <KeyValuePair <string, BsonValue>[]> getPlaceholders = null) { if (expectedEvent.ElementCount != 1) { throw new FormatException("Expected event must be a document with a single element with a name the specifies the type of the event."); } prepareEventResult?.Invoke(actualEvent, expectedEvent); var eventType = expectedEvent.GetElement(0).Name; var eventAsserter = EventAsserterFactory.CreateAsserter(eventType); if (getPlaceholders != null) { eventAsserter.ConfigurePlaceholders(getPlaceholders()); } eventAsserter.AssertAspects(actualEvent, expectedEvent[0].AsBsonDocument); }