Exemple #1
0
        public void CanRouteLiveDataMeasurements()
        {
            var queue = BuildRemoteQueue();

            queue.EnqueueMeasurementToTarget(new Measurement {
                Timestamp         = DateTime.UtcNow,
                PlatformTimestamp = DateTime.UtcNow,
                Latitude          = 1.1234M,
                Longitude         = 1.134643M,
                SensorId          = ObjectId.GenerateNewId(),
                Data = new Dictionary <string, DataPoint>()
            }, new RoutingTarget()
            {
                Target = "Local"
            });

            queue.EnqueueMeasurementToTarget(new Measurement {
                Timestamp         = DateTime.UtcNow,
                PlatformTimestamp = DateTime.UtcNow,
                Latitude          = 1.1234M,
                Longitude         = 1.134643M,
                SensorId          = ObjectId.GenerateNewId(),
                Data = new Dictionary <string, DataPoint>()
            }, new RoutingTarget()
            {
                Target = "Local"
            });

            queue.FlushAsync();
            Assert.AreEqual(1, ClientStub.GetPublishCount("sensateiot/internal/measurements/Local/bulk"));
        }
Exemple #2
0
        public void CanRouteLiveDataMessages()
        {
            var queue = BuildRemoteQueue();

            queue.EnqueueMessageToTarget(new Message {
                Timestamp         = DateTime.UtcNow,
                PlatformTimestamp = DateTime.UtcNow,
                Data     = "Hello, World",
                SensorId = ObjectId.GenerateNewId()
            }, new RoutingTarget {
                Target = "Local"
            });

            queue.EnqueueMessageToTarget(new Message {
                Timestamp         = DateTime.UtcNow,
                PlatformTimestamp = DateTime.UtcNow,
                Data     = "Hello, World",
                SensorId = ObjectId.GenerateNewId()
            }, new RoutingTarget {
                Target = "Remote"
            });

            queue.FlushAsync();
            Assert.AreEqual(1, ClientStub.GetPublishCount("sensateiot/internal/messages/Local/bulk"));
            Assert.AreEqual(1, ClientStub.GetPublishCount("sensateiot/internal/messages/Remote/bulk"));
        }