当前位置: 首页>>代码示例>>C#>>正文


C# ICustomerRepository类代码示例

本文整理汇总了C#中ICustomerRepository的典型用法代码示例。如果您正苦于以下问题:C# ICustomerRepository类的具体用法?C# ICustomerRepository怎么用?C# ICustomerRepository使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ICustomerRepository类属于命名空间,在下文中一共展示了ICustomerRepository类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Init

        public void Init()
        {
            Mock<ICustomerRepository<CustomerModel>> mockCustomerRepository = new Mock<ICustomerRepository<CustomerModel>>();
            Mock<IEngineerRepository<EngineerModel>> mockEngineerRepository = new Mock<IEngineerRepository<EngineerModel>>();
            Mock<IInstallationRepository<InstallationModel>> mockInstallationRepository = new Mock<IInstallationRepository<InstallationModel>>();

            List<EngineerModel> engineers = new List<EngineerModel>
            {
                new EngineerModel {engineerid=0, firstname="Karl", lastname="Maier", password="test123",email="[email protected]", username="karli"}
            };
            List<InstallationModel> installations = new List<InstallationModel>
            {
                new InstallationModel { installationid= 0, customerid=0, description="test", latitude=44, longitude=55, Measurement= new List<int>{0}, serialno="serial"}
            };
            List<CustomerModel> customers = new List<CustomerModel>
            {
                new CustomerModel { customerid=0, engineerid=0, firstname="Anton", lastname="Huber", password="test",email="[email protected]", username="toni", Installation=new List<int> {0}}
            };

            mockCustomerRepository.Setup(mr => mr.GetAll()).Returns(customers);
            mockCustomerRepository.Setup(mr => mr.GetById(It.IsAny<int>())).Returns((int customerid) => customers.Where(customer => customer.customerid == customerid).Single());
            mockCustomerRepository.Setup(mr => mr.Add(It.IsAny<CustomerModel>())).Callback((CustomerModel customer) => customers.Add(customer));
            mockInstallationRepository.Setup(mr => mr.GetByCustomerId(It.IsAny<int>())).Returns((int customerid) => installations.Where(installation => installation.customerid == customerid).ToList<InstallationModel>());
            mockInstallationRepository.Setup(mr => mr.Add(It.IsAny<InstallationModel>())).Callback((InstallationModel installation) => installations.Add(installation));
            mockInstallationRepository.Setup(mr => mr.GetAll()).Returns(installations);
            mockEngineerRepository.Setup(mr => mr.GetMyCustomers(It.IsAny<int>())).Returns((int id) => customers.Where(customer => customer.engineerid == id).ToList<CustomerModel>());

            this.mockcrepo = mockCustomerRepository.Object;
            this.mockirepo = mockInstallationRepository.Object;
            this.mockerepo = mockEngineerRepository.Object;
        }
开发者ID:daniel9992000,项目名称:bif5-sks-csharp,代码行数:31,代码来源:EngineerBLTest.cs

示例2: CartController

 public CartController(ICustomerRepository customerRepository,
     IProductRepository productRepository)
     : base(customerRepository)
 {
     _productRepository = productRepository;
     _customerRepository = customerRepository;
 }
开发者ID:JawariSanga,项目名称:Main,代码行数:7,代码来源:CartController.cs

示例3: VehicleEditorModel

 public VehicleEditorModel(ICustomerRepository customerRepository, IVehicleGroupRepository vehicleGroupRepository,
     IVehicleRepository vehicleRepository,
     IVehicleDetailRepository vehicleDetailRepository, IVehicleWheelRepository vehicleWheelRepository,
     ISparepartRepository sparepartRepository, ITypeRepository typeRepository,
     ISpecialSparepartDetailRepository wheelDetailRepository, IBrandRepository brandRepository,
     ISparepartDetailRepository sparepartDetailRepository,
     ISpecialSparepartDetailRepository specialSparepartDetailRepository,
     ISparepartStockCardRepository sparepartStokCardRepository,
     IReferenceRepository referenceRepository,
     IUnitOfWork unitOfWork)
     : base()
 {
     _customerRepository = customerRepository;
     _vehicleGroupRepository = vehicleGroupRepository;
     _vehicleRepository = vehicleRepository;
     _vehicleDetailRepository = vehicleDetailRepository;
     _vehicleWheelRepository = vehicleWheelRepository;
     _specialSparepartDetailRepository = wheelDetailRepository;
     _sparepartDetailRepository = sparepartDetailRepository;
     _sparepartRepository = sparepartRepository;
     _typeRepository = typeRepository;
     _brandRepository = brandRepository;
     _sparepartStokCardRepository = sparepartStokCardRepository;
     _referenceRepository = referenceRepository;
     _unitOfWork = unitOfWork;
 }
