public void Execute(string sessionID, string messageID) { if (InvalidIDString(sessionID)) { throw new InvalidSessionIDException(); } if (InvalidIDString(messageID)) { throw new InvalidMessageIDException(); } if (_gameDataGateway.IsExistingSession(sessionID)) { _publishEndpoint.Publish(new RequestGameSessionFound { SessionID = sessionID, MessageID = messageID }); } else { _publishEndpoint.Publish(new RequestGameSessionNotFound { SessionID = sessionID, MessageID = messageID }); } }
public void Execute(string sessionID, string messageID, IGameData gameData) { if (InvalidIDString(sessionID)) { throw new InvalidSessionIDException(); } if (InvalidIDString(messageID)) { throw new InvalidMessageIDException(); } if (InvalidIDString(gameData.CurrentCardID)) { throw new InvalidCardIDException(); } _gameDataGateway.Save(sessionID, gameData); _publishMessageAdaptor.Publish(new GameResponse { SessionID = sessionID, MessageID = messageID, CardsToAdd = gameData.CardsToAdd, CurrentCardID = gameData.CurrentCardID, Seed = gameData.Seed, PackVersion = gameData.PackVersion, CurrentStats = gameData.CurrentStats }); }
private void PublishErrorMessage(IValidationResult[] results) { _publishMessageAdaptor.Publish(new FailedToAddCards() { ErrorMessages = (from validationResult in results where !validationResult.Valid select validationResult.ErrorMessage).ToArray() }); }
public int Execute() { int newVersion = _versionNumberGateway.Get() + 1; _versionNumberGateway.Set(newVersion); _publishMessageAdaptor.Publish(new RequestPackVersionNumberUpdated { PackNumber = newVersion }); return(newVersion); }
public void Execute(string sessionID) { if (InvalidIDString(sessionID)) { throw new InvalidSessionIDException(); } string messageID = Guid.NewGuid().ToString(); _publishEndPoint.Publish(new GetCurrentGameData { SessionID = sessionID, MessageID = messageID }); _awaitingResponseGateway.SaveID(messageID); }
public void Execute(string sessionID) { if (InvalidIDString(sessionID)) { throw new InvalidSessionIDException(); } string messageID = Guid.NewGuid().ToString(); _responseGateway.SaveID(messageID); _publishEndPoint.Publish(new RequestGameIsSessionIDInUse { SessionID = sessionID, MessageID = messageID }); }
public void Execute(string sessionID) { if (InvalidIDString(sessionID)) { throw new InvalidSessionIDException(); } string messageID = Guid.NewGuid().ToString(); _publishEndPoint.Publish(new Messages.Implementation.RequestStartingCard { MessageID = messageID, SessionID = sessionID, PackVersionNumber = _packVersionGateway.GetCurrentPackVersion(), Seed = _generateSeedUseCase.Execute(), }); _awaitingResponseGateway.SaveID(messageID); }