public void TestDeleteCustomer()
        {
            //Anlegen des Customers
            CustomerPoco customerPoco = new CustomerPoco
            {
                Birthday    = DateTime.Parse("2018/06/24"),
                Firstname   = "Philipp",
                Lastname    = "Mustermanntest",
                Gender      = "männlich",
                Housenumber = 24,
                Street      = "Marktplatz",
                ZipCode     = 4310,
                Town        = "Mauthausen"
            };

            //Einfügen
            this.rentalController.CreateNewCustomer(customerPoco);

            BikeContext context  = new BikeContext();
            Customer    customer = context.Customers.Last();

            //Löschen
            this.rentalController.DeleteCustomer(customer.CustomerId);

            //Selektiern
            Customer selectCustomer = this.rentalController.GetAllCustomers(customerPoco.Lastname).Find(c => c.CustomerId == customer.CustomerId);

            //Nachschauen
            if (selectCustomer != null)
            {
                Assert.Fail();
            }
        }
        public void TestCreateRental()
        {
            BikePoco bikePoco = new BikePoco
            {
                Brand               = "KTM",
                Category            = "Sport Bike",
                DateOfLastService   = DateTime.Parse("2018/01/20"),
                PriceFirstHour      = 3,
                PriceAdditionalHour = 5,
                PurchaseDate        = DateTime.Now
            };

            this.rentalController.CreateNewBike(bikePoco);

            CustomerPoco customerPoco = new CustomerPoco
            {
                Birthday    = DateTime.Parse("2018/06/24"),
                Firstname   = "Philipp",
                Lastname    = "CreateCustomerTest",
                Gender      = "männlich",
                Housenumber = 24,
                Street      = "Marktplatz",
                ZipCode     = 4310,
                Town        = "Mauthausen"
            };

            this.rentalController.CreateNewCustomer(customerPoco);

            BikeContext context = new BikeContext();

            Bike     bike     = context.Bikes.Last();
            Customer customer = context.Customers.Last();
            Rental   rental   = new Rental
            {
                Bike        = bike,
                Customer    = customer,
                Paid        = false,
                RentalBegin = DateTime.Parse("24.06.1999 10:00:00"),
                RentalEnd   = DateTime.Parse("24.06.1999 11:00:00"),
                TotalPrice  = 0
            };

            context.Add(rental);
            context.SaveChanges();

            Rental selectRental = this.rentalController.GetAllRentalsByCustomerId(customer.CustomerId).Find(r => r.Customer.CustomerId == customer.CustomerId);

            if (selectRental == null)
            {
                Assert.Fail();
            }
        }
 public TypeBikeService(BikeContext context)
 {
     _context = context;
 }
示例#4
0
 public CategoriesController(BikeContext context)
 {
     _context = context;
 }
 public BicycleRepository(BikeContext context) : base(context)
 {
 }
示例#6
0
 public BikesController(BikeContext context)
 {
     _context = context;
 }
 public ManufacturerRepository(BikeContext context) : base(context)
 {
     this.db = context;
 }
示例#8
0
 public ProductsController(BikeContext context)
 {
     _context = context;
 }
 public RentalsController(BikeContext context)
 {
     this.context = context;
 }
示例#10
0
 public OrdersController(BikeContext context)
 {
     _context = context;
 }
示例#11
0
 public BikeReservationsController(BikeContext context)
 {
     _context = context;
 }
 public BikeLocationsController(BikeContext context)
 {
     _context = context;
 }
示例#13
0
 public BikeController(IBikeService bikeService, BikeContext context)
 {
     _bikeService = bikeService;
     _context     = context;
 }
 public CustomerController(ILogger <CustomerController> logger, BikeContext context)
 {
     _logger      = logger;
     _context     = context;
     genderParser = new GenderParser();
 }
示例#15
0
 public RentalDataAccess()
 {
     this.bikeContext = new BikeContext();
 }
示例#16
0
 public BikeService(BikeContext bikeContext)
 {
     _bikeContext = bikeContext;
 }
 public TypeBikeController(ITypeBikeService typeBikeService, BikeContext context)
 {
     _typeBikeService = typeBikeService;
     _context         = context;
 }
 public CustomersController(BikeContext context)
 {
     this.context = context;
 }
示例#19
0
 public StatusController(BikeContext context, OrderContext Secondcontext)
 {
     _context       = context;
     second_context = Secondcontext;
 }
 public RentalsController(BikeContext context)
 {
     _context             = context;
     rentalCostCalculator = new RentalCostCalculator();
 }