Beispiel #1
0
 public QuotesPageViewModel(IQuotes quotes, INavigationService navigationService)
 {
     _quotes           = quotes;
     QuotesCollection  = new ObservableCollection <Quote>();
     NavigationService = navigationService;
     LoadQuotes();
 }
    public SaveQuoteCommandHandlerTests()
    {
        _customers  = NSubstitute.Substitute.For <ICustomers>();
        _products   = NSubstitute.Substitute.For <IProducts>();
        _quotes     = NSubstitute.Substitute.For <IQuotes>();
        _unitOfWork = NSubstitute.Substitute.For <IEcommerceUnitOfWork>();

        _unitOfWork.Customers.ReturnsForAnyArgs(_customers);
        _unitOfWork.Products.ReturnsForAnyArgs(_products);
        _unitOfWork.Quotes.ReturnsForAnyArgs(_quotes);
    }
    public PlaceOrderCommandHandlerTests()
    {
        _customers         = NSubstitute.Substitute.For <ICustomers>();
        _products          = NSubstitute.Substitute.For <IProducts>();
        _quotes            = NSubstitute.Substitute.For <IQuotes>();
        _currencyConverter = Substitute.For <ICurrencyConverter>();
        _unitOfWork        = NSubstitute.Substitute.For <IEcommerceUnitOfWork>();

        _unitOfWork.Customers.ReturnsForAnyArgs(_customers);
        _unitOfWork.Products.ReturnsForAnyArgs(_products);
        _unitOfWork.Quotes.ReturnsForAnyArgs(_quotes);
    }
Beispiel #4
0
    public EcommerceUnitOfWork(EcommerceDDDContext dbContext,
                               ICustomers customers,
                               IOrders orders,
                               IStoredEvents storedEvents,
                               IProducts products,
                               IPayments payments,
                               IQuotes quotes,
                               IEventSerializer eventSerializer) : base(dbContext)
    {
        Customers    = customers ?? throw new ArgumentNullException(nameof(customers));
        Orders       = orders ?? throw new ArgumentNullException(nameof(orders));
        StoredEvents = storedEvents ?? throw new ArgumentNullException(nameof(storedEvents));
        Products     = products ?? throw new ArgumentNullException(nameof(products));
        Quotes       = quotes ?? throw new ArgumentNullException(nameof(quotes));
        Payments     = payments ?? throw new ArgumentNullException(nameof(payments));

        _eventSerializer = eventSerializer ?? throw new ArgumentNullException(nameof(eventSerializer));
    }
        private static void DoTimings(string endpointName)
        {
            using (ChannelFactory <IQuotes> quotesFactory = new ChannelFactory <IQuotes>(endpointName))
            {
                IQuotes   proxy = quotesFactory.CreateChannel();
                Stopwatch watch = new Stopwatch();

                // Warmup
                proxy.FindAllStockSymbols();

                watch.Start();
                for (int i = 0; i < ITERAITONS; i++)
                {
                    proxy.FindCurrentQuote("MSFT");
                }

                watch.Stop();

                double time           = watch.Elapsed.TotalSeconds / ITERAITONS;
                int    callsPerSecond = (int)(1 / time);
                Console.WriteLine($"Enpoint '{endpointName}': time/call={time} / calls/Second={callsPerSecond}");
            }
        }
 public QuotesViewModel(IQuotes quoteObject)
 {
     Quotes        = new ObservableCollection <Quote>();
     quoteInstance = quoteObject;
     LoadQuotes();
 }
Beispiel #7
0
 public QuotesViewModel(IQuotes quotes)
 {
     Quotes  = new ObservableCollection <Quote>();
     _quotes = quotes;
     LoadQuotes();
 }