Beispiel #1
0
        public void ShouldBeAbleToDynamicallyMapObservationToMessage()
        {
            SignalR.Common.Dto.Message source = new SignalR.Common.Dto.Observation
            {
                Entity = new SignalR.Common.Dto.Identity {
                    Value = "TESTENTITY"
                },
                Observable = new SignalR.Common.Dto.Identity {
                    Value = "TESTOBSERVABLE"
                },
                Date        = DateTimeOffset.Now,
                Measurement = new SignalR.Common.Dto.Measurement
                {
                    Type  = SignalR.Common.Dto.MeasurementType.Units,
                    Value = "3.14"
                }
            };

            With.Message.IMessage actual = source.AsDynamicMessage();

            Assert.IsInstanceOfType(actual, typeof(With.Message.IObservation));
        }
Beispiel #2
0
 public void PublishObservation(SignalR.Common.Dto.Observation observation)
 {
     _observers.Where(observer => string.Equals(observer.ObserveeId, observation.Entity.Value, StringComparison.CurrentCultureIgnoreCase) && string.Equals(observer.ObservableId, observation.Observable.Value, StringComparison.CurrentCultureIgnoreCase))
     .ForEach(observer => observer.Process(observation.AsDynamicMessage()));
 }
        public void ShouldBeAbleToDynamicallyMapObservationToMessage()
        {
            SignalR.Common.Dto.Message source = new SignalR.Common.Dto.Observation
            {
                Entity = new SignalR.Common.Dto.Identity { Value = "TESTENTITY" },
                Observable = new SignalR.Common.Dto.Identity { Value = "TESTOBSERVABLE" },
                Date = DateTimeOffset.Now,
                Measurement = new SignalR.Common.Dto.Measurement
                {
                    Type = SignalR.Common.Dto.MeasurementType.Units,
                    Value = "3.14"
                }
            };
            
            With.Message.IMessage actual = source.AsDynamicMessage();

            Assert.IsInstanceOfType(actual, typeof(With.Message.IObservation));
        }