开发者ID:edwinsyarief,项目名称:Brawijaya-Workshop-Solution,代码行数:26,代码来源:VehicleEditorModel.cs

示例4: RentalAgreementService

		public RentalAgreementService(IRentalAgreementRepository theRentalAgreementRepository,
			ICustomerRepository theCustomerRepository, IUserRepository theUserRepository)
		{
			_rentalAgreementRepository = theRentalAgreementRepository;
			_customerRepository = theCustomerRepository;
			_userRepository = theUserRepository;
		}
开发者ID:gblosser,项目名称:FullStackReference,代码行数:7,代码来源:RentalAgreementService.cs

示例5: CostAnalyzerController

 /// <summary>
 /// 
 /// </summary>
 /// <param name="custRepo"></param>
 /// <param name="modifiedCustRepository"></param>
 /// <param name="vesselRepo"></param>
 public CostAnalyzerController(IRepository<customer> custRepo, ICustomerRepository modifiedCustRepository, IRepository<vessel> vesselRepo, ICostAnalyzerService costAnalyzerService)
 {
     this.customerRepository = custRepo;
     this.modifiedCustRepository = modifiedCustRepository;
     this.vesselRepository = vesselRepo;
     this.costAnalyzerService = costAnalyzerService;
 }
开发者ID:amodedude,项目名称:RTI-Web-Applicaotin,代码行数:13,代码来源:CostAnalyzerController.cs

示例6: GetCustomerRepo

        public static ICustomerRepository GetCustomerRepo()
        {
            if (customerRepo == null)
                customerRepo = new CustomerRepository();

            return customerRepo;
        }
开发者ID:mchambers,项目名称:Daremeto,代码行数:7,代码来源:RepoFactory.cs

示例7: IntegrationModule

        public IntegrationModule(ICustomerRepository customers, IClientRepository clients)
        {
            Get["/Integration/ClientCustomerContracts/All"] = param =>
            {
                var result = new List<IntegrationClientDto>();
                var clientContracts = clients.ToList().Select(
                    s =>
                        new IntegrationClientDto(s.Id, s.Name, s.ClientAccountNumber.ToString(), s.IsActive,
                            s.Contracts
                                .Select(c => new IntegrationContractDto(c.Id, c.Name, c.Packages
                                    .Select(p => new PackageDto() {PackageId = p.PackageId, Name = p.Name, IsActive = p.IsActive}))))).ToList();

                result.AddRange(clientContracts.Where(w => w.Contracts.Any()));

                var customerContracts = customers.ToList().Select(
                    s =>
                        new IntegrationClientDto(s.Id, s.Name, s.CustomerAccountNumber.ToString(), s.IsActive,
                            s.Contracts.Select(c => new IntegrationContractDto(c.Id, c.Name, c.Packages
                                .Select(p => new PackageDto() { Id = p.Id, PackageId = p.PackageId, Name = p.Name, IsActive = p.IsActive}))))).ToList();

                result.AddRange(customerContracts.Where(w => w.Contracts.Any()));

                return Response.AsJson(result);
            };
        }
开发者ID:rjonker1,项目名称:lightstone-data-platform,代码行数:25,代码来源:IntegrationModule.cs

示例8: BeforeEach

        public void BeforeEach()
        {
            _productRepo = Substitute.For<IProductRepository>();
            _orderFulfillmentService = Substitute.For<IOrderFulfillmentService>();
            _customerRepository = Substitute.For<ICustomerRepository>();
            _taxRateService = Substitute.For<ITaxRateService>();
            _emailService = Substitute.For<IEmailService>();

            _subject = new OrderService(_orderFulfillmentService,
                _customerRepository,
                _taxRateService,
                _emailService);

            _bestCustomer = new Customer
            {
                CustomerId = 42,
                PostalCode = "12345",
                Country = "Merica"
            };

            _listOfTaxEntries = new List<TaxEntry>
            {
                new TaxEntry {Description = "High Tax", Rate = (decimal) 0.60},
                new TaxEntry {Description = "Low Tax", Rate = (decimal) 0.10}
            };

            _orderConfirmation = new OrderConfirmation
            {
                OrderId = 1234,
                OrderNumber = "hello"
            };
            _customerRepository.Get(_bestCustomer.CustomerId.Value).Returns(_bestCustomer);
            _taxRateService.GetTaxEntries(_bestCustomer.PostalCode, _bestCustomer.Country).Returns(_listOfTaxEntries);
        }
开发者ID:brntsllvn,项目名称:OrderEntryMockingPracticeOLD,代码行数:34,代码来源:OrderServiceTests.cs

示例9: CustomerService

 public CustomerService(ICustomerRepository customerRepository, IUnitOfWork unitOfWork)
 {
     if (customerRepository == null) throw new ArgumentNullException("Customer repo");
     if (unitOfWork == null) throw new ArgumentNullException("Unit of work");
     _customerRepository = customerRepository;
     _unitOfWork = unitOfWork;
 }
开发者ID:cleancodenz,项目名称:MVC4DEV,代码行数:7,代码来源:CustomerService.cs

示例10: CustomerService

 public CustomerService(
     ICustomerRepository customerRepository, 
     ICustomerFullNameBuilder customerFullName)
 {
     _customerRepository = customerRepository;
     _customerFullName = customerFullName;
 }
开发者ID:exploitx3,项目名称:HighQualityCode,代码行数:7,代码来源:CustomerService.cs

示例11: UserService

 public UserService(IUserAccountRepository userAccountRepository, ICustomerRepository customerRepository, IUserRoleRepository userRoleRepository, IRoleRepository roleRepository)
 {
     _customerRepository = customerRepository;
     _userRoleRepository = userRoleRepository;
     _roleRepository = roleRepository;
     _userAccountRepository = userAccountRepository;
 }
开发者ID:ngnono,项目名称:NG.FM,代码行数:7,代码来源:UserService.cs

示例12: CustomerService_9

        public CustomerService_9(ICustomerRepository customerRepository, IMailingRepository mailingRepository)
        {
            _customerRepository = customerRepository;
            _mailingRepository = mailingRepository;

            _customerRepository.NotifySalesTeam += _customerRepository_NotifySalesTeam;
        }
开发者ID:mkhodary,项目名称:Mocking_Samples_With_Moq,代码行数:7,代码来源:9_Events.cs

示例13: CustomerService

 public CustomerService(
     ICustomerRepository customerRepository, 
     IIdFactory idFactory)
 {
     _customerRepository = customerRepository;
     _idFactory = idFactory;
 }
开发者ID:exploitx3,项目名称:HighQualityCode,代码行数:7,代码来源:CustomerService.cs

示例14: OrderController

 public OrderController(ICustomerRepository customerRepository,
     IOrderRepository orderRepository)
     : base(customerRepository)
 {
     _orderRepository = orderRepository;
     _customerRepository = customerRepository;
 }
开发者ID:RayLiu1106,项目名称:TailspinDemo,代码行数:7,代码来源:OrderController.cs

示例15: CustomerFacade

 public CustomerFacade(ICustomerRepository customerRepository, IAddressRepository addressRepository, IAuth auth, IPasswordHandler passwordHandler)
 {
     _customerRepository = customerRepository;
     _addressRepository = addressRepository;
     _auth = auth;
     _passwordHandler = passwordHandler;
 }
开发者ID:SamoZabo,项目名称:NackademiskaAuction,代码行数:7,代码来源:CustomerFacade.cs


注:本文中的ICustomerRepository类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。