Exemplo n.º 1
0
        public void AddToy()
        {
            // Create a child
            int   id  = _book.AddChild("Terell");
            Child kid = _book.GetChild(id);

            // Add a toy for the child
            Toy toy = _register.Add("Silly Putty", kid);

            Assert.True(toy.id != 0);
        }
Exemplo n.º 2
0
        public static void DoAction(ToyRegister bag, ChildRegister book)
        {
            Console.Clear();
            Console.WriteLine("Choose child");

            List <Child> children = book.GetChildren();

            foreach (Child child in children)
            {
                Console.WriteLine($"{child.id}. {child.name}");
            }

            Console.Write("> ");
            string childName = Console.ReadLine();
            Child  kid       = book.GetChild(int.Parse(childName));

            Console.WriteLine("Enter toy");
            Console.Write("> ");
            string toyName = Console.ReadLine();

            bag.Add(toyName, kid);
        }
Exemplo n.º 3
0
        public static void Action(ToyRegister toyRegister, ChildrenRegister childRegister)
        {
            Console.Clear();
            Console.WriteLine("Choose a child");

            var children = childRegister.GetChildren();

            foreach (var child in children)
            {
                Console.WriteLine($"{child.Id}: {child.Name}");
            }

            Console.Write("> ");
            int childId = int.Parse(Console.ReadLine());

            var kid = childRegister.GetChild(childId);

            Console.WriteLine("Enter a toy");
            Console.Write("> ");
            string toyName = Console.ReadLine();

            toyRegister.Add(toyName, kid);
        }