Exemple #1
0
        public void Cats_Only_we_Have_No_Dogs()
        {
            FifoAnimalShelter Paws = new FifoAnimalShelter();
            Cat Spaceghost         = new Cat("Spaceghost", "cat");
            Cat Harry    = new Cat("Harry", "cat");
            Cat Lucipurr = new Cat("Lucipurr", "cat");
            Cat Ethel    = new Cat("Ethel", "cat");

            Paws.Enqueue(Spaceghost);
            Paws.Enqueue(Harry);
            Paws.Enqueue(Lucipurr);
            Paws.Enqueue(Ethel);
            Assert.Throws <ArgumentOutOfRangeException>(() => Paws.Dequeue("dog"));
        }
Exemple #2
0
        public void Can_Dequeue_The_First_Dog_In_The_Line()
        {
            FifoAnimalShelter Paws = new FifoAnimalShelter();
            Dog Pickles            = new Dog("Pickles", "dog");
            Cat Lucipurr           = new Cat("Lucipurr", "cat");
            Cat Ethel = new Cat("Ethel", "cat");
            Dog Apple = new Dog("Apple", "dog");

            Paws.Enqueue(Pickles);
            Paws.Enqueue(Lucipurr);
            Paws.Enqueue(Ethel);
            Paws.Enqueue(Apple);
            Animal result = Paws.Dequeue("dog");
            string name   = result.Name;

            Assert.Equal("Pickles", name);
        }