private static void ConcludeCurrentEvent() { CausalEvent formerEvent = currentEvent; currentEvent = formerEvent.Conclude(); eventPool.Push(formerEvent); }
private static void StartNewEvent(IOutcome eventOutcome) { CausalEvent newEvent = (EventPool.Count > 0)? EventPool.Pop() : new CausalEvent(); newEvent.Outcome = eventOutcome; newEvent.PriorEvent = currentEvent; currentEvent = newEvent; }
public void ToString_should_return_representation_of_event() { // Arrange var vve = new CausalEvent("r", 1); // Act string repr = vve.ToString(); // Assert repr.Should().Be("(r,1)"); }
public CausalEvent Conclude() { CausalEvent eventToReturn = PriorEvent; IState[] factors; if (Influences.Count > 0 && Outcome.IsValid) { factors = Influences.ToArray(); Influences.Clear(); } else { factors = Array.Empty <IState>(); } Outcome?.SetInfluences(factors); Outcome = null; PriorEvent = null; return(eventToReturn); }