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


C# CustomerRepository.Get方法代码示例

本文整理汇总了C#中CustomerRepository.Get方法的典型用法代码示例。如果您正苦于以下问题:C# CustomerRepository.Get方法的具体用法?C# CustomerRepository.Get怎么用?C# CustomerRepository.Get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CustomerRepository的用法示例。


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

示例1: BankAccountRepositoryAddNewItemSaveItem

        public void BankAccountRepositoryAddNewItemSaveItem()
        {
            //Arrange
            var unitOfWork = new MainBCUnitOfWork();
            var customerRepository = new CustomerRepository(unitOfWork);
            var bankAccountRepository = new BankAccountRepository(unitOfWork);
           
            var customer = customerRepository.Get(new Guid("43A38AC8-EAA9-4DF0-981F-2685882C7C45"));
            
            var bankAccountNumber = new BankAccountNumber("1111", "2222", "3333333333", "01");

            var newBankAccount = BankAccountFactory.CreateBankAccount(customer,bankAccountNumber);
            

            //Act
            bankAccountRepository.Add(newBankAccount);

            try
            {
                unitOfWork.Commit();
            }
            catch (DbUpdateException ex)
            {
                var entry = ex.Entries.First();
            }
        }
开发者ID:ljvblfz,项目名称:MicrosoftNLayerApp,代码行数:26,代码来源:BankAccountRepositoryTests.cs

示例2: CustomerRepositoryAddNewItemSaveItem

        public void CustomerRepositoryAddNewItemSaveItem()
        {
            //Arrange
            var unitOfWork = new MainBCUnitOfWork();
            ICustomerRepository customerRepository = new CustomerRepository(unitOfWork);

            var countryId = new Guid("32BB805F-40A4-4C37-AA96-B7945C8C385C");

            var customer = CustomerFactory.CreateCustomer("Felix", "Trend", countryId, new Address("city", "zipCode", "addressLine1", "addressLine2"));
            customer.Id = IdentityGenerator.NewSequentialGuid();

            customer.Picture = new Picture()
            {
                Id = customer.Id
            };

            //Act

            customerRepository.Add(customer);
            customerRepository.UnitOfWork.Commit();

            //Assert

            var result = customerRepository.Get(customer.Id);

            Assert.IsNotNull(result);
            Assert.IsTrue(result.Id == customer.Id);
        }
开发者ID:gabrielsimas,项目名称:MicrosoftNLayerApp,代码行数:28,代码来源:CustomerRepositoryTests.cs

示例3: CustomerRepositoryGetMethodReturnNullWhenIdIsEmpty

        public void CustomerRepositoryGetMethodReturnNullWhenIdIsEmpty()
        {
            //Arrange
            var unitOfWork = new MainBCUnitOfWork();
            var customerRepository = new CustomerRepository(unitOfWork);

            //Act
            var customer = customerRepository.Get(Guid.Empty);

            //Assert
            Assert.IsNull(customer);
        }
开发者ID:ljvblfz,项目名称:MicrosoftNLayerApp,代码行数:12,代码来源:CustomerRepositoryTests.cs

示例4: CustomerRepositoryGetMethodReturnCustomerWithPicture

      public void CustomerRepositoryGetMethodReturnCustomerWithPicture()
      {
         //Arrange
         var unitOfWork = new MainBcUnitOfWork();
         var customerRepository = new CustomerRepository(unitOfWork);

         var customerId = new Guid("43A38AC8-EAA9-4DF0-981F-2685882C7C45");

         //Act
         var customer = customerRepository.Get(customerId);

         //Assert
         Assert.IsNotNull(customer);
         Assert.IsNotNull(customer.Picture);
         Assert.IsTrue(customer.Id == customerId);
      }
开发者ID:MyLobin,项目名称:NLayerAppV2,代码行数:16,代码来源:CustomerRepositoryTests.cs

示例5: OrderRepositoryAddNewItemSaveItem

        public void OrderRepositoryAddNewItemSaveItem()
        {
            //Arrange
            var unitOfWork = new MainBCUnitOfWork();

            var customerRepository = new CustomerRepository(unitOfWork);
            var orderRepository = new OrderRepository(unitOfWork);

            var customer = customerRepository.Get(new Guid("0CD6618A-9C8E-4D79-9C6B-4AA69CF18AE6"));

            var order = OrderFactory.CreateOrder(customer, "shipping name", "shipping city", "shipping address", "shipping zip code");
            order.GenerateNewIdentity();

            //Act
            orderRepository.Add(order);
            unitOfWork.Commit();
        }
开发者ID:ljvblfz,项目名称:MicrosoftNLayerApp,代码行数:17,代码来源:OrderRepositoryTests.cs

示例6: BankAccountRepositoryRemoveItemDeleteIt

      public void BankAccountRepositoryRemoveItemDeleteIt()
      {
         //Arrange
         var unitOfWork = new MainBcUnitOfWork();
         var customerRepository = new CustomerRepository(unitOfWork);
         var bankAccountRepository = new BankAccountRepository(unitOfWork);

         var customer = customerRepository.Get(new Guid("43A38AC8-EAA9-4DF0-981F-2685882C7C45"));

         var bankAccountNumber = new BankAccountNumber("4444", "5555", "3333333333", "02");

         var newBankAccount = BankAccountFactory.CreateBankAccount(customer, bankAccountNumber);

         bankAccountRepository.Add(newBankAccount);
         unitOfWork.Commit();

         //Act
         bankAccountRepository.Remove(newBankAccount);
         unitOfWork.Commit();

      }
开发者ID:MyLobin,项目名称:NLayerAppV2,代码行数:21,代码来源:BankAccountRepositoryTests.cs

示例7: CustomerRepositoryRemoveItemDeleteIt

        public void CustomerRepositoryRemoveItemDeleteIt()
        {
            //Arrange
            var unitOfWork = new MainBCUnitOfWork();
            var customerRepository = new CustomerRepository(unitOfWork);

            var country = new Country("Spain","es-ES");
            country.ChangeCurrentIdentity(new Guid("32BB805F-40A4-4C37-AA96-B7945C8C385C"));

            

            var address =  new Address("city", "zipCode", "addressline1", "addressline2");

            var customer = CustomerFactory.CreateCustomer("Frank", "Frank","+3444","company", country,address);
            customer.SetTheCountryReference(country.Id);
            
            customerRepository.Add(customer);
            unitOfWork.Commit();

            //Act
            customerRepository.Remove(customer);
            unitOfWork.Commit();

            var result = customerRepository.Get(customer.Id);

            //Assert
            Assert.IsNull(result);
        }
开发者ID:ljvblfz,项目名称:MicrosoftNLayerApp,代码行数:28,代码来源:CustomerRepositoryTests.cs


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