using System; using System.Collections.Generic; using System.Linq; using System.Text; using HeuristicLab.Services.Optimization.Billing.Interfaces; namespace HeuristicLab.Services.Optimization.Billing { public class MockupOptimizationBilling : IOptimizationBilling { private static IList products; private static IDictionary> userToOrders; private static IList allOrders; static MockupOptimizationBilling() { products = new List(); products.Add(new Model.Product() { Name = "Optimization-as-a-Service - Experiment execution", Description = "Create and run your experiments within HeuristicLab Hive", Id = 1, Price = 10.0, ProductType = "Optimization Service" }); products.Add(new Model.Product() { Name = "Whatever-o-matic - Experiment execution", Description = "Another fine product", Id = 2, Price = 100.0, ProductType = "Product" }); userToOrders = new Dictionary>(); allOrders = new List(); } public IList GetProducts() { return products; } public void SaveOrder(Model.Order order) { IList orders; if (!userToOrders.TryGetValue(order.User.Name, out orders)) { userToOrders[order.User.Name] = orders = new List(); } orders.Add(order); allOrders.Add(order); } public IList GetOrdersByState(Model.OrderState state) { return (from o in allOrders where o.State == state select o).ToList(); } } }