コード例 #1
0
        public void FixFormatGeolocation_GetLocationsByDeviceSN()
        {
            var geolocationsMongoDB = new GeolocationsMongoDB(server);
            var locations = geolocationsMongoDB.GetLocationsByDeviceSN("000010274",
                new DateTime(2010, 7, 1, 0, 0, 1), new DateTime(2012, 9, 28, 23, 59, 59));
            var count = locations.ToList().Count;
            count.Should().Not.Equal(0);
            Console.WriteLine("Count: {0}", count);

            double distance = 0;
            locations.ToList().ForEach(l =>
            {
                l.HavDistanceMeters.Should().Be.InRange(0.0, double.MaxValue);
                l.Latitude.Should().Be.AssignableFrom(typeof(double));
                l.Longitude.Should().Be.AssignableFrom(typeof(double));

                distance += l.HavDistanceMeters;
            });

            for (int i = 1; i < locations.Count; i++)
            {
                var l = locations[i - 1];
                var r = locations[i];
                var diff = r.HeaderTime - l.HeaderTime;
                diff.Ticks.Should().Be.InRange(default(long), long.MaxValue);
            }

            Console.WriteLine("HavDistanceMeters: {0}", distance);
        }
コード例 #2
0
        public void CheckCount_GetLocationsByImei()
        {
            var geolocationsMongoDB = new GeolocationsMongoDB(server);
            var locations = geolocationsMongoDB.GetLocationsByImei("13845257385757011", new DateTime(2012, 9, 10, 0, 0, 1), new DateTime(2012, 9, 10, 23, 59, 59));
            var count = locations.ToList().Count;

            count.Should().Not.Equal(0);
        }
コード例 #3
0
        public void CheckCount_GetLocationsByDeviceSN()
        {
            var geolocationsMongoDB = new GeolocationsMongoDB(server);
            var locations = geolocationsMongoDB.GetLocationsByImei("352848024123388", new DateTime(2012, 10, 1, 0, 0, 1), new DateTime(2012, 10, 1, 23, 59, 59));
            var totalCount = locations.ToList().Count;
            var onlyGeoPointCount = locations.Where( g => g.FromMessage == "GeoPoint").ToList().Count;

            totalCount.Should().Not.Equal(0);
            (totalCount >= onlyGeoPointCount).Should().Equal(true);
        }