/// <summary> /// Asserts that your sagas and messages are written correctly: /// <list type="bullet"> /// <item><description>All classes impmenenting <see cref="ISaga{TSagaData}"/> should also have <see cref="InitiatedBy{TMsg}"/> applied.</description></item> /// <item><description>Any saga message can only be used by a single Saga. No message sharing between different sagas are allowed.</description></item> /// <item><description>All saga messages are used by sagas. No loose classes with <see cref="ISagaMessage"/> or <see cref="IInitiatingSagaMessage"/> without sagas consuming them are allowed.</description></item> /// </list> /// </summary> /// <exception cref="AggregateException">Aggregation of all the exceptions for each rule violation</exception> public void AssertConfigurationIsValid() { var allExceptions = new List <Exception>(); sagaTypes = NSagaReflection.GetAllSagaTypes(assemblies); allExceptions.AddRange(AllSagasHaveInitialiser()); allExceptions.AddRange(InitiatorMessagesAreNotShared()); allExceptions.AddRange(ConsumerMessagesAreNotShared()); if (allExceptions.Any()) { throw new AggregateException(allExceptions); } }