public void TestNewCustomerIsAdded() { var repos = new CustomerRepository(new FakeCustomerModule()); var target = new AllCustomersViewModel(repos); Assert.AreEqual(3, target.AllCustomers.Count, "Test data includes three customers"); repos.AddCustomer(Customer.CreateCustomer(123.45, "new", "customer", false, "*****@*****.**")); Assert.AreEqual(4, target.AllCustomers.Count, "Adding a customer to the repository increase the Count"); }
public void TestNewCustomerIsAdded() { CustomerRepository repos = new CustomerRepository(Constants.CUSTOMER_DATA_FILE); AllCustomersViewModel target = new AllCustomersViewModel(repos); Assert.AreEqual(3, target.AllCustomers.Count, "Test data includes three customers"); repos.AddCustomer(Customer.CreateCustomer(123.45, "new", "customer", false, "*****@*****.**")); Assert.AreEqual(4, target.AllCustomers.Count, "Adding a customer to the repository increase the Count"); }
public void TestNewCustomerIsAddedProperly() { CustomerRepository target = new CustomerRepository(Constants.CUSTOMER_DATA_FILE); Customer cust = Customer.CreateNewCustomer(); bool eventArgIsValid = false; target.CustomerAdded += (sender, e) => eventArgIsValid = (e.NewCustomer == cust); target.AddCustomer(cust); Assert.IsTrue(eventArgIsValid, "Invalid NewCustomer property"); Assert.IsTrue(target.ContainsCustomer(cust), "New customer was not added"); }
public void TestNewCustomerIsAddedProperly() { var target = new CustomerRepository(new FakeCustomerModule()); Customer cust = Customer.CreateNewCustomer(); bool eventArgIsValid = false; target.CustomerAdded += (sender, e) => eventArgIsValid = (e.NewItem == cust); target.AddCustomer(cust); Assert.IsTrue(eventArgIsValid, "Invalid NewCustomer property"); Assert.IsTrue(target.ContainsCustomer(cust), "New customer was not added"); }