public void Test2(int value, int expected) { //ARRANGE var state = new BribeState(); //ACT // (c, state) -> events var happend = Bribe.Handle(new Plan { BribeId = Guid.NewGuid(), InitialValue = value }, state); //ASSERT // (events, state) -> newState var newState = happend.Aggregate(state, (s, e) => s.When(e)); Assert.Equal(expected, newState.Value); }
public void Test3() { //ARRANGE var state = new BribeState(); var id = Guid.NewGuid(); //ACT // (c, state) -> events var happend = Bribe.Handle(new Plan { BribeId = id, InitialValue = 100 }, state); //ASSERT // (events, state) -> newState var newState = happend.Aggregate(state, (s, e) => s.When(e)); Assert.Equal(id, newState.Id); }
public static IEvent[] Handle(Plan command, BribeState state) => Array.Empty <IEvent>();