public static void BuyShirt() { List <IVariationStrategy> variationStrategies = new List <IVariationStrategy>() { new ColorVariation(), new FabricVariation(), new SizeVariation() }; Color color = ChooseVariation <Color>(); Size size = ChooseVariation <Size>(); Fabric fabric = ChooseVariation <Fabric>(); Tshirt shirt = new Tshirt(color, size, fabric); Console.WriteLine(); Console.ForegroundColor = ConsoleColor.Cyan; Console.WriteLine($"Your order is a {color}, {fabric}, {size} t-shirt"); Console.ForegroundColor = ConsoleColor.White; Console.WriteLine(); EshopContext eshop = new EshopContext(); eshop.SetVariationStrategy(variationStrategies); // Payment Method PaymentMethod paymentMethod = ChoosePaymentMethod(); eshop.SelectPaymentMethod(paymentMethod); eshop.TotalCostShirt(shirt); tshirts.Add(shirt); }
public void AddProdukt() { var options = new DbContextOptionsBuilder <EshopContext>() .UseInMemoryDatabase(databaseName: "Add_writes_to_database") .Options; // Insert seed data into the database using one instance of the context using (var context = new EshopContext(options)) { context.Produkter.Add(new Produkt { Navn = "Test", Pris = 1243 }); context.Produkter.Add(new Produkt { Navn = "Test 2", Pris = 1243 }); context.Produkter.Add(new Produkt { Navn = "Test 3", Pris = 1243 }); context.SaveChanges(); } // Use a clean instance of the context to run the test using (var context = new EshopContext(options)) { var service = new ProduktService(context); var result = service.AddProdukt(); Assert.AreEqual(3, result.Count()); } }
public RepositoryUser(EshopContext context) : base(context) { }
public RepositoryOrderHistory(EshopContext context) : base(context) { }
public RepositoryFileStorage(EshopContext context) : base(context) { }
public ProduktService(EshopContext context) { _context = context; }
public ProductsController(EshopContext context) { _context = context; }
public CaracteristiquesController(EshopContext context) { _context = context; }
public ProduktFilterDropdownService(EshopContext context) { _context = context; }
public RepositoryProduct(EshopContext context) : base(context) { }
public UnitOfWork(EshopContext db) { _db = db; }
public CategoriesController(EshopContext context) { _context = context; }
public ProductServices(EshopContext context) { _context = context; }
public RepositoryCategory(EshopContext context) : base(context) { }
public Repository(EshopContext context) { this.context = context; DbSet = context.Set <T>(); }
public CustomerRepositoryCommand(EshopContext db) { _db = db; }
public RepositoryAddress(EshopContext context) : base(context) { }
public PubImagesController(EshopContext context) { _context = context; }
public OrderServices(EshopContext context) { _context = context; }
public RepositoryPage(EshopContext context) : base(context) { }
public RepositoryDeliveryPayment(EshopContext context) : base(context) { }
public RepositoryGallery(EshopContext context) : base(context) { }
public ItemServices(EshopContext context) { _context = context; }
public AppUserController(EshopContext context) { _context = context; }
public ImagesController(EshopContext context) { _context = context ?? throw new Exception(); }