예제 #1
0
        public void Check_If_BelongTest()
        {
            Mock_ClusterService clusterService = new Mock_ClusterService(true);

            List <Cluster> clusters = clusterService.ReadJsonForTests();

            Assert.IsTrue(clusters[0].Check_If_Belong(clusters[0].Coordinates.ElementAt(0)));
        }
예제 #2
0
        public void Calculate_RadiusTest()
        {
            Mock_ClusterService clusterService = new Mock_ClusterService(true);

            List <Cluster> clusters = clusterService.ReadJsonForTests();


            double ActualRadius = 111.49002209304558;

            Assert.AreEqual(ActualRadius, clusters[0].Cluster_Radius);
        }
예제 #3
0
        public void Calculate_CenterTest()
        {
            Mock_ClusterService clusterService = new Mock_ClusterService(true);

            List <Cluster> clusters = clusterService.ReadJsonForTests();

            Location center = clusters[0].Center_Location;

            Location TestCenter = new Location(-25.7669207258453, 28.32507578731504, DateTime.Now);

            Assert.AreEqual(TestCenter.Latitude, center.Latitude);
            Assert.AreEqual(TestCenter.Longitude, center.Longitude);
        }
        public void AddLocationToClusterTest()
        {
            Mock_ClusterService clusterService = new Mock_ClusterService(true);

            clusterService.ReadJsonForTests();
            Location mockLocation = new Location(-26.275312, 28.065452);

            clusterService.AddLocationToCluster(mockLocation);
            Location       secondMockLoc = new Location(-26.275355, 28.065396);
            List <Cluster> checkInRange  = clusterService.ClustersInRange(secondMockLoc, 35.00);
            bool           tester        = false;

            foreach (Cluster yourCluster in checkInRange)
            {
                if (yourCluster.Coordinates.Contains(mockLocation))
                {
                    tester = true;
                }
            }
            Assert.IsTrue(tester);
        }