public Notifier(string gameId, MessageTopic topic, MoniverseNotification notification, NotificationLevel level = NotificationLevel.Info) { GameId = gameId; message = notification; NotificationId = notification.Id; Topic = topic; Level = level; switch (topic) { case MessageTopic.Error: message.ARN = NotificationTopics.ServiceError; if (level == NotificationLevel.Error) { message.ARN = NotificationTopics.ServiceError; } break; case MessageTopic.Users: message.ARN = NotificationTopics.ServiceError; break; case MessageTopic.Game: break; case MessageTopic.Hosting: break; } }
public List<MoniverseNotification> GetNotificationsForGame(string gameId, MessageTopic Topic, NotificationLevel Level, DateTime start, DateTime end) { List<MoniverseNotification> notificationList = new List<MoniverseNotification>(); string topic; string level = "Info"; switch (Topic) { case MessageTopic.All: topic = "Error"; break; default: topic = Topic.ToString(); break; } string query = String.Format(@"select * from {5} WHERE GameID = '{0}' -- AND Topic = '{1}' -- AND Level = '{2}' AND CreatedAt BETWEEN '{3}' AND '{4}' ORDER BY CreatedAt DESC;", gameId, topic, level, start.ToString("yyyy-MM-dd HH:mm:ss"), end.ToString("yyyy-MM-dd HH:mm:ss"), NotificationTable ); notificationList = DBManager.Instance.Query<MoniverseNotification>(Datastore.Monitoring, query).ToList<MoniverseNotification>(); return notificationList; }
public NotificationEvent(NotificationLevel level, int eventClass, int eventCode, string eventMessage) { Level = level; EventClass = eventClass; EventCode = eventCode; EventMessage = eventMessage; }
public Notification(string message, NotificationLevel level = NotificationLevel.Info, Exception exception = null, object[] details = null) { this.exception = exception; this.details = details; Message = message; Level = level; CreatedAt = SystemTime.UtcNow; }
public NotificationData(Person person, NotificationLevel notificationLevel, GpsLocation gpsLocation) { dictionaryJson = new Dictionary<string, string>(); dictionaryJson.Add("Name", person.Name); dictionaryJson.Add("Surname", person.Surname); dictionaryJson.Add("Notification", ((int)notificationLevel).ToString()); dictionaryJson.Add("Latitude", gpsLocation.Latitude.ToString().Replace(',', '.')); dictionaryJson.Add("Longitude", gpsLocation.Longitude.ToString().Replace(',', '.')); }
public NotificationEvent(IEventSource source, NotificationLevel level, int eventClass, int eventCode, string eventMessage) { if (source == null) throw new ArgumentNullException("source"); EventSource = source; Level = level; EventClass = eventClass; EventCode = eventCode; EventMessage = eventMessage; }
public void notifySend(NotificationLevel level, string title, string content, int activeTimeMilliseconds) { Texture t = new Texture(); if (level == NotificationLevel.IMPORTANT) { t = importantTex; } else { t = infoTex; } Notification n = new Notification (level, t, title, content, activeTimeMilliseconds); _notifications.Add (n); }
public bool IsNotificationSettingEnabled(NotificationLevel currentNotificationLevel) { bool shouldContinue = true; switch (currentNotificationLevel) { case NotificationLevel.Info: shouldContinue = NotificationSettings.Info; break; case NotificationLevel.Warning: shouldContinue = NotificationSettings.Warning; break; case NotificationLevel.Error: shouldContinue = NotificationSettings.Error; break; case NotificationLevel.PVSupport: shouldContinue = NotificationSettings.PVSupport; break; } return shouldContinue; }
private static void OnDisplayProgress(string message, NotificationLevel level) { switch (level) { case NotificationLevel.Tip: Write(message); Console.CursorLeft = 0; break; case NotificationLevel.Information: Write(message); break; case NotificationLevel.Warning: Write(message, ConsoleColor.Yellow); break; case NotificationLevel.Error: Write(message, ConsoleColor.Red); break; default: throw new ArgumentOutOfRangeException(); } }
public void ShowNotificationMessage(string msg, NotificationLevel msgLevel){ Brush msgBackgorund = null; switch (msgLevel) { case NotificationLevel.Information: msgBackgorund = new SolidColorBrush(Colors.Green); break; case NotificationLevel.Warning: msgBackgorund = new SolidColorBrush(Colors.Orange); break; case NotificationLevel.Error: msgBackgorund = new SolidColorBrush(Colors.DarkRed); break; case NotificationLevel.Critical: msgBackgorund = new SolidColorBrush(Colors.Red); break; } notify_br.Background = msgBackgorund; notify_tb.Text=msg; _storyboard.Begin(); }
public static string ToSerialString(this NotificationLevel value) => value switch {
private LogLevel GetLogLevel(NotificationLevel level) { if (level == NotificationLevel.Debug || level == NotificationLevel.Message) return LogLevel.Information; if (level == NotificationLevel.Verbose) return LogLevel.Verbose; return LogLevel.Undefined; }
private void Init(string id, string ruleId, string ruleKey, PhysicalLocation physicalLocation, string message, NotificationLevel level, int threadId, DateTime time, ExceptionData exception, IDictionary<string, SerializedPropertyInfo> properties) { Id = id; RuleId = ruleId; RuleKey = ruleKey; if (physicalLocation != null) { PhysicalLocation = new PhysicalLocation(physicalLocation); } Message = message; Level = level; ThreadId = threadId; Time = time; if (exception != null) { Exception = new ExceptionData(exception); } if (properties != null) { Properties = new Dictionary<string, SerializedPropertyInfo>(properties); } }
public void SetVerbosity(NotificationLevel level) { this.notificationLevel.SetItem(new NotfierVerbosityHolder { Level = level }); }
/// <summary> /// Converts the <see cref="sourceValue" /> parameter to the <see cref="destinationType" /> parameter using <see cref="formatProvider" /// /> and <see cref="ignoreCase" /> /// </summary> /// <param name="sourceValue">the <see cref="System.Object"/> to convert from</param> /// <param name="destinationType">the <see cref="System.Type" /> to convert to</param> /// <param name="formatProvider">not used by this TypeConverter.</param> /// <param name="ignoreCase">when set to <c>true</c>, will ignore the case when converting.</param> /// <returns> /// an instance of <see cref="NotificationLevel" />, or <c>null</c> if there is no suitable conversion. /// </returns> public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => NotificationLevel.CreateFrom(sourceValue);
public string RenderPlainText(NotificationLevel minLevelForDetails) { return(fullText); }
void Write(string message, NotificationLevel level = NotificationLevel.Information) { OnWriteProgress(new SystemUpdateProgressEventArgs(message, 0F, true) { Data = level }); }
public NotifictionMessage(NotificationLevel level, string message) : this(level, message, new TimeSpan(0, 0, 0, 0, 3000)) { }
public List<MoniverseNotification> GetNotificationsForGame(string gameId, MessageTopic topic, NotificationLevel Level) { DateTime start = new DateTime(2015, 01, 01); return GetNotificationsForGame(gameId, topic, Level, start, DateTime.UtcNow); }
/// <summary> /// 语法糖,相当于NotificationData.GetInstance().Add /// </summary> public static void AddNotifiction(NotificationLevel level, string message) { AddNotifiction(new NotifictionMessage(level, message)); }
// Events fired by other classes: void OnLogMessageByKeySearcher(string msg, NotificationLevel loglevel) { GuiLogMessage(msg, loglevel); }
public Notification(string message, NotificationLevel level = NotificationLevel.Info) { Message = message; Level = level; CreatedAt = SystemTime.Now; }
public void RenderPlainText_WhenProvidedAnyThreshold_ReturnsFullText(NotificationLevel threshold) { var sut = new CriticalNimatorResult("dummy message", "longer full text here"); Assert.That(sut.RenderPlainText(threshold), Is.EqualTo("longer full text here")); }
protected void Log(String msg, NotificationLevel lvl) => EventsHelper.GuiLogMessage(this.OnGuiLogNotificationOccured, this, new GuiLogEventArgs(msg, this, lvl));
private void AddToolNotification( string id, NotificationLevel level, string messageFormat, params object[] args) { string message = string.Format(CultureInfo.CurrentCulture, messageFormat, args); // When the parser read the offending line, it incremented the line number, // so report the previous line. long lineNumber = _parser.LineNumber - 1; string messageWithLineNumber = string.Format( CultureInfo.CurrentCulture, ConverterResources.SemmleNotificationFormat, lineNumber, message); _toolNotifications.Add(new Notification { Id = id, Time = DateTime.Now, Level = level, Message = messageWithLineNumber }); }
public void WhenCheckHasNotificationLevelNotOkay_MetricIsHealthy_ShouldBeFalse(NotificationLevel notificationLevel) { var result = new NimatorResult(DateTime.Now); List <ICheckResult> checkResults = new List <ICheckResult>(); checkResults.Add(new CheckResult("BasicLogin", notificationLevel)); result.LayerResults.Add(new LayerResult(layerName: "Infrastructure", checkResults: checkResults)); var sut = GetSut(); // Act sut.Notify(result); // Assert sut.Metrics.Count.ShouldBe(2); sut.Metrics.ShouldContain(metric => metric.StatName.EndsWith(".isHealthy") && metric.Value.Equals(0)); }
public static void SendNotification(string message, NotificationLevel level) { var mainwindow = Application.Current.MainWindow as MainWindow; mainwindow.ShowNotificationMessage(message, level, () => { Uri imageuri = null; switch (level) { case NotificationLevel.Information: imageuri = new Uri("pack://application:,,,/WarehouseMgr;component/Images/success_16px.png"); break; case NotificationLevel.Warning: imageuri = new Uri("pack://application:,,,/WarehouseMgr;component/Images/alert_16px.png"); break; case NotificationLevel.Error: imageuri = new Uri("pack://application:,,,/WarehouseMgr;component/Images/error_16px.png"); break; case NotificationLevel.Critical: imageuri = new Uri("pack://application:,,,/WarehouseMgr;component/Images/error_16px.png"); break; } var img = new BitmapImage(); img.BeginInit(); img.UriSource = imageuri; img.EndInit(); mainwindow.status_img.Source = img; mainwindow.status_tblock.Text = message; }); }
public NotificationTable(string name, NotificationMechanism notificationMechanism, NotificationLevel notificationLevel, int pollInterval, string tableName, string keyFieldName, string[] columnNames = null) : this(name, notificationMechanism, notificationLevel, pollInterval, tableName, new string[] { keyFieldName }, columnNames) { }
/// <summary> /// Starts the execution of the defined workspace /// 1) Parses the commandline parameters /// 2) Creates CT2 model and execution engine /// 3) Starts execution /// 4) Gives data as defined by user to the model /// 5) Retrieves results for output and outputs these /// 6) [terminates] /// </summary> /// <param name="args"></param> public void Start(string[] args) { _startTime = DateTime.Now; //Step 0: Set locale to English var cultureInfo = new CultureInfo("en-us", false); CultureInfo.CurrentCulture = cultureInfo; CultureInfo.CurrentUICulture = cultureInfo; CultureInfo.DefaultThreadCurrentCulture = cultureInfo; //Step 1: Check, if Help needed if (ArgsHelper.GetShowHelp(args)) { Environment.Exit(0); } //Step 2: Get cwm_file to open string cwm_file = ArgsHelper.GetCWMFileName(args); if (cwm_file == null) { Console.WriteLine("Please specify a cwm file using -cwm=filename"); Environment.Exit(-1); } if (!File.Exists(cwm_file)) { Console.WriteLine("Specified cwm file \"{0}\" does not exist", cwm_file); Environment.Exit(-2); } //Step 3: Get additional parameters _verbose = ArgsHelper.CheckVerboseMode(args); try { _timeout = ArgsHelper.GetTimeout(args); } catch (Exception ex) { Console.WriteLine(ex.Message); Environment.Exit(-2); } try { _loglevel = ArgsHelper.GetLoglevel(args); } catch (Exception ex) { Console.WriteLine(ex.Message); Environment.Exit(-2); } try { _terminationType = ArgsHelper.GetTerminationType(args); } catch (Exception ex) { Console.WriteLine(ex.Message); Environment.Exit(-2); } try { _jsonoutput = ArgsHelper.CheckJsonOutput(args); } catch (Exception ex) { Console.WriteLine(ex.Message); Environment.Exit(-2); } //Step 4: Check, if discover mode was selected if (ArgsHelper.CheckDiscoverMode(args)) { DiscoverCWMFile(cwm_file); Environment.Exit(0); } //Step 5: Get input parameters List <Parameter> inputParameters = null; try { inputParameters = ArgsHelper.GetInputParameters(args); if (_verbose) { foreach (var param in inputParameters) { Console.WriteLine("Input parameter given: " + param); } } } catch (InvalidParameterException ipex) { Console.WriteLine(ipex.Message); Environment.Exit(-3); } catch (Exception ex) { Console.WriteLine("Exception occured while parsing parameters: {0}", ex.Message); Environment.Exit(-3); } //Step 6: Get output parameters List <Parameter> outputParameters = null; try { outputParameters = ArgsHelper.GetOutputParameters(args); if (_verbose) { foreach (var param in inputParameters) { Console.WriteLine("Output parameter given: " + param); } } } catch (InvalidParameterException ipex) { Console.WriteLine(ipex.Message); Environment.Exit(-3); } catch (Exception ex) { Console.WriteLine("Exception occured while parsing parameters: {0}", ex.Message); Environment.Exit(-3); } //Step 7: Update application domain. This allows loading additional .net assemblies try { UpdateAppDomain(); } catch (Exception ex) { Console.WriteLine("Exception occured while updating AppDomain: {0}", ex.Message); Environment.Exit(-4); } //Step 8: Load cwm file and create model try { ModelPersistance modelPersistance = new ModelPersistance(); _workspaceModel = modelPersistance.loadModel(cwm_file, true); foreach (var pluginModel in _workspaceModel.GetAllPluginModels()) { pluginModel.Plugin.OnGuiLogNotificationOccured += OnGuiLogNotificationOccured; } } catch (Exception ex) { Console.WriteLine("Exception occured while loading model from cwm file: {0}", ex.Message); Environment.Exit(-5); } //Step 9: Set input parameters foreach (var param in inputParameters) { string name = param.Name; bool found = false; foreach (var component in _workspaceModel.GetAllPluginModels()) { //we also memorize here the name of each plugin if (!_pluginNames.ContainsKey(component.Plugin)) { _pluginNames.Add(component.Plugin, component.GetName()); } if (component.GetName().ToLower().Equals(param.Name.ToLower())) { if (component.PluginType.FullName.Equals("CrypTool.TextInput.TextInput")) { var settings = component.Plugin.Settings; var textProperty = settings.GetType().GetProperty("Text"); if (param.ParameterType == ParameterType.Text || param.ParameterType == ParameterType.Number) { textProperty.SetValue(settings, param.Value); } else if (param.ParameterType == ParameterType.File) { try { if (!File.Exists(param.Value)) { Console.WriteLine("Input file does not exist: {0}", param.Value); Environment.Exit(-7); } var value = File.ReadAllText(param.Value); textProperty.SetValue(settings, value); } catch (Exception ex) { Console.WriteLine("Exception occured while reading file {0}: {0}", param.Value, ex.Message); Environment.Exit(-7); } } //we need to call initialize to get the new text to the ui of the TextInput component //otherwise, it will output the value retrieved by deserialization component.Plugin.Initialize(); found = true; } } } if (!found) { Console.WriteLine("Component for setting input parameter not found: {0}", param); Environment.Exit(-7); } } //Step 10: Set output parameters foreach (var param in outputParameters) { string name = param.Name; bool found = false; foreach (var component in _workspaceModel.GetAllPluginModels()) { if (component.GetName().ToLower().Equals(param.Name.ToLower())) { if (component.PluginType.FullName.Equals("TextOutput.TextOutput")) { component.Plugin.PropertyChanged += Plugin_PropertyChanged; found = true; } } } if (!found) { Console.WriteLine("TextOutput for setting output parameter not found: {0}", param); Environment.Exit(-7); } } //Step 11: add OnPluginProgressChanged handlers foreach (var plugin in _workspaceModel.GetAllPluginModels()) { plugin.Plugin.OnPluginProgressChanged += OnPluginProgressChanged; } //Step 12: Create execution engine try { _engine = new ExecutionEngine(null); _engine.OnGuiLogNotificationOccured += OnGuiLogNotificationOccured; _engine.Execute(_workspaceModel, false); } catch (Exception ex) { Console.WriteLine("Exception occured while executing model: {0}", ex.Message); Environment.Exit(-7); } //Step 13: Start execution in a dedicated thread DateTime endTime = DateTime.Now.AddSeconds(_timeout); Thread t = new Thread(() => { CultureInfo.CurrentCulture = new CultureInfo("en-Us", false); while (_engine.IsRunning()) { Thread.Sleep(100); if (_engine.IsRunning() && _timeout < int.MaxValue && DateTime.Now >= endTime) { Console.WriteLine("Timeout ({0} seconds) reached. Kill process hard now", _timeout); Environment.Exit(-8); } } if (_verbose) { Console.WriteLine("Execution engine stopped. Terminate now"); Console.WriteLine("Total execution took: {0}", DateTime.Now - _startTime); } Environment.Exit(0); }); t.Start(); }
public Notification(NotificationLevel level, Texture icon, string title, string content, int activeTimeMilliseconds) { _level = level; _title = title; _content = content; _icon = icon; _creationTime = DateTime.Now; _activeTimeMilliseconds = activeTimeMilliseconds; }
private void SetCurrentWarning(NotificationLevel level, string message) { CurrentNotificationLevel = level; CurrentNotificationMessage = message; }
public NotificationTable(string name, NotificationMechanism notificationMechanism, NotificationLevel notificationLevel, int pollInterval, string tableName, string[] keyFieldNames, string[] columnNames = null) { Name = name; NotificationMechanism = notificationMechanism; NotificationLevel = notificationLevel; PollInterval = pollInterval; TableName = tableName; KeyFieldNames = keyFieldNames; ColumnNames = columnNames; }
private void Init(string id, string ruleId, string ruleKey, PhysicalLocation physicalLocation, string message, NotificationLevel level, int threadId, DateTime time, ExceptionData exception, IDictionary <string, SerializedPropertyInfo> properties) { Id = id; RuleId = ruleId; RuleKey = ruleKey; if (physicalLocation != null) { PhysicalLocation = new PhysicalLocation(physicalLocation); } Message = message; Level = level; ThreadId = threadId; Time = time; if (exception != null) { Exception = new ExceptionData(exception); } if (properties != null) { Properties = new Dictionary <string, SerializedPropertyInfo>(properties); } }
/// <summary> /// Shows a toast notification of given Content and Level. /// </summary> /// <param name="content">The content of the toast notification message.</param> /// <param name="level">The notification level.</param> /// <param name="callbackAction">This action will be called if the user clicked on the Toast Notification.</param> /// <param name="timeout">The timeout in second when the notification hides itself, default value is 5</param> public void ShowToastNotification(string content, NotificationLevel level, Action callbackAction = null, int timeout = 5) { ParentWindow.ShowToastNotification(content, level, callbackAction, timeout); }
private static Notification CreateNotification( Uri uri, string notificationId, NotificationLevel level, Exception exception, bool persistExceptionStack, params object[] args) { return CreateNotification(uri, notificationId, null, level, exception, persistExceptionStack, args); }
public NotificationRaised(string message, NotificationLevel level = NotificationLevel.Warning) { Message = message; Level = level; CreatedAt = DateTime.Now; }
public static float GetStandardDuration(this NotificationLevel level) => level switch {
public NotificationRaised(string message, NotificationLevel level= NotificationLevel.Warning) { Message = message; Level = level; CreatedAt = DateTime.Now; }
/// <summary> /// Initializes a new instance of the <see cref="Notification" /> class from the supplied values. /// </summary> /// <param name="id"> /// An initialization value for the <see cref="P: Id" /> property. /// </param> /// <param name="ruleId"> /// An initialization value for the <see cref="P: RuleId" /> property. /// </param> /// <param name="ruleKey"> /// An initialization value for the <see cref="P: RuleKey" /> property. /// </param> /// <param name="physicalLocation"> /// An initialization value for the <see cref="P: PhysicalLocation" /> property. /// </param> /// <param name="message"> /// An initialization value for the <see cref="P: Message" /> property. /// </param> /// <param name="level"> /// An initialization value for the <see cref="P: Level" /> property. /// </param> /// <param name="threadId"> /// An initialization value for the <see cref="P: ThreadId" /> property. /// </param> /// <param name="time"> /// An initialization value for the <see cref="P: Time" /> property. /// </param> /// <param name="exception"> /// An initialization value for the <see cref="P: Exception" /> property. /// </param> /// <param name="properties"> /// An initialization value for the <see cref="P: Properties" /> property. /// </param> public Notification(string id, string ruleId, string ruleKey, PhysicalLocation physicalLocation, string message, NotificationLevel level, int threadId, DateTime time, ExceptionData exception, IDictionary <string, SerializedPropertyInfo> properties) { Init(id, ruleId, ruleKey, physicalLocation, message, level, threadId, time, exception, properties); }
/// <summary> /// Shows the toast notification. /// </summary> /// <param name="content">The content of the toast notification message.</param> /// <param name="level">The notification level.</param> /// <param name="callbackAction">This action will be called if the user clicked on the Toast Notification.</param> /// <param name="timeout">The timeout in second when the notification hides itself, default value is 0</param> /// <remarks> /// If multiple toast notification is shown, they will shown one under another. /// </remarks> public void ShowToastNotification(string content, NotificationLevel level, Action callbackAction = null, int timeout = 5) { ToastNotificationWindow window = new ToastNotificationWindow(this, content, level, callbackAction, timeout); window.Show(); }
public void GuiLogMessage(string p, NotificationLevel notificationLevel) { EventsHelper.GuiLogMessage(OnGuiLogNotificationOccured, this, new GuiLogEventArgs(p, this, notificationLevel)); }
public static void GuiLogMessage(GuiLogNotificationEventHandler del, IPlugin plugin, string message, NotificationLevel level) { GuiLogMessage(del, plugin, new GuiLogEventArgs(message, plugin, level)); }
private static Notification CreateNotification( Uri uri, string notificationId, string ruleId, NotificationLevel level, Exception exception, bool persistExceptionStack, params object[] args) { string messageFormat = GetMessageFormatResourceForNotification(notificationId); string message = string.Format(CultureInfo.CurrentCulture, messageFormat, args); string exceptionMessage = exception?.Message; if (!string.IsNullOrEmpty(exceptionMessage)) { message += string.Format(CultureInfo.InvariantCulture, SdkResources.NotificationWithExceptionMessage, message, exceptionMessage); } var exceptionData = exception != null && persistExceptionStack ? ExceptionData.Create(exception) : null; var physicalLocation = uri != null ? new PhysicalLocation { Uri = uri } : null; var notification = new Notification { PhysicalLocation = physicalLocation, Id = notificationId, RuleId = ruleId, Level = level, Message = message, Exception = exceptionData }; return notification; }
/// <summary> /// Logs a message to the Cryptool console /// </summary> public void LogMessage(string msg, NotificationLevel level) { EventsHelper.GuiLogMessage(OnGuiLogNotificationOccured, this, new GuiLogEventArgs(msg, this, level)); }
/// <summary> /// Initializes a new instance of the <see cref="Notification" /> class from the supplied values. /// </summary> /// <param name="id"> /// An initialization value for the <see cref="P: Id" /> property. /// </param> /// <param name="ruleId"> /// An initialization value for the <see cref="P: RuleId" /> property. /// </param> /// <param name="ruleKey"> /// An initialization value for the <see cref="P: RuleKey" /> property. /// </param> /// <param name="physicalLocation"> /// An initialization value for the <see cref="P: PhysicalLocation" /> property. /// </param> /// <param name="message"> /// An initialization value for the <see cref="P: Message" /> property. /// </param> /// <param name="level"> /// An initialization value for the <see cref="P: Level" /> property. /// </param> /// <param name="threadId"> /// An initialization value for the <see cref="P: ThreadId" /> property. /// </param> /// <param name="time"> /// An initialization value for the <see cref="P: Time" /> property. /// </param> /// <param name="exception"> /// An initialization value for the <see cref="P: Exception" /> property. /// </param> /// <param name="properties"> /// An initialization value for the <see cref="P: Properties" /> property. /// </param> public Notification(string id, string ruleId, string ruleKey, PhysicalLocation physicalLocation, string message, NotificationLevel level, int threadId, DateTime time, ExceptionData exception, IDictionary<string, SerializedPropertyInfo> properties) { Init(id, ruleId, ruleKey, physicalLocation, message, level, threadId, time, exception, properties); }
public async Task RunAsync_AllBucketsWithDocumentCountWithinThreshold_OkayNotification(NotificationLevel expectedLevel) { _bucketConfig2.SetupGet(x => x.BasicStats).Returns(new BasicStats { ItemCount = _belowThreshold }); ICheckResult result = await _target.RunAsync(); Assert.AreEqual(expectedLevel, result.Level); Assert.IsTrue(result.RenderPlainText().Contains("Bucket document count within expected range")); _clusterService.Verify(x => x.GetClusterInfoAsync(), Times.Once); }
private void GuiLogMessage(string message, NotificationLevel logLevel) { EventsHelper.GuiLogMessage(OnGuiLogNotificationOccured, this, new GuiLogEventArgs(message, this, logLevel)); }
public async Task RunAsync_SomeBucketsWithDocumentCountAboveThreshold_WarningNotification(NotificationLevel expectedLevel) { _bucketConfig2.SetupGet(x => x.BasicStats).Returns(new BasicStats { ItemCount = _aboveThreshold }); ICheckResult result = await _target.RunAsync(); Assert.AreEqual(expectedLevel, result.Level); _clusterService.Verify(x => x.GetClusterInfoAsync(), Times.Once); }
/// <summary> /// Handles log messages from the settings class /// </summary> private void Lorenz_LogMessage(string msg, NotificationLevel loglevel) { EventsHelper.GuiLogMessage(OnGuiLogNotificationOccured, this, new GuiLogEventArgs(msg, this, loglevel)); }
private TInput ConvertImpl(NotificationLevel val) => val switch {
public void JsonDeserialization_WhenGivenNoThreshold_InitializesToErrorByDefault(NotificationLevel expectedThreshold, string type) { var json = "{ \"Notifiers\": [{ \"$type\": \" " + type + "\" }] }"; var settings = NimatorSettings.FromJson(json); Assert.That(settings.Notifiers, Is.Not.Empty); Assert.That(settings.Notifiers.Single().Threshold, Is.EqualTo(expectedThreshold)); }
public void ShowNotificationMessage(string msg, NotificationLevel level=NotificationLevel.Information) { _notifycontentControl.ShowNotificationMessage(msg, level); }