コード例 #1
0
        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();
            }
        }
コード例 #2
0
        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();
            }
        }
コード例 #3
0
 public TypeBikeService(BikeContext context)
 {
     _context = context;
 }
コード例 #4
0
 public CategoriesController(BikeContext context)
 {
     _context = context;
 }
コード例 #5
0
 public BicycleRepository(BikeContext context) : base(context)
 {
 }
コード例 #6
0
 public BikesController(BikeContext context)
 {
     _context = context;
 }
コード例 #7
0
 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
ファイル: OrdersController.cs プロジェクト: M-fekry/BikeShop
 public OrdersController(BikeContext context)
 {
     _context = context;
 }
コード例 #11
0
 public BikeReservationsController(BikeContext context)
 {
     _context = context;
 }
コード例 #12
0
 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;
 }
コード例 #17
0
 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();
 }