public async Task <ExecutionResponse <BranchCreateLinkResponse> > CreateDeepLink(BranchIoDeepLinkParms deepLinkParms) { ExecutionResponse <BranchCreateLinkResponse> response = new ExecutionResponse <BranchCreateLinkResponse>(); try { string url = branchIoConfig.ApiUrl + "/v1/url"; deepLinkParms.branch_key = branchIoConfig.ApiKey; string serializedContent = JsonConvert.SerializeObject(deepLinkParms); HttpContent content = new StringContent(serializedContent, Encoding.UTF8, "application/json"); using (HttpResponseMessage sendResponse = await BaseService.Client.PostAsync(url, content)) { if (sendResponse.StatusCode != HttpStatusCode.OK) { var responseContent = JsonConvert.DeserializeObject(await sendResponse.Content.ReadAsStringAsync()); MessagesHelper.SetValidationMessages(response, "Error", responseContent.ToString(), lang: "en"); return(response); } var res = JsonConvert.DeserializeObject <BranchCreateLinkResponse>(await sendResponse.Content.ReadAsStringAsync()); response.Result = res; response.State = ResponseState.Success; } } catch (Exception ex) { MessagesHelper.SetException(response, ex); } return(response); }
private void OnSolutionOpened() { var messagesHelper = new MessagesHelper(); failureMessages = new List <string>(); IList <string> successMessages = new List <string>(); IEnumerable <string> summaryMessages = new List <string>(); matchingSolutionOpened = false; var generalOptionsDto = GetGeneralOptionsDtoFromStorage(); var rulesDtos = RulesHelper.GetRulesDtos(); if (rulesDtos != null && rulesDtos.Any()) { var applyChangesMessages = ApplyChangesToSourceCode(rulesDtos, generalOptionsDto, dte.Solution.FullName); foreach (var applyChangesMessage in applyChangesMessages) { successMessages.Add(applyChangesMessage); } bool showPopUpMessage = ShowPopUpMessage(generalOptionsDto); if (showPopUpMessage) { summaryMessages = messagesHelper.GetSummaryMessages(rulesEnabledForThisSolutionCount, rulesProcesssedSuccessfullyCount, rulesProcesssedUnsuccessfullyCount, changesCount); var userFriendlySuccessMessages = messagesHelper.GetUserFriendlySuccessMessages(successMessages); var popUpMessage = messagesHelper.GetPopUpMessage(failureMessages, userFriendlySuccessMessages, summaryMessages); DisplayPopUpMessage(Helpers.Constants.CategoryName + " Results", popUpMessage); } } PostOpenProcessing(); }
public GlobalTopCommand(UsersConnector usersConnector, ILogger <GlobalTopCommand> logger, MessagesHelper messagesHelper) { _usersConnector = usersConnector; _logger = logger; _messagesHelper = messagesHelper; }
public async Task <ExecutionResponse <OneSignalAddDeviceResponse> > AddDevice(OneSignalDeviceModel device) { ExecutionResponse <OneSignalAddDeviceResponse> response = new ExecutionResponse <OneSignalAddDeviceResponse>(); try { var json_data = JsonConvert.SerializeObject(device); string url = oneSignalConfig.ApiUrl; string serializedContent = JsonConvert.SerializeObject(json_data); HttpContent content = new StringContent(serializedContent, Encoding.UTF8, "application/json"); using (HttpResponseMessage sendResponse = await BaseService.Client.PostAsync(url, content)) { if (sendResponse.StatusCode != HttpStatusCode.OK) { var responseContent = JsonConvert.DeserializeObject(await sendResponse.Content.ReadAsStringAsync()); MessagesHelper.SetValidationMessages(response, "Error", responseContent.ToString(), lang: "en"); return(response); } var res = JsonConvert.DeserializeObject <OneSignalAddDeviceResponse>(await sendResponse.Content.ReadAsStringAsync()); response.Result = res; response.State = ResponseState.Success; } } catch (Exception ex) { MessagesHelper.SetException(response, ex); } return(response); }
public async Task <ExecutionResponse <InfobipSendSmsResponse> > SendMessage(InfobipSmsModel model) { var response = new ExecutionResponse <InfobipSendSmsResponse>(); try { string url = infobipConfig.ApiUrl + "/sms/1/text"; string serializedContent = JsonConvert.SerializeObject(model); HttpContent content = new StringContent(serializedContent, Encoding.UTF8, "application/json"); BaseService.Client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("App", infobipConfig.ApiToken); using (HttpResponseMessage sendResponse = await BaseService.Client.PostAsync(url, content)) { if (sendResponse.StatusCode != HttpStatusCode.OK) { var responseContent = JsonConvert.DeserializeObject(await sendResponse.Content.ReadAsStringAsync()); MessagesHelper.SetValidationMessages(response, "Error", responseContent.ToString(), lang: "en"); return(response); } var res = JsonConvert.DeserializeObject <InfobipSendSmsResponse>(await sendResponse.Content.ReadAsStringAsync()); response.Result = res; response.State = ResponseState.Success; } } catch (Exception ex) { MessagesHelper.SetException(response, ex); } return(response); }
public CollectDropCommand(MessagesHelper messagesHelper, CoindropConnector coindropConnector, UsersConnector usersConnector) { _messagesHelper = messagesHelper; _coindropConnector = coindropConnector; _usersConnector = usersConnector; }
public static async Task <ExecutionResponse <bool> > SendEmail(SendEmailModel model) { ExecutionResponse <bool> response = new ExecutionResponse <bool>(); try { var from = new EmailAddress(model.SenderEmail, ""); var to = new EmailAddress(model.DeptEmail, ""); var plainTextContent = model.Message; var htmlContent = model.htmlContent; var subject = model.Subject; var email = MailHelper.CreateSingleEmail(from, to, subject, plainTextContent, htmlContent); var sendEmailAsyncRes = await sendGridClient.SendEmailAsync(email); if (sendEmailAsyncRes.StatusCode != HttpStatusCode.Accepted) { MessagesHelper.SetValidationMessages(response, "Email_Error", sendEmailAsyncRes.Body.ToString(), lang: "en"); return(response); } response.State = ResponseState.Success; response.Result = true; } catch (Exception ex) { MessagesHelper.SetException(response, ex); } return(response); }
public CoinflipCommandLogic(UsersConnector usersConnector, BetSizeParser betSizeParser, GameHistoryConnector gameHistoryConnector, MessagesHelper messagesHelper) { _usersConnector = usersConnector; _betSizeParser = betSizeParser; _gameHistoryConnector = gameHistoryConnector; _messagesHelper = messagesHelper; }
public SlotsCommand(UsersConnector usersConnector, BetSizeParser betSizeParser, GameHistoryConnector gameHistoryConnector, MessagesHelper messagesHelper) { _usersConnector = usersConnector; _betSizeParser = betSizeParser; _gameHistoryConnector = gameHistoryConnector; _messagesHelper = messagesHelper; }
public VoteRewardCommand(HttpClient client, UsersConnector usersConnector, Config config, MessagesHelper messagesHelper, ILogger <VoteRewardCommand> logger) { _client = client; _usersConnector = usersConnector; _config = config; _messagesHelper = messagesHelper; _logger = logger; }
public PublicCommands(CommandsManager commandsManager, IOptionsMonitor <TipBotSettings> options, IOptionsMonitor <ChainSettings> chainOptions, MessagesHelper messagesHelper) { this.CommandsManager = commandsManager; this.Settings = options.CurrentValue; this.ChainSettings = chainOptions.CurrentValue; this.MessagesHelper = messagesHelper; }
/// <summary> /// Get full repository data based on basic repository data. /// </summary> /// <param name="repositoryData">Basic repository data.</param> /// <returns>Full repository data of specified repository.</returns> public async Task <ClientResponse <FullRepositoryData> > GetFullRepositoryData(BasicRepositoryData repositoryData) { var url = $"/{UrlConstants.RepositoriesUrlPart}/{repositoryData.Owner.Login}/{repositoryData.Name}"; HttpResponseMessage httpresponse = await this.requestSender.SendGetRequestToGitHubApiAsync(url); var clientresponse = new ClientResponse <FullRepositoryData>(); return(await this.requestSender.ProcessHttpResponse <FullRepositoryData>( httpresponse, MessagesHelper.GenerateUserOrRepositoryNotFoundMessage(repositoryData.Owner.Login, repositoryData.Name))); }
public override void ValidateAfterChildrenAdded() { base.ValidateAfterChildrenAdded(); // If the implementation is disabled (because the assembly belongs to disabled to plugin), // and it is not under plugin setup element, lets show a warning that the implementation will be ignored. if (!Enabled && OwningPluginElement == null) { MessagesHelper.LogElementDisabledWarning(this, ValueTypeInfo.Assembly, true); } }
public override void Initialize() { base.Initialize(); if (ValueTypeInfo.Assembly.Plugin != null) { throw new ConfigurationParseException(this, MessagesHelper.GetServiceImplmenentationTypeAssemblyBelongsToPluginMessage(ValueTypeInfo.Type, ValueTypeInfo.Assembly.Alias, ValueTypeInfo.Assembly.Plugin.Name)); } }
public CommandHandlingService(IServiceProvider services, Settings settings, MessagesHelper messagesHelper) { this.commands = services.GetRequiredService <CommandService>(); this.discord = services.GetRequiredService <DiscordSocketClient>(); this.services = services; this.messagesHelper = messagesHelper; this.prefixes = new BotPrefixes(settings); this.errorMessageCreator = new ErrorMessageCreator(); this.discord.MessageReceived += this.MessageReceivedAsync; }
public void SpawnKingBoss() { currentBoss = bossScenarios.list[Random.Range(0, bossScenarios.list.Count)]; currentChar = BossScript.avaList[Random.Range(0, BossScript.avaList.Count)]; string con = currentBoss.eventMsg.Replace("%name%", names.nounList[Random.Range(0, names.nounList.Count)]).Replace("%item%", items.nounList[Random.Range(0, items.nounList.Count)]).Replace("%place%", places.nounList[Random.Range(0, places.nounList.Count)]); con = con.Replace("%test%", names.nounList[Random.Range(0, names.nounList.Count)]); bossKillText.text = con; bossName.text = "Król z dynastii " + currentLand.name.ToString(); bossAvatar.sprite = currentChar.avatarImg; bossBackground.color = LandColor; }
bool ErrorOrReturn(string msgKey, params string[] parameters) { if (ErrorMode == ErrorMode.ErrorFree) { return(true); } throw new BbCodeParsingException( string.IsNullOrEmpty(msgKey) ? string.Empty : MessagesHelper.GetString(msgKey, parameters)); }
public static void MainMenu() { System.Console.WriteLine("Great, so what would You like to do now? \n"); System.Console.WriteLine("#1 <- Generate quick nickname accoding to Your personalities"); System.Console.WriteLine("#2 <- Generate random nickname"); System.Console.WriteLine("#3 <- Generate some password"); System.Console.WriteLine("#4 <- Exit \n"); System.Console.WriteLine("What is Your choice: "); int choice = int.Parse(Console.ReadLine()); MessagesHelper.AnimProcess(3); PerformAction(choice); }
public void StartGame() { MapMenu.SetActive(false); current = eventScrip.list[Random.Range(0, eventScrip.list.Count)]; Debug.Log(charScrip.avaList[Random.Range(0, charScrip.avaList.Count)]); currentChar = charScrip.avaList[Random.Range(0, charScrip.avaList.Count - 1)]; CardMenu.SetActive(true); string con = current.eventMsg.Replace("%name%", names.nounList[Random.Range(0, names.nounList.Count)]).Replace("%item%", items.nounList[Random.Range(0, items.nounList.Count)]).Replace("%place%", places.nounList[Random.Range(0, places.nounList.Count)]); con = con.Replace("%test%", names.nounList[Random.Range(0, names.nounList.Count)]); lore.text = con; avatar.sprite = currentChar.avatarImg; characterName.text = currentChar.charName; avaBackground.color = LandColor; }
protected virtual void ValidateImplementationsAfterChildrenAdded() { foreach (var childElement in Children) { if (childElement is IServiceImplementationElement serviceImplementation) { if (!ServiceTypeInfo.Type.IsAssignableFrom(serviceImplementation.ValueTypeInfo.Type)) { throw new ConfigurationParseException(serviceImplementation, $"Implementation '{serviceImplementation.ValueTypeInfo.TypeCSharpFullName}' is not valid for service '{ServiceTypeInfo.TypeCSharpFullName}'.", this); } var disabledPluginTypeInfo = serviceImplementation.ValueTypeInfo.GetUniquePluginTypes().FirstOrDefault(x => !x.Assembly.Plugin.Enabled); if (disabledPluginTypeInfo == null) { // Note, the same implementation type might appear multiple times. // We do not want to prevent this, since each implementation might have different constructor parameters or injected properties. _serviceImplementations.Add(serviceImplementation); } else if (GetPluginSetupElement() == null) { var warningString = new StringBuilder(); warningString.Append($"Implementation '{serviceImplementation.ValueTypeInfo.TypeCSharpFullName}' will be ignored since it"); if (serviceImplementation.ValueTypeInfo.GenericTypeParameters.Count > 0) { warningString.Append($" uses type '{disabledPluginTypeInfo.TypeCSharpFullName}' which"); } warningString.Append($" is defined in assembly '{disabledPluginTypeInfo.Assembly.Alias}' that belongs to disabled plugin '{disabledPluginTypeInfo.Assembly.Plugin.Name}'."); LogHelper.Context.Log.Warn(warningString.ToString()); } } } // We might have a situation, when the only implementations are types in plugins, and all // plugins are disabled. In this case _serviceImplementations will be an empty enumeration, and that would be OK. if (_serviceImplementations.Count == 0) { LogHelper.Context.Log.WarnFormat(MessagesHelper.GetNoImplementationsForServiceMessage(ServiceTypeInfo.Type)); } else if (_serviceImplementations.Count > 1 && RegisterIfNotRegistered) { throw new ConfigurationParseException(this, MessagesHelper.GetMultipleImplementationsWithRegisterIfNotRegisteredOptionMessage($"attribute '{ConfigurationFileAttributeNames.RegisterIfNotRegistered}'")); } }
static void Main(string[] args) { Console.Clear(); MessagesHelper.Invitations(); // var user1 = new User(); MessagesHelper.GetUserData(ref user1); System.Console.WriteLine($"OK {user1.FirstName} so You are born in '{user1.CountShortBornYear()} \n \n"); System.Console.WriteLine("Aren't You? \n \n"); while (true) { MainMenu(); Console.Clear(); } }
/// <summary> /// Gets branches list of specified repository. /// </summary> /// <param name="username">The name of repository owner.</param> /// <param name="repositoryName">The repository name.</param> /// <returns>ClientResponse instance with collection of branches.</returns> public async Task <ClientResponse <IEnumerable <Branch> > > GetBranchList(string username, string repositoryName) { if (username == string.Empty || repositoryName == string.Empty) { var clientResponse = new ClientResponse <IEnumerable <Branch> > { Message = MessagesHelper.EmptyDataMessage, Status = OperationStatus.EmptyData }; return(clientResponse); } var url = $"/{UrlConstants.RepositoriesUrlPart}/{username}/{repositoryName}/{UrlConstants.BranchesUrlPart}"; HttpResponseMessage httpResponse = await this.requestSender.SendGetRequestToGitHubApiAsync(url); return(await this.requestSender.ProcessHttpResponse <IEnumerable <Branch> >( httpResponse, MessagesHelper.GenerateUserOrRepositoryNotFoundMessage(username, repositoryName))); }
public void LoadNewCard() { if (treacheryLvL <= 0.1f) { treacheryLvL = 0.1f; } if (suspicionLvL <= 0.1f) { suspicionLvL = 0.1f; } treachery.rectTransform.sizeDelta = new Vector2(100, (195 * treacheryLvL) / 100); suspision.rectTransform.sizeDelta = new Vector2(100, (105 * suspicionLvL) / 100); sand.rectTransform.sizeDelta = new Vector2(100, 250); ChangeDaytime(); timePassed = 0; currentChar = charScrip.avaList[Random.Range(0, charScrip.avaList.Count)]; current = eventScrip.list[Random.Range(0, eventScrip.list.Count)]; avatar.sprite = currentChar.avatarImg; characterName.text = currentChar.charName; string con = current.eventMsg.Replace("%name%", names.nounList[Random.Range(0, names.nounList.Count)]).Replace("%item%", items.nounList[Random.Range(0, items.nounList.Count)]).Replace("%place%", places.nounList[Random.Range(0, places.nounList.Count)]); lore.text = con; avaBackground.color = LandColor; }
/// <summary> /// Get Messages /// </summary> private void getMessages() { messageControl.ClearForm(); Cursor = Cursors.WaitCursor; try { // Call Get Service Method _response = MessagesHelper.Get(tbRequest.Text, getCertificate()); //Update UI with Results _messageRows = _response.Messages.Select(m => new MessageRow { Id = m.Id, Received = bool.FalseString }).ToList(); gvMessages.DataSource = _messageRows; } catch (Exception exception) { displayError(exception); } finally { Cursor = Cursors.Default; } }
/// <summary> /// ctor /// </summary> public Q101ConsoleHelper() { MessagesHelper = new MessagesHelper(); }
public WorkRewardCommand(MessagesHelper messagesHelper, UsersConnector usersConnector) { _messagesHelper = messagesHelper; _usersConnector = usersConnector; }
public ShowProfileCommand(UsersConnector usersConnector, MessagesHelper messagesHelper) { _usersConnector = usersConnector; _messagesHelper = messagesHelper; }
public virtual SequenceNode ParseSyntaxTree(string bbCode) { if (bbCode == null) { throw new ArgumentNullException(nameof(bbCode)); } Stack <SyntaxTreeNode> stack = new Stack <SyntaxTreeNode>(); var rootNode = new SequenceNode(); stack.Push(rootNode); int end = 0; while (end < bbCode.Length) { if (MatchTagEnd(bbCode, ref end, stack)) { continue; } if (MatchStartTag(bbCode, ref end, stack)) { continue; } if (MatchTextNode(bbCode, ref end, stack)) { continue; } if (ErrorMode != ErrorMode.ErrorFree) { // there is no possible match at the current position throw new BbCodeParsingException(string.Empty); } // if the error free mode is enabled force interpretation as text if no other match could be made AppendText(bbCode[end].ToString(), stack); end++; } // assert bbCode was matched entirely Debug.Assert(end == bbCode.Length); // close all tags that are still open and can be closed implicitly while (stack.Count > 1) { var node = (TagNode)stack.Pop(); if (node.Tag.RequiresClosingTag && ErrorMode == ErrorMode.Strict) { throw new BbCodeParsingException( MessagesHelper.GetString("TagNotClosed", node.Tag.Name)); } } if (stack.Count != 1) { Debug.Assert(ErrorMode != ErrorMode.ErrorFree); // only the root node may be left throw new BbCodeParsingException(string.Empty); } return(rootNode); }
string ParseText(string input, ref int pos) { int end = pos; bool escapeFound = false; bool anyEscapeFound = false; while (end < input.Length) { if (input[end] == '[' && !escapeFound) { break; } if (input[end] == ']' && !escapeFound) { if (ErrorMode == ErrorMode.Strict) { throw new BbCodeParsingException( MessagesHelper.GetString("NonescapedChar")); } } if (input[end] == '\\' && !escapeFound) { escapeFound = true; anyEscapeFound = true; } else if (escapeFound) { if (!(input[end] == '[' || input[end] == ']' || input[end] == '\\')) { if (ErrorMode == ErrorMode.Strict) { throw new BbCodeParsingException( MessagesHelper.GetString("EscapeChar")); } } escapeFound = false; } end++; } if (escapeFound) { if (ErrorMode == ErrorMode.Strict) { throw new BbCodeParsingException(""); } } var result = input.Substring(pos, end - pos); if (anyEscapeFound) { var result2 = new char[result.Length]; int writePos = 0; bool lastWasEscapeChar = false; for (int i = 0; i < result.Length; i++) { if (!lastWasEscapeChar && result[i] == '\\') { if (i < result.Length - 1) { if (!(result[i + 1] == '[' || result[i + 1] == ']' || result[i + 1] == '\\')) { // the next char was not escapable. write the slash into the output array result2[writePos++] = result[i]; } else { // the next char is meant to be escaped so the backslash is skipped lastWasEscapeChar = true; } } else { // the backslash was the last char in the string. just write it into the output array result2[writePos++] = '\\'; } } else { result2[writePos++] = result[i]; lastWasEscapeChar = false; } } result = new string(result2, 0, writePos); } pos = end; return(result == string.Empty ? null : result); }
public void ValidateMqttLocalPubSubConnectionWithUadp( [Values((byte)1, (UInt16)1, (UInt32)1, (UInt64)1, "abc")] object publisherId) { RestartMosquitto("mosquitto"); //Arrange UInt16 writerGroupId = 1; string mqttLocalBrokerUrl = "mqtt://localhost:1883"; ITransportProtocolConfiguration mqttConfiguration = new MqttClientProtocolConfiguration(version: EnumMqttProtocolVersion.V500); UadpNetworkMessageContentMask uadpNetworkMessageContentMask = UadpNetworkMessageContentMask.PublisherId | UadpNetworkMessageContentMask.WriterGroupId | UadpNetworkMessageContentMask.PayloadHeader; UadpDataSetMessageContentMask uadpDataSetMessageContentMask = UadpDataSetMessageContentMask.None; DataSetFieldContentMask dataSetFieldContentMask = DataSetFieldContentMask.None; DataSetMetaDataType[] dataSetMetaDataArray = new DataSetMetaDataType[] { MessagesHelper.CreateDataSetMetaData1("DataSet1"), MessagesHelper.CreateDataSetMetaData2("DataSet2"), MessagesHelper.CreateDataSetMetaData3("DataSet3") }; PubSubConfigurationDataType publisherConfiguration = MessagesHelper.CreatePublisherConfiguration( Profiles.PubSubMqttUadpTransport, mqttLocalBrokerUrl, publisherId: publisherId, writerGroupId: writerGroupId, uadpNetworkMessageContentMask: uadpNetworkMessageContentMask, uadpDataSetMessageContentMask: uadpDataSetMessageContentMask, dataSetFieldContentMask: dataSetFieldContentMask, dataSetMetaDataArray: dataSetMetaDataArray, nameSpaceIndexForData: kNamespaceIndexAllTypes); Assert.IsNotNull(publisherConfiguration, "publisherConfiguration should not be null"); // Configure the mqtt publisher configuration with the MQTTbroker PubSubConnectionDataType mqttPublisherConnection = MessagesHelper.GetConnection(publisherConfiguration, publisherId); Assert.IsNotNull(mqttPublisherConnection, "The MQTT publisher connection is invalid."); mqttPublisherConnection.ConnectionProperties = mqttConfiguration.ConnectionProperties; Assert.IsNotNull(mqttPublisherConnection.ConnectionProperties, "The MQTT publisher connection properties are not valid."); // Create publisher application for multiple datasets UaPubSubApplication publisherApplication = UaPubSubApplication.Create(publisherConfiguration); MessagesHelper.LoadData(publisherApplication, kNamespaceIndexAllTypes); IUaPubSubConnection publisherConnection = publisherApplication.PubSubConnections.First(); Assert.IsNotNull(publisherConnection, "Publisher first connection should not be null"); Assert.IsNotNull(publisherConfiguration.Connections.First(), "publisherConfiguration first connection should not be null"); Assert.IsNotNull(publisherConfiguration.Connections.First().WriterGroups.First(), "publisherConfiguration first writer group of first connection should not be null"); var networkMessages = publisherConnection.CreateNetworkMessages(publisherConfiguration.Connections.First().WriterGroups.First(), new WriterGroupPublishState()); Assert.IsNotNull(networkMessages, "connection.CreateNetworkMessages shall not return null"); Assert.GreaterOrEqual(networkMessages.Count, 1, "connection.CreateNetworkMessages shall have at least one network message"); UadpNetworkMessage uaNetworkMessage = networkMessages[0] as UadpNetworkMessage; Assert.IsNotNull(uaNetworkMessage, "networkMessageEncode should not be null"); bool hasDataSetWriterId = (uadpNetworkMessageContentMask & UadpNetworkMessageContentMask.PayloadHeader) != 0; PubSubConfigurationDataType subscriberConfiguration = MessagesHelper.CreateSubscriberConfiguration( Profiles.PubSubMqttUadpTransport, mqttLocalBrokerUrl, publisherId: publisherId, writerGroupId: writerGroupId, setDataSetWriterId: hasDataSetWriterId, uadpNetworkMessageContentMask: uadpNetworkMessageContentMask, uadpDataSetMessageContentMask: uadpDataSetMessageContentMask, dataSetFieldContentMask: dataSetFieldContentMask, dataSetMetaDataArray: dataSetMetaDataArray, nameSpaceIndexForData: kNamespaceIndexAllTypes); Assert.IsNotNull(subscriberConfiguration, "subscriberConfiguration should not be null"); // Create subscriber application for multiple datasets UaPubSubApplication subscriberApplication = UaPubSubApplication.Create(subscriberConfiguration); Assert.IsNotNull(subscriberApplication, "subscriberApplication should not be null"); Assert.IsNotNull(subscriberApplication.PubSubConnections.First(), "subscriberConfiguration first connection should not be null"); // Configure the mqtt subscriber configuration with the MQTTbroker PubSubConnectionDataType mqttSubcriberConnection = MessagesHelper.GetConnection(subscriberConfiguration, publisherId); Assert.IsNotNull(mqttSubcriberConnection, "The MQTT subscriber connection is invalid."); mqttSubcriberConnection.ConnectionProperties = mqttConfiguration.ConnectionProperties; Assert.IsNotNull(mqttSubcriberConnection.ConnectionProperties, "The MQTT subscriber connection properties are not valid."); var dataSetReaders = subscriberApplication.PubSubConnections.First().GetOperationalDataSetReaders(); Assert.IsNotNull(dataSetReaders, "dataSetReaders should not be null"); IUaPubSubConnection subscriberConnection = subscriberApplication.PubSubConnections.First(); Assert.IsNotNull(subscriberConnection, "Subscriber first connection should not be null"); //Act // it will signal if the uadp message was received from local ip m_uaDataShutdownEvent = new ManualResetEvent(false); subscriberApplication.DataReceived += UaPubSubApplication_DataReceived; subscriberConnection.Start(); publisherConnection.Start(); //Assert if (!m_uaDataShutdownEvent.WaitOne(kEstimatedPublishingTime)) { Assert.Fail("The UADP message was not received"); } subscriberConnection.Stop(); publisherConnection.Stop(); }