本文整理汇总了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();
}
}
示例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);
}
示例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);
}
示例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);
}
示例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();
}
示例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();
}
示例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);
}