public void AddCallsAddFromRepository() { var testItem = CustomerObjectMother.CreateCustomer(1); CustomerService.Add(testItem); CustomerRepositoryMock.Verify(x => x.Add(testItem), Times.Once()); }
public void UpdateCallsUpdateFromRepository() { var customer = CustomerObjectMother.CreateCustomerWithNoId(); CustomerService.Add(customer); customer.Name = "New name"; CustomerService.Update(customer); CustomerRepositoryMock.Verify(x => x.Update(customer)); }
public void CheckAddAddressToCustomer() { // Arrange var customer = CustomerObjectMother.CreateCustomerWithNoAddress(); var address = CustomerObjectMother.CreateAddressWithCityWroclaw(1); customer.Address = address; // Assert Assert.IsTrue(customer.Address.City == "Wroclaw"); }
public void CheckSetCustomerEmail() { Mock <ICustomerRepository> repositoryMock = new Mock <ICustomerRepository>(); ShopService ss = new ShopService(repositoryMock.Object); var customer = CustomerObjectMother.CreateCustomerWithNoAddress(); string email = "*****@*****.**"; ss.SetCustomerEmail(customer, email); Assert.AreEqual(customer.Email, email); }
public void CheckSetCustomerAddress() { Mock <ICustomerRepository> repositoryMock = new Mock <ICustomerRepository>(); ShopService ss = new ShopService(repositoryMock.Object); var customer = CustomerObjectMother.CreateCustomerWithNoAddress(); string street = "Sliczna"; string city = "Wroclaw"; string state = "Lower Silesia"; string country = "Poland"; string zipCode = "50-363"; ss.SetCustomerAddress(customer, street, city, state, country, zipCode); Assert.AreEqual(customer.Address.Street, street); Assert.AreEqual(customer.Address.City, city); Assert.AreEqual(customer.Address.State, state); Assert.AreEqual(customer.Address.Country, country); Assert.AreEqual(customer.Address.ZipCode, zipCode); }