public void FoodRepCache()
 {
     var rep = new FoodTruckRepository();
     double testLatitude1 = 37.7833;
     double testLongitude1 = -122.4167;
     var result = rep.GetApprovedFoodTrucks(testLatitude1, testLongitude1, 10);
     Assert.IsNotNull(result);
     Assert.IsNotNull(rep.allFoodTrucksCache.Get("FoodTrucks"));
 }
        public void FoodRepCalcProximityZero()
        {
            var rep = new FoodTruckRepository();
            // Arrange
            double testLatitude1 = 37.7833;
            double testLongitude1 = -122.4167;
            var dist = rep.CalcProximity(0, 0, 0, 0);

            // Assert
            Assert.IsNotNull(dist);
            Assert.AreEqual(dist, 0);
        }
        public void FoodRepCalcProximitySameLoc()
        {
            var rep = new FoodTruckRepository();
            // Arrange
            double testLatitude1 = 37.7833;
            double testLongitude1 = -122.4167;
            var dist = rep.CalcProximity(testLatitude1, testLongitude1, testLatitude1, testLongitude1);

            // Assert
            Assert.IsNotNull(dist);
            Assert.IsTrue(dist < 0.0005);
        }
        public void GetApiApprovedTrucks()
        {
            var rep = new FoodTruckRepository();
            var allTrucks = rep.GetAllFoodTrucks();

            // Arrange
            double testLatitude = 37.7833;
            double testLongitude = -122.4167;
            FoodTruckController controller = new FoodTruckController();

            // Act - get ALL approved trucks with a valid location
            var allApproved = controller.Index(testLatitude, testLongitude, allTrucks.Count());
            var numApprovedExpected = allTrucks.Where(x => x.Status.Equals("APPROVED") && x.Latitude != 0.0 && x.Longitude != 0.0).Count();

            // Assert
            Assert.IsNotNull(allApproved);
            Assert.AreEqual(numApprovedExpected, allApproved.Count);
        }