public override void FeatureActivated(SPFeatureReceiverProperties properties)
        {
            var web = properties.Feature.Parent as SPWeb;

            using (var webPartManager = web.GetLimitedWebPartManager("Default.aspx", System.Web.UI.WebControls.WebParts.PersonalizationScope.Shared))
            {
                var salesOrderWebPart = new SalesOrderWebPart();
                salesOrderWebPart.Title = "Sales Order";
                webPartManager.AddWebPart(salesOrderWebPart, "Left", 0);
            }
        }
        public void SetUp()
        {
            shimsContext = ShimsContext.Create();

            ICustomerRepository customerRepository = new InMemoryCustomerRepository();

            customerRepository.Add(new Customer {
                CustomerId = 0, Name = "Customer 1"
            });
            customerRepository.Add(new Customer {
                CustomerId = 1, Name = "Customer 2"
            });
            customerRepository.Add(new Customer {
                CustomerId = 2, Name = "Customer 3"
            });

            ISalesOrderRepository salesOrderRepository = new InMemorySalesOrderRepository();

            salesOrderRepository.Add(new SalesOrder {
                Customer = new Customer {
                    CustomerId = 0, Name = "Customer 1"
                }, SalesOrderId = 0, Lines = new List <OrderLine> {
                    new OrderLine {
                        Price = 5, Quantity = 5
                    }
                }
            });

            webPart = new SalesOrderWebPart();
            var page = new ShimPage()
            {
                IsPostBackGet = () => { return(false); }
            };

            page.BehaveAsDefaultValue();

            var molesWebPart = new ShimControl((Control)webPart)
            {
                PageGet = () => { return(page); }
            };

            webPart.Inject(customerRepository, salesOrderRepository);
        }