public void AddSameNameTwice_Throws_NameTakenException()
        {
            var tank = new Tank();

            tank.AddFish(_goldFish);

            Assert.Throws <DuplicateNameException>(() => tank.AddFish(_goldFish));
        }
Exemplo n.º 2
0
        public void AddTwoFishToTank()
        {
            var tank = new Tank();

            tank.AddFish(goldFish);
            tank.AddFish(angelFish);
            Assert.AreEqual(2, tank.fishList.Count);
        }
        public void AddingMultipleFishToTank_Returns_CorrectCount()
        {
            var tank = new Tank();

            tank.AddFish(_goldFish);
            tank.AddFish(_angelFish);
            Assert.AreEqual(2, tank.Fish.Count);
        }
Exemplo n.º 4
0
        public void CanAddMultipleFishToTank()
        {
            var tank = new Tank();

            tank.AddFish(goldFish);
            tank.AddFish(angelFish);

            Assert.AreEqual(2, tank.Fish.Count);
        }
Exemplo n.º 5
0
        public void FullTank()
        {
            Tank fishTank = new Tank();

            fishTank.AddFish(new Angel("Angel name"));
            fishTank.AddFish(new Gold("Gold name"));
            fishTank.AddFish(new Babel("Babel name"));

            Assert.AreEqual(3, fishTank.Fish.Count);
            Assert.AreEqual(0.1 + 0.2 + 0.3, fishTank.Feed());
        }
        public void GetNames_Returns_CommaSeparatedStringOfNames()
        {
            var tank = new Tank();

            tank.AddFish(_goldFish);
            tank.AddFish(_angelFish);
            tank.AddFish(_babelFish);
            const string expected = "gold, angel, babel";

            Assert.AreEqual(expected, tank.GetNames());
        }
        public void FeedingDifferentTypesOfFish_Returns_CorrectAmount()
        {
            var tank = new Tank();

            tank.AddFish(_goldFish);
            tank.AddFish(_angelFish);
            tank.AddFish(_babelFish);
            const double expectedWeightOfFood = 0.1 + 0.2 + 0.3;

            Assert.AreEqual(expectedWeightOfFood, tank.Feed());
        }
Exemplo n.º 8
0
        public void TestAllFishFeed()
        {
            var tank = new Tank();

            tank.AddFish(babelFish);
            tank.AddFish(angelFish);
            tank.AddFish(goldFish);

            double expectedResult = 0.3 + 0.2 + 0.1;

            Assert.AreEqual(expectedResult, tank.Feed());
        }
Exemplo n.º 9
0
        public void TankFeedReturnsCorrectValue()
        {
            var tank = new Tank();

            tank.AddFish(goldFish);
            tank.AddFish(angelFish);
            tank.AddFish(babelFish);

            var    feed           = tank.Feed();
            double expectedResult = 0.1 + 0.2 + 0.3;

            Assert.AreEqual(expectedResult, feed);
        }
Exemplo n.º 10
0
        public void Multiple_babelfish_can_be_added_to_the_fish_tank()
        {
            // Arrange
            Tank      tank  = new Tank();
            BabelFish fish1 = new BabelFish("Bob 1");
            BabelFish fish2 = new BabelFish("Bob 2");

            // Act
            tank.AddFish(fish1);
            tank.AddFish(fish2);

            // Assert
            Assert.Equal(2, tank.FishCount);
        }
Exemplo n.º 11
0
        public void Multiple_goldfish_can_be_added_to_the_fish_tank()
        {
            // Arrange
            Tank     tank  = new Tank();
            GoldFish fish1 = new GoldFish("Geoff 1");
            GoldFish fish2 = new GoldFish("Geoff 2");

            // Act
            tank.AddFish(fish1);
            tank.AddFish(fish2);

            // Assert
            Assert.Equal(2, tank.FishCount);
        }
Exemplo n.º 12
0
        public void Multiple_angelfish_can_be_added_to_the_fish_tank()
        {
            // Arrange
            Tank      tank  = new Tank();
            AngelFish fish1 = new AngelFish("Abigail 1");
            AngelFish fish2 = new AngelFish("Abigail 2");

            // Act
            tank.AddFish(fish1);
            tank.AddFish(fish2);

            // Assert
            Assert.Equal(2, tank.FishCount);
        }
Exemplo n.º 13
0
        public void Feeding_all_fish_types_returns_correct_food_weight_value()
        {
            // Arrange
            float expectedResult = 0.6f;
            Tank  tank           = new Tank();

            tank.AddFish(new AngelFish("Abigail"));
            tank.AddFish(new BabelFish("Bob"));
            tank.AddFish(new GoldFish("Geoff"));

            // Act
            float result = tank.Feed();

            // Assert
            Assert.Equal(expectedResult, result);
        }
Exemplo n.º 14
0
        static void Main(string[] args)
        {
            var tank = new Tank();

            var goldFish  = new GoldFish("Bob");
            var angelFish = new AngelFish("Jim");
            var babelFish = new BabelFish("Harry");

            tank.AddFish(goldFish);
            Console.WriteLine(tank.Feed());
            tank.AddFish(angelFish);
            Console.WriteLine(tank.Feed());
            tank.AddFish(babelFish);
            Console.WriteLine(tank.Feed());
            Console.ReadLine();
        }
Exemplo n.º 15
0
        public void All_fish_types_can_be_added_to_the_fish_tank()
        {
            // Arrange
            int       expectedResult = 3;
            Tank      tank           = new Tank();
            AngelFish fish1          = new AngelFish("Abigail");
            BabelFish fish2          = new BabelFish("Bob");
            GoldFish  fish3          = new GoldFish("Geoff");

            // Act
            tank.AddFish(fish1);
            tank.AddFish(fish2);
            tank.AddFish(fish3);

            // Assert
            Assert.Equal(expectedResult, tank.FishCount);
        }
Exemplo n.º 16
0
        public void AddOneFishToTank()
        {
            var tank = new Tank();

            tank.AddFish(goldFish);

            Assert.AreEqual(1, tank.fishList.Count);
        }
Exemplo n.º 17
0
        public void CanAddAFishToTank()
        {
            var tank = new Tank();

            tank.AddFish(goldFish);

            Assert.AreEqual(1, tank.Fish.Count);
        }
Exemplo n.º 18
0
        public void TestBabelFishFeed()
        {
            var tank = new Tank();

            tank.AddFish(babelFish);

            double expectedResult = 0.3;

            Assert.AreEqual(expectedResult, tank.Feed());
        }
Exemplo n.º 19
0
        public void Adding_null_fish_to_tank_throws_exception()
        {
            // Arrange
            string expectedResult = "Error attempting to add a null fish to the tank, type : Tank, parameter : fish";
            Tank   tank           = new Tank();

            // Act
            Exception ex = Assert.Throws <ArgumentException>(() => tank.AddFish(null));

            // Assert
            Assert.Equal(expectedResult, ex.Message);
        }
Exemplo n.º 20
0
        /// <summary>
        /// Adds fish to the fish tank based on the specified fish quantities.
        /// </summary>
        /// <param name="angelFishCount">The number of angel fish to add to the tank.</param>
        /// <param name="babelFishCount">The number of babel fish to add to the tank.</param>
        /// <param name="goldFishCount">The number of gold fish to add to the tank.</param>
        /// <returns>The fish tank.</returns>
        private Tank InitialiseTank(int angelFishCount, int babelFishCount, int goldFishCount)
        {
            Tank result = new Tank();

            for (int i = 0; i < angelFishCount; i++)
            {
                result.AddFish(new AngelFish($"Abigail {i + 1}"));
            }

            for (int i = 0; i < babelFishCount; i++)
            {
                result.AddFish(new BabelFish($"Bob {i + 1}"));
            }

            for (int i = 0; i < goldFishCount; i++)
            {
                result.AddFish(new GoldFish($"Geoff {i + 1}"));
            }

            return(result);
        }
Exemplo n.º 21
0
        public void A_single_goldfish_can_be_added_to_the_fish_tank()
        {
            // Arrange
            Tank     tank = new Tank();
            GoldFish fish = new GoldFish("Geoff");

            // Act
            tank.AddFish(fish);

            // Assert
            Assert.Equal(1, tank.FishCount);
        }
Exemplo n.º 22
0
        public void A_single_babelfish_can_be_added_to_the_fish_tank()
        {
            // Arrange
            Tank      tank = new Tank();
            BabelFish fish = new BabelFish("Bob");

            // Act
            tank.AddFish(fish);

            // Assert
            Assert.Equal(1, tank.FishCount);
        }