コード例 #1
0
        public void ReturnInt_AttachCustomersCountIs5()
        {
            Item item = new Toy();

            item.Attach(new Customer("Josh"));
            item.Attach(new Customer("John"));
            item.Attach(new Customer("Ben"));
            item.Attach(new Customer("Jenna"));
            item.Attach(new Customer("Christine"));

            int result = item.CustomerCount;

            result.Should().Be(5);
        }
コード例 #2
0
        public void ReturnInt_AttachRemoveCustomersCountIs3()
        {
            Item     item      = new Toy();
            Customer Josh      = (Customer)item.Attach(new Customer("Josh"));
            Customer John      = (Customer)item.Attach(new Customer("John"));
            Customer Ben       = (Customer)item.Attach(new Customer("Ben"));
            Customer Jenna     = (Customer)item.Attach(new Customer("Jenna"));
            Customer Christine = (Customer)item.Attach(new Customer("Christine"));

            item.Detach(Josh);
            item.Detach(Jenna);

            int result = item.CustomerCount;

            result.Should().Be(3);
        }
コード例 #3
0
        public void ReturnDouble_ItemUpdatePriceIs20()
        {
            Item     item     = new Toy();
            Customer customer = new Customer("Josh");

            item.Attach(customer);
            item.Price = 20.0;
            double result = customer.Item.Price;

            result.Should().Be(20.0);
        }