コード例 #1
0
        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");
        }
コード例 #2
0
        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");
        }