Esempio n. 1
0
 protected override void EstablishContext()
 {
     base.EstablishContext();
     Parameter = new RemapAlarmsParameter {
         AcknowledgeParameters = new Tuple <AlarmSampleId[], Identity> [0],
         GetStatus             = false,
         CategoryId            = Id,
         CurrentParameters     = new Tuple <CriteriaType, AlarmSampleId, int> [0],
         HistoryParameters     = new Tuple <CriteriaType, AlarmSampleId, int> [0]
     };
     Notification = new Notification(DateTime.Now, "Message", "Short", "Long");
     AlarmsRunTarget.Setup(t => t.Reporter.Notifications).Returns(
         new ReadOnlyObservableCollection <Notification>(new ObservableCollection <Notification> {
         Notification
     })).Verifiable();
     Result = Service.RemapAlarms(new[] { Parameter }).Single();
 }
Esempio n. 2
0
                protected override void EstablishContext()
                {
                    base.EstablishContext();
                    Parameter = new RemapAlarmsParameter {
                        AcknowledgeParameters = new Tuple <AlarmSampleId[], Identity> [0],
                        GetStatus             = true,
                        CategoryId            = Id,
                        CurrentParameters     = new[] {
                            new Tuple <CriteriaType, AlarmSampleId, int>(
                                CriteriaType.DownFromInfinity, new AlarmSampleId(
                                    DateTime.Now, RandomGenerator.GetRandomInt32()),
                                RandomGenerator.GetRandomInt32())
                        },
                        HistoryParameters = new[] {
                            new Tuple <CriteriaType, AlarmSampleId, int>(
                                CriteriaType.DownFromInfinity, new AlarmSampleId(
                                    DateTime.Now, RandomGenerator.GetRandomInt32()),
                                RandomGenerator.GetRandomInt32())
                        }
                    };
                    AlarmsRunTarget.Setup(t => t.GetHasActiveAndUnacknowledged())
                    .Returns(new Tuple <bool, bool>(true, false)).Verifiable();
                    var curPar = Parameter.CurrentParameters.Single();

                    Current = new Alarm[0];
                    AlarmsRunTarget.Setup(t => t.GetCurrentAlarms(curPar.Item1, curPar.Item2, curPar.Item3))
                    .Returns(Current).Verifiable();
                    var histPar = Parameter.HistoryParameters.Single();

                    History = new Alarm[0];
                    AlarmsRunTarget
                    .Setup(t => t.GetHistoryAlarms(histPar.Item1, histPar.Item2, histPar.Item3))
                    .Returns(History).Verifiable();
                    Notification = new Notification(DateTime.Now, "Message", "Short", "Long");
                    AlarmsRunTarget.Setup(t => t.Reporter.Notifications).Returns(
                        new ReadOnlyObservableCollection <Notification>(new ObservableCollection <Notification> {
                        Notification
                    })).Verifiable();
                    Result = Service.RemapAlarms(new[] { Parameter }).Single();
                }