private void ApplyEvent(object evt) { if (!MethodExecutor.ExecuteMethod(this, evt)) { throw new MissingMethodException(string.Format("Aggregate {0} does not support a method that can be called with {1}", this, evt)); } }
public void WhenExecutingAMethod_ThenTheMethodIsCalled() { var obj = new ExecutableObject(); MethodExecutor.ExecuteMethod(obj, 123); Assert.AreEqual(123, obj.TheValue); }
public IEnumerable <IDomainNotification> Handle(IDomainNotification evt) { this.updatedReadModels.Clear(); MethodExecutor.ExecuteMethod(this, evt.Event); return(this.updatedReadModels); }
public void WhenExecutingAMethodOnASecondInstance_ThenTheMethodIsCalledOnTheSecondInstance() { var first = new ExecutableObject(); var second = new ExecutableObject(); MethodExecutor.ExecuteMethod(first, 123); MethodExecutor.ExecuteMethod(second, 456); Assert.AreEqual(456, second.TheValue); }
public void WhenExecutingAMethod1000Times_ThenTheSpeedIsOK() { var obj = new ExecutableObject(); for (int i = 0; i < 1000; i++) { MethodExecutor.ExecuteMethod(obj, i); } Assert.True(true); }
public IEnumerable <IDomainNotification> Process(IEnumerable <IAggregateEvent> events) { this.updatedReadModels.Clear(); foreach (var evt in events) { MethodExecutor.ExecuteMethod(this, evt); } return(this.updatedReadModels); }
private void Execute(object aggregate, object command) { try { if (!MethodExecutor.ExecuteMethod(aggregate, command)) { throw new MissingMethodException(string.Format("Aggregate {0} does not support a method that can be called with {1}", aggregate, command)); } } catch (Exception ex) { Debug.WriteLine("Error executing command\n{0}", ex); throw; } }