public void CanReturnNullWhenDequeueDoesNotReturnAnimalFromShelter()
        {
            AnimalShelterQueue shelter = new AnimalShelterQueue();

            Node returnedNode = shelter.Dequeue("");

            Assert.Null(returnedNode);
        }
        public void ShelterCanReturnNullIfShelterIsEmptyUponDequeue()
        {
            AnimalShelterQueue shelter = new AnimalShelterQueue();

            Node returnedNode = shelter.Dequeue("");

            Assert.Null(returnedNode);
        }
        public void CanPeekAtFrontOfAnimalShelterQueue()
        {
            AnimalShelterQueue shelter = new AnimalShelterQueue();

            shelter.Enqueue(new Node(new Cat()));

            Node firstAnimalInShelter = shelter.Peek();

            Assert.Equal("cat", firstAnimalInShelter.Name);
        }
        public void AnimalShelterCanRemainEmptyIfDogOrCatNotInput(string userInput)
        {
            AnimalShelterQueue shelter = new AnimalShelterQueue();

            if (userInput == "cat")
            {
                shelter.Enqueue(new Node(new Cat()));
            }
            else if (userInput == "dog")
            {
                shelter.Enqueue(new Node(new Dog()));
            }

            Assert.Null(shelter.Front);
        }
        public void CanEnqueueDogAndDogObjectsIntoShelter(string newAnimal)
        {
            AnimalShelterQueue shelter = new AnimalShelterQueue();

            if (newAnimal == "cat")
            {
                shelter.Enqueue(new Node(new Cat()));
            }
            else
            {
                shelter.Enqueue(new Node(new Dog()));
            }

            Assert.Equal(newAnimal, shelter.Rear.Name);
        }
        public void CanDequeueAnimalFromShelter(string newAnimal)
        {
            AnimalShelterQueue shelter = new AnimalShelterQueue();

            if (newAnimal == "cat")
            {
                shelter.Enqueue(new Node(new Cat()));
            }
            else if (newAnimal == "dog")
            {
                shelter.Enqueue(new Node(new Dog()));
            }

            Node returnedNode = shelter.Dequeue("");

            Assert.Equal(newAnimal, returnedNode.Name);
        }
        public static void Main(string[] args)
        {
            // Declare placeholder variables - used later by various methods
            string menuSelection = "", newAnimalType = "", requestedAnimalType = "";
            Node   returnedAnimal = null;

            // Instantiate empty Queue
            AnimalShelterQueue shelter = new AnimalShelterQueue();

            // Loop until the user enters the "4" key to exit the application
            do
            {
                // Reset animal types to an empty string, so that no previously entered values remain
                newAnimalType       = "";
                requestedAnimalType = "";

                // Prompt user to select an option from the menu
                PrintMainMenu();
                menuSelection = Console.ReadLine();
                Console.Clear();

                switch (menuSelection)
                {
                case "1":     // Add an animal to the shelter
                    Console.WriteLine("What value you like the new Node to contain?");
                    newAnimalType = Console.ReadLine();

                    // Creates Cat/Dog objects and enqueues them onto the Queue
                    if (newAnimalType.ToLower() == "cat")
                    {
                        shelter.Enqueue(new Node(new Cat()));
                    }
                    else if (newAnimalType.ToLower() == "dog")
                    {
                        shelter.Enqueue(new Node(new Dog()));
                    }
                    else
                    {
                        Console.Clear();
                        Console.WriteLine("Sorry, you can only put dogs or cats into the shelter. Please try again.");
                    }

                    PromptToReturnToMainMenu();
                    break;

                case "2":     // Remove an animal from the shelter
                    Console.WriteLine("Which kind of animal would you like to take out of the shelter?");
                    requestedAnimalType = Console.ReadLine();
                    Console.Clear();

                    // Returns an Animal object Node if it exists within the Queue - removes the Node from the Queue
                    if (requestedAnimalType.ToLower() == "cat" || requestedAnimalType.ToLower() == "dog")
                    {
                        returnedAnimal = shelter.Dequeue(requestedAnimalType);

                        if (returnedAnimal != null)
                        {
                            Console.WriteLine(returnedAnimal.Name);
                        }
                        else
                        {
                            Console.WriteLine($"Sorry, we currently don't have any {requestedAnimalType}s in our shelter.");
                        }
                    }
                    else
                    {
                        Console.WriteLine("Sorry, we only allow dogs and cats in our shelter.");
                    }

                    PromptToReturnToMainMenu();
                    break;

                case "3":     // See which animals has been in the shelter the longest
                    returnedAnimal = shelter.Peek();

                    // Returns an Animal object Node if it exists within the Queue
                    if (returnedAnimal != null)
                    {
                        Console.WriteLine(returnedAnimal.Name);
                    }
                    else
                    {
                        Console.WriteLine("Sorry, we don't have any animals in our shelter.");
                    }

                    PromptToReturnToMainMenu();
                    break;

                case "4":     // Exits the Program
                    Environment.Exit(0);
                    break;

                default:     // Handles cases where user doesn't enter a valid menu option
                    Console.WriteLine("That did not match one of the menu options. Try again.\n");
                    break;
                }
            } while (menuSelection != "4");
        }