Exemple #1
0
        public void GoldfishEats()
        {
            GoldFish goldFish = new GoldFish();
            string   pellets  = goldFish.Eat();

            Assert.Equal("Feed me pellets!", pellets);
        }
Exemple #2
0
        public void GoldfishLives()
        {
            GoldFish goldFish = new GoldFish();
            string   bowl     = goldFish.Live();

            Assert.Equal("I live in my fish bowl :(", bowl);
        }
Exemple #3
0
        public void GoldfishProducesEggs()
        {
            GoldFish goldFish = new GoldFish();
            string   eggs     = goldFish.Eggs();

            Assert.Equal("I lay soft eggs", eggs);
        }
Exemple #4
0
        public void GoldfishMakesSound()
        {
            GoldFish goldFish = new GoldFish();
            string   bloop    = goldFish.Sound();

            Assert.Equal("Bloop, bloop", bloop);
        }
Exemple #5
0
        public void Run()
        {
            //tank null kontrol
            if (_tank != null)
            {
                var goldFish = new GoldFish("Gold");
                _tank.AddFish(goldFish);

                var angelFish = new AngelFish("Angel");
                _tank.AddFish(angelFish);


                var babelFish = new BabelFish("Babel");
                _tank.AddFish(babelFish);

                var goldFishNemo = new GoldFish("Nemo");
                _tank.AddFish(goldFishNemo);

                var tankFile = _xmlSaver.Save();

                if (!string.IsNullOrEmpty(tankFile))
                {
                    Console.WriteLine(tankFile + Environment.NewLine);
                }

                foreach (var item in _tank.GetFishList())
                {
                    Console.WriteLine($"Fishes in the Tank: {item.Name}");
                }
            }
            else
            {
                Console.WriteLine("Tank is not found!");
            }
        }
Exemple #6
0
        public void CreatingGoldFish_SetsDefaultProperties()
        {
            //Arrange / Act
            var goldFish = new GoldFish("Eric");

            //Assert
            Assert.That(goldFish.FoodRequired, Is.EqualTo(0.1));
            Assert.That(goldFish.Name, Is.EqualTo("Eric"));
        }
Exemple #7
0
        public void GoldFishTest()
        {

            GoldFish goldFish = new GoldFish("Jot");

            Assert.AreEqual("Jot", goldFish.name);
            Assert.AreEqual(0.1, goldFish.foodRequired);

        }
        public void Should_Add_To_The_sut_Gold_Fish()
        {
            var goldFish = new GoldFish("Test Gold Fish");

            var actal = _sut.AddFish(goldFish);

            Assert.IsTrue(actal);
            Assert.AreEqual(0.1, _sut.Feed());
        }
Exemple #9
0
        public void GoldFish_Should_ImplementIFish()
        {
            //Arrange
            //Act
            var fish = new GoldFish() as IFish;

            //Assert
            Assert.That(fish, Is.Not.Null);
        }
Exemple #10
0
        public void Setup()
        {
            _fishTank = new FishTank();

            _goldFish  = new GoldFish(0.1f);
            _angelFish = new AngelFish(0.2f);
            _babelFish = new BabelFish(0.3f);
            _fakeFish  = new FakeFish(0.7f);
        }
        public void Should_Return_Fish_Count_1()
        {
            var goldFish = new GoldFish("Test Gold Fish");
            var actal    = _sut.AddFish(goldFish);

            var count = _sut.GetFishList().Count;

            Assert.IsTrue(actal);
            Assert.AreEqual(1, count);
        }
        public void CreateFishAndNameIsStoredCorrectly()
        {
            goldFish  = new GoldFish("Bob");
            angelFish = new AngelFish("Jim");
            babelFish = new BabelFish("Harry");

            Assert.AreEqual("Bob", goldFish.Name);
            Assert.AreEqual("Jim", angelFish.Name);
            Assert.AreEqual("Harry", babelFish.Name);
        }
        public void GoldFish_name_is_initialised_correctly()
        {
            // Arrange
            string name = "Gold";

            // Act
            GoldFish fish = new GoldFish(name);

            // Assert
            Assert.Equal(name, fish.Name);
        }
Exemple #14
0
        public void FoodRequired_ForGoldFish_ShouldBe0Point1()
        {
            //Arrange
            var fish = new GoldFish();

            //Act
            var foodRequired = fish.FoodRequired;

            //Assert
            Assert.That(foodRequired, Is.EqualTo(0.1));
        }
Exemple #15
0
        public void Name_ForGoldFish_CanBeSet()
        {
            //Arrange
            var fish = new GoldFish();

            //Act
            fish.Name = "gold";

            //Assert
            Assert.That(fish.Name, Is.EqualTo("gold"));
        }
        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);
        }
        public void GoldFish_feed_amount_is_correct_value()
        {
            // Arrange
            float  expectedResult = 0.1f;
            string name           = "Gold";

            // Act
            GoldFish fish = new GoldFish(name);

            // Assert
            Assert.Equal(expectedResult, fish.FeedAmountInGrammes);
        }
        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);
        }
Exemple #19
0
        public void Add_Adds_FishToTheTank()
        {
            //Arrange
            var tank = new Tank();
            var fish = new GoldFish {
                Name = "gold"
            };

            //Act
            tank.Add(fish);

            //Assert
            Assert.That(tank.Count, Is.EqualTo(1));
            Assert.That(tank.Fish.First(), Is.SameAs(fish));
        }
Exemple #20
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();
        }
        public void Should_Add_To_The_sut_Gold_And_Angel_And_Babel_Fish()
        {
            var goldFish = new GoldFish("Test Gold Fish");
            var actal    = _sut.AddFish(goldFish);

            var angelFish = new AngelFish("Test Angel Fish");

            actal = _sut.AddFish(angelFish);

            var babelFish = new BabelFish("Test Babel Fish");

            actal = _sut.AddFish(babelFish);

            Assert.IsTrue(actal);
            Assert.AreEqual(0.6, _sut.Feed());
        }
        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);
        }
Exemple #23
0
        static void Main(string[] args)
        {
            var angelFish = new AngelFish(0.3f);
            var babelFish = new BabelFish(0.5f);
            var goldFish  = new GoldFish(1.0f);

            var eviesFishTank = new FishTank();

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

            var feedingTimeMessage = eviesFishTank.Feed();

            Console.WriteLine("Hello my sweet fishies!");
            Console.BackgroundColor = ConsoleColor.DarkBlue;
            Console.WriteLine(feedingTimeMessage);
        }
        static void Main(string[] args)
        {
            Cat cat = new Cat();

            cat.CanBreath();
            cat.MakeSound();
            cat.canWalk();
            cat.canRun();
            Console.WriteLine(" ");

            Dog dog = new Dog();

            dog.CanBreath();
            dog.MakeSound();
            dog.canWalk();
            dog.canRun();
            Console.WriteLine(" ");


            Frog frog = new Frog();

            frog.CanBreath();
            frog.MakeSound();
            frog.canJump();
            Console.WriteLine(" ");


            GoldFish goldFish = new GoldFish();

            goldFish.CanBreath();
            goldFish.MakeSound();
            goldFish.canSwim();
            Console.WriteLine(" ");

            YellowBird bird = new YellowBird();

            bird.CanBreath();
            bird.MakeSound();
            bird.canFly();
            Console.WriteLine(" ");


            Console.ReadLine();
        }
Exemple #25
0
    static void Main()
    {
        Random r = new Random();

        AnimatedSprite[] aniSpr = new AnimatedSprite[10];

        int hei = r.Next(0, 25);
        int wit = r.Next(3, 78);

        aniSpr[0] = new GoldFish(wit, hei);
        hei       = r.Next(0, 25);
        wit       = r.Next(3, 78);
        aniSpr[1] = new Fish(wit, hei);
        hei       = r.Next(0, 25);
        wit       = r.Next(3, 78);
        aniSpr[2] = new RapeFish(wit, hei);
        hei       = r.Next(0, 25);
        wit       = r.Next(3, 78);
        aniSpr[3] = new SwordFish(wit, hei);
        hei       = r.Next(0, 25);
        wit       = r.Next(3, 78);
        aniSpr[4] = new SharkFish(wit, hei);

        for (int i = 5; i < 10; i++)
        {
            aniSpr[i] = new Bubble(r.Next(0, 81), r.Next(0, 20));
        }

        while (true)
        {
            Console.Clear();
            for (int i = 0; i < 10; i++)
            {
                aniSpr[i].Draw();
            }
            for (int i = 0; i < 10; i++)
            {
                aniSpr[i].Move();
            }

            Thread.Sleep(100); // 100 ms pause
        }
    }
        public void Should_Return_1_Gram_Feed_For_sut()
        {
            var goldFish = new GoldFish("Test Gold Fish");
            var actal    = _sut.AddFish(goldFish);

            var angelFish = new AngelFish("Test Angel Fish");

            actal = _sut.AddFish(angelFish);

            var babelFish = new BabelFish("Test Babel Fish");

            actal = _sut.AddFish(babelFish);

            var goldFishN1 = new GoldFish("Test Gold Fish N1");

            actal = _sut.AddFish(goldFishN1);

            var babelFishN1 = new BabelFish("Test Babel Fish N1");

            actal = _sut.AddFish(babelFishN1);

            Assert.IsTrue(actal);
            Assert.AreEqual(1, _sut.Feed());
        }
        public void Should_GoldFish_Created_Correctly()
        {
            var goldFish = new GoldFish("Test Gold Fish");

            Assert.AreEqual(0.1, goldFish.FoodRequired);
        }
Exemple #28
0
 public TankTests()
 {
     goldFish  = new GoldFish("Bob");
     angelFish = new AngelFish("Jim");
     babelFish = new BabelFish("Harry");
 }
Exemple #29
0
 public TankTest()
 {
     goldFish  = new GoldFish("Spot");
     angelFish = new AngelFish("Dot");
     babelFish = new BabelFish("Jot");
 }
 public TankTests()
 {
     _goldFish  = new GoldFish("gold");
     _angelFish = new AngelFish("angel");
     _babelFish = new BabelFish("babel");
 }