/// <summary> /// Initializes a new instance of the <see cref="CancelOrderPresenterTest" /> class. /// </summary> public CancelOrderPresenterTest() { this.view = Substitute.For<ICancelOrderView>(); this.orderProcessor = Substitute.For<VisitorOrderProcessorBase>(); this.orderManager = Substitute.For<VisitorOrderManager, IUserAware>(); this.httpContext = Substitute.For<HttpContextBase>(); new CancelOrderPresenter(this.view, this.orderManager, this.orderProcessor) { HttpContext = this.httpContext }; this.httpContext.Request.QueryString.Returns(new NameValueCollection { { "id", "yyy" }, { "user", "111" } }); this.order = new Order { OrderId = "yyy", BuyerCustomerParty = new CustomerParty { SupplierAssignedAccountID = "111" } }; this.orders = new Collection<Order> { this.order }.AsQueryable(); this.orderManager.GetAll().Returns(this.orders); }
/// <summary> /// Initializes a new instance of the <see cref="OrdersPresenterTest" /> class. /// </summary> public OrdersPresenterTest() { this.orderManager = Substitute.For<VisitorOrderManager, IUserAware>(); this.coreOrderManager = Substitute.For<SampleOrderManager>(Substitute.For<CoreOrderStateConfiguration>(), Substitute.For<Repository<Order>>()); var order1 = new Order { OrderId = "first", BuyerCustomerParty = new CustomerParty { SupplierAssignedAccountID = "111" } }; var order2 = new Order { OrderId = "second", BuyerCustomerParty = new CustomerParty { SupplierAssignedAccountID = "111" } }; this.orders = new Collection<Order> { order1, order2 }.AsQueryable(); this.orderManager.GetAll().Returns(this.orders); this.coreOrderManager.GetAllOrders(Arg.Any<Expression<Func<Order, bool>>>()).Returns(this.orders); this.view = Substitute.For<IOrdersView>(); this.httpContext = Substitute.For<HttpContextBase>(); new OrdersPresenter(this.view, this.orderManager, this.coreOrderManager) { HttpContext = this.httpContext }; this.httpContext.Request.QueryString.Returns(new NameValueCollection { { "user", "111" } }); }
/// <summary> /// Initializes a new instance of the <see cref="ProductDetailsPresenterTest" /> class. /// </summary> public ProductDetailsPresenterTest() { this.view = Substitute.For<IProductDetailsView>(); this.product = new Product { Code = "d3" }; this.productRepository = Substitute.For<IProductRepository>(); this.productRepository.Get<Product>("d3").Returns(this.product); this.priceManager = Substitute.For<IProductPriceManager>(); this.priceManager.GetProductTotals<Totals, Product, Currency>(this.product, null).Returns(new Totals { PriceExVat = 7.00m }); this.stockManager = Substitute.For<IProductStockManager>(); this.stockManager.GetStock(Arg.Is<ProductStockInfo>(p => p.ProductCode == "d3")).Returns(new Products.ProductStock { Code = "d3", Stock = 5 }); this.orderManager = Substitute.For<VisitorOrderManager>(); this.httpContext = Substitute.For<HttpContextBase>(); new ProductDetailsPresenter(this.view, this.productRepository, this.stockManager, this.priceManager, this.orderManager) { HttpContext = this.httpContext }; }