protected override void Establish_context() { var productRepository = ObjectFactory.GetInstance<ISaveObjectService<Product>>(); var orderRepository = ObjectFactory.GetInstance<ISaveObjectService<Order>>(); var product = new Product { Price = 10, IsActive = true, Name = "foo" }; productRepository.Create(product); _order = new Order { StateCode = "OH", Products = new List<Product> { product } }; orderRepository.Create(_order); _orderProcessor = ObjectFactory.GetInstance<IOrderProcessor>(); }
protected override void Establish_context() { base.Establish_context(); _product1 = new Product { ProductId = 1, Name = "one", Price = 1.11m }; _product2 = new Product { ProductId = 2, Name = "two", Price = 2.22m }; _mocker = new RhinoAutoMocker<OrderController>(); // stub the Session _session = new FakeHttpSession(); _mocker.Inject<IHttpSession>(_session); // available products _mocker.Get<IGetProductService>().Stub(s => s.GetAvailableProducts()) .Return(new[] { _product1, _product2, new Product {ProductId = 3, Name = "three", Price = 3.33m} }); }