コード例 #1
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);
        }
コード例 #2
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);
        }
コード例 #3
0
 public void TearDown()
 {
     InMemoryCustomerRepository.Reset();
     InMemorySalesOrderRepository.Reset();
     shimsContext.Dispose();
 }