public static ApplicationState Reduce(ApplicationState state, IAction action) { return(action switch { InitializeAction _ => state with { Message = "Initialize Action" },
public static void AddInitializeAction(int order, InitializeAction action) { if (!hcs.TryAdd(order, action)) { throw new InitializationException("order is already in use"); } }
public GameStore Init(Version version, GameBoard board = null) { var action = new InitializeAction { Version = version, Board = board }; return(Evaluate(m_reducer.Apply(action, Evaluator.InitialStore))); }
public GameBoard Apply(IAction action, GameBoard store) { return(action switch { InitializeAction ia => ia.Board ?? BoardFactory.Instance.Create(ia.Version), MoveAction ma => Move(store, ma.Move), NextPlayerAction npa => RemoveKing(store, npa.CurrentColor), _ => store });
public void InitializeAsync_When_NotAwaitingAndUsingYield_Then_ManualResetEventShouldNotYetHaveBeenSet() { var manualResetEvent = new ManualResetEventSlim(false); var testee = new InitializeAction( () => { Thread.Sleep(10); manualResetEvent.Set(); }, true); _ = testee.InitializeAsync(); manualResetEvent.IsSet.Should().BeFalse(); }
public async Task InitializeAsync_When_Awaiting_Then_ManualResetEventShouldBeSet(bool useYield) { var manualResetEvent = new ManualResetEventSlim(false); var testee = new InitializeAction( () => { Thread.Sleep(10); manualResetEvent.Set(); }, useYield); await testee.InitializeAsync(); manualResetEvent.IsSet.Should().BeTrue(); }
public DefaultInitializationInput(InitializeAction initializeAction) { ShardId = initializeAction.ShardId; SequenceNumber = initializeAction.SequenceNumber; SubSequenceNumber = initializeAction.SubSequenceNumber; }
public ThreadManager <TAction> SetInitializeAction(InitializeAction <TAction> initializeAction) { _initializeAction = initializeAction; return(this); }
private void initActionList() { if (this.InvokeRequired) { InitializeAction actionControl = new InitializeAction(LoadActionList); this.Invoke(actionControl); } else { this.LoadActionList(); } }