public void add_and_get_customers_sort_by_name()
 {
     EfMethods.AddCustomer("Justine");
     EfMethods.AddCustomer("Agnes");
     EfMethods.AddCustomer("Emma");
     string[] result = EfMethods.GetAllCustomerNamesSorted();
     CollectionAssert.AreEqual(new[] { "Agnes", "Emma", "Justine" }, result);
 }
        public void add_and_get_customers()
        {
            EfMethods.AddCustomer("Justine");
            string[] result = EfMethods.GetAllCustomerNames();
            CollectionAssert.AreEqual(new[] { "Justine" }, result);

            EfMethods.AddCustomer("Agnes");
            string[] result2 = EfMethods.GetAllCustomerNames();
            CollectionAssert.AreEqual(new[] { "Justine", "Agnes" }, result2);
        }
        public void get_scooter_names_with_at_least_1000_electricity_left()
        {
            EfMethods.AddScooter("Glion", 500);    // Electricity left: 500
            EfMethods.AddScooter("Xiaomi", 1200);  // Electricity left: 1200
            EfMethods.AddScooter("Ninebot", 1700); // Electricity left: 1700

            string[] result = EfMethods.GetScooterNamesWithAtLeast1000ElectricityLeft();

            CollectionAssert.AreEqual(new[] { "Xiaomi", "Ninebot" }, result);
        }
        public void add_scooter_with_two_rides_and_then_get_everything()
        {
            int scooterId = EfMethods.AddScooter(
                "Ninebot"
                , 500                              //  electricity left
                , 2000                             // total electricity
                , MaintenanceState.NeedMaintenance // maintenance state
                );


            Customer alma = new Customer {
                Name = "Alma"
            };
            Customer oliver = new Customer {
                Name = "Oliver"
            };

            EfMethods.SetCurrentPosition(scooterId, 57.7, 11.9);

            EfMethods.AddRide(scooterId,
                              alma, // rented by
                              16,   // fee
                              16    // paid amount
                              );

            EfMethods.AddRide(scooterId,
                              oliver, // rented by
                              null,   // fee
                              null    // paid amount
                              );



            Scooter s2 = EfMethods.GetScooterById(scooterId);

            Assert.AreEqual("Ninebot", s2.Model.Name);
            Assert.AreEqual(500, s2.ElectricityLeft);
            Assert.AreEqual(MaintenanceState.NeedMaintenance, s2.MaintenanceState);
            Assert.AreEqual(57.7, s2.CurrentPosition.Latitude);
            Assert.AreEqual(11.9, s2.CurrentPosition.Longitude);

            Assert.AreEqual(2, s2.RideHistory.Count);
            Assert.AreEqual("Alma", s2.RideHistory[0].RentedBy.Name);
            Assert.AreEqual(16, s2.RideHistory[0].Fee);
            Assert.AreEqual(16, s2.RideHistory[0].PaidAmount);

            Assert.AreEqual("Oliver", s2.RideHistory[1].RentedBy.Name);
            Assert.AreEqual(null, s2.RideHistory[1].Fee);
            Assert.AreEqual(null, s2.RideHistory[1].PaidAmount);
        }