Exemplo n.º 1
0
 public RetailsController(
     IRetailRepository retailRepository,
     IGroupRepository groupRepository,
     IEventLog eventLog)
 {
     _retailRepository = retailRepository;
     _eventLog         = eventLog;
     _groupRepository  = groupRepository;
 }
        public void Setup()
        {
            _mockrepo = new MockRepository();

            #region Creation of static data
            //List of users in system

            _usersList = new List<User>();
            //Creating Employees
            _usersList.Add(new Employee() { Id = 1, FirstName = "Neeraj", LastName = "Kaushik", CreationDate = DateTime.Now, Dept = DepartmentType.Admin, Address = "New Delhi" });
            //Creating Customers
            _usersList.Add(new Affiliate() { Id = 2, FirstName = "Martin", LastName = "Buhl", CreationDate = DateTime.Now, Address = "France" });
            //Creating Affiliate old >2 yrs
            _usersList.Add(new Customer() { Id = 3, FirstName = "Karla", LastName = "Ball", CreationDate = new DateTime(2008, 3, 1), Address = "New York" });
            //Creating Affiliate
            _usersList.Add(new Customer() { Id = 4, FirstName = "Niels", LastName = "Kloster", CreationDate = DateTime.Now, Address = "Chicago" });
            //Creating Affiliate wi
            _usersList.Add(new Employee() { Id = 5, FirstName = "Niels", LastName = "Kloster", CreationDate = new DateTime(2006, 3, 1), Address = "Chicago" });

            //Discount List
            _discountList = new List<Discount>();

            _discountList.Add(new Discount() { Usertype = UserType.Employee, DiscountType = DiscountType.Percentage, Id = 1, DiscountValue = 30 });
            _discountList.Add(new Discount() { Usertype = UserType.Affiliate, DiscountType = DiscountType.Percentage, Id = 2, DiscountValue = 10 });

            #endregion

            _repository = _mockrepo.CreateMock<IRetailRepository>();

            Expect.Call(_repository.GetUsers()).Return(_usersList);
            Expect.Call(_repository.GetDiscounts()).Return(_discountList);
            Expect.Call(_repository.GetDiscountOnTotalBill()).Return(5);//5%
            Expect.Call(_repository.GetDiscountForOldCustomer()).Return(10);//5%

            _mockrepo.ReplayAll();
        }
 public OrderManagement(IRetailRepository repo)
 {
     _repo = repo;
     PopulateStaticData();
 }
Exemplo n.º 4
0
 public InitController(IRetailRepository retailRepository,
                       IGroupRepository groupRepository)
 {
     _retailRepository = retailRepository;
     _groupRepository  = groupRepository;
 }
Exemplo n.º 5
0
 public RetailService(IRetailRepository repository)
 {
     _repository = repository;
 }