public void Test1()
        {
            Goose goose = new Goose();
            GooseToIDuckAdapter adapter = new GooseToIDuckAdapter(goose);

            Assert.AreEqual(adapter.Quack(), goose.Honk());
        }
Esempio n. 2
0
        public void A_goose_that_is_saddled_should_not_accept_another_saddle()
        {
            //Arrange
            var bunny          = new Rabbit();
            var emotionalState = "Pooped-filled Anger";
            var orignalSaddle  = new Saddle();
            var largeGoose     = new Goose
            {
                Name          = "Tedothy",
                Sex           = Sex.Male,
                Size          = Size.Large,
                EmotinalState = emotionalState,
                Saddle        = orignalSaddle
            };
            var largeSaddle = new Saddle {
                Size = Size.Large, InUse = false
            };

            bunny.OwnedSaddle.Add(largeSaddle);
            bunny.OwnedGeese.Add(largeGoose);

            //Act
            bunny.SaddleThatGoose(largeGoose, largeSaddle);

            //Assert
            // Assert.NotEqual(largeSaddle, largeGoose.Saddle);
            Assert.Equal(orignalSaddle, largeGoose.Saddle);
            Assert.Equal("Exhausted", largeGoose.EmotinalState); // the goose should be exhausted
        }
Esempio n. 3
0
        public void A_goose_and_Saddle_that_are_not_same_size_should_not_be_compatible()
        {
            //Arrange
            var bunny      = new Rabbit();
            var largeGoose = new Goose
            {
                Name = "Tedothy",
                Sex  = Sex.Male,
                Size = Size.Large
            };
            var smallSaddle = new Saddle {
                Size = Size.Small, InUse = false
            };

            bunny.OwnedSaddle.Add(smallSaddle);
            bunny.OwnedGeese.Add(largeGoose);

            //Act
            bunny.SaddleThatGoose(largeGoose, smallSaddle);

            //Assert
            Assert.NotSame(smallSaddle, largeGoose.Saddle); // what we are not expecting, what should happen
            Assert.False(smallSaddle.InUse);
            Assert.Equal("Distraught by fat shaming", largeGoose.EmotinalState);
        }
Esempio n. 4
0
    public void simulate(AbstractDuckFactory duckFactory)
    {
        Quackable mallardDuck  = duckFactory.createMallardDuck();
        Quackable redheadDuck  = duckFactory.createRedheadDuck();
        Quackable duckCall     = duckFactory.createDuckCall();
        Quackable rubberDuck   = duckFactory.createRubberDuck();
        Goose     goose        = new Goose();
        Quackable gooseAdapter = new GooseAdapter(goose);

        Flock flockOfDucks = new Flock();

        Quackologist quackologist = new Quackologist();

        flockOfDucks.add(mallardDuck);
        flockOfDucks.add(redheadDuck);
        flockOfDucks.add(duckCall);
        flockOfDucks.add(rubberDuck);

        //foarte important sa fie dupa ce am adaugat lez ducks ,
        //inregistrarea observerului se face cu interator pt toate lez ducks existente
        flockOfDucks.registerObserver(quackologist);

        Console.WriteLine("Duck Simulator");

        simulate(flockOfDucks);

        Console.WriteLine(" The ducks quacked " + QuackCounter.getQaucks() + " times");
    }
Esempio n. 5
0
        public void A_goose_and_Saddle_of_the_same_size_should_be_compatible()
        {
            //Arrange
            var bunny          = new Rabbit();
            var emotionalState = "Pooped-filled Anger";
            var largeGoose     = new Goose
            {
                Name          = "Tedothy",
                Sex           = Sex.Male,
                Size          = Size.Large,
                EmotinalState = emotionalState
            };
            var largeSaddle = new Saddle
            {
                Size  = Size.Large,
                InUse = false
            };

            bunny.OwnedSaddle.Add(largeSaddle);
            bunny.OwnedGeese.Add(largeGoose);

            //Act
            // ctrl. to create a method in Rabbit.cs
            bunny.SaddleThatGoose(largeGoose, largeSaddle);


            //Assert

            Assert.Same(largeSaddle, largeGoose.Saddle);
            Assert.True(largeSaddle.InUse);
            Assert.Equal(emotionalState, largeGoose.EmotinalState);
        }
Esempio n. 6
0
        static void Main()
        {
            Tiger Amur = new Tiger();

            Amur.protection_status();
            Amur.color();
            WhiteTiger Timur = new WhiteTiger();

            Timur.protection_status();
            Timur.color();
            Kitten Mur = new Kitten();

            Mur.protection_status();
            Mur.color();
            Mur.noise();
            Mur.quantity = 3;
            Console.WriteLine("This quantity of kitten of white tiger is {0}", Mur.quantity);
            Goose Grey = new Goose(10);

            Grey.protection_status();
            Grey.features();
            Console.WriteLine(Grey.speed);
            Grey.swim();
            Sparrow Captain = new Sparrow();

            Captain.protection_status();
            Captain.features();
            Captain.speed = 7;
            Console.WriteLine("Speed of Captain is {0}", Captain.speed);
            Captain.food();
            Captain.place();
            Captain.swim();
            Captain.size();
        }
Esempio n. 7
0
    //private CameraController camController;

    // Start is called before the first frame update
    private void Awake()
    {
        party = GameObject.Find("GameManager").GetComponent <Party>();
        goose = party.partyMembers[0];
        cam   = Camera.main;
        //camController = cam.GetComponent<CameraController>();
    }
Esempio n. 8
0
        static void Main(string[] args)
        {
            Goose g1 = new Goose();

            Console.WriteLine(g1.Fly());
            g1.FlyBehavior = new NoFly();
            Console.WriteLine(g1.Fly());
        }
        static void Main(string[] args)
        {
            Goose goose = new Goose();

            goose.GooseStats();
            goose.GetEnemyEnmName();
            Console.WriteLine(goose.GetEnemyEnmName());
            Console.WriteLine(goose.GetEnemyEnmStr());
        }
Esempio n. 10
0
        public void Compound_Adapter_Behavior()
        {
            DuckSimulator duckSim      = new DuckSimulator();
            IQuackable    duck1        = new RubberDuck();
            Goose         goose        = new Goose();
            IQuackable    gooseAdapter = new GooseAdapter(goose);

            duckSim.Simulate(duck1);
            duckSim.Simulate(gooseAdapter);
        }
Esempio n. 11
0
        public IActionResult AddGooseToRabbit(int id, Goose goose)
        {
            var rabbit = _storage.GetById(id);

            if (rabbit == null)
            {
                return(NotFound());
            }

            rabbit.OwnedGeese.Add(goose);
            return(Ok());
        }
Esempio n. 12
0
        static void Main(string[] args)
        {
            //
            // OLD MACDONALD
            //
            Console.WriteLine("Old MacDonald had a farm ee ay ee ay oh");

            // Let's try singing about a Farm Animal
            List <ISingable> farm = new List <ISingable>();

            farm.Add(new Palimino());
            farm.Add(new Horse());
            farm.Add(new Goose());
            Goose gooseB = new Goose();

            farm.Add(new Horse());
            farm.Add(new Palimino());
            farm.Add(new Horse("gary"));
            farm.Add(gooseB);
            farm.Add(new Goat());
            farm.Add(new Tractor());

            List <ISellable> forTheYardSale = new List <ISellable>();

            // Can we swap out any animal in place here?
            foreach (ISingable thingOnTheFarm in farm)
            {
                if (thingOnTheFarm is Goose) //rename all the geese bernard
                {
                    ((Goose)thingOnTheFarm).reNameTheGoose("bernard");
                }
                if (thingOnTheFarm is ISellable)
                {
                    forTheYardSale.Add((ISellable)thingOnTheFarm);
                }


                Console.WriteLine("And on his farm there was a " + thingOnTheFarm.Name + " ee ay ee ay oh");
                Console.WriteLine("With a " + thingOnTheFarm.MakeSoundTwice() + " here and a " + thingOnTheFarm.MakeSoundTwice() + " there");
                Console.WriteLine("Here a " + thingOnTheFarm.MakeSoundOnce() + ", there a " + thingOnTheFarm.MakeSoundOnce() + " everywhere a " + thingOnTheFarm.MakeSoundTwice());
                Console.WriteLine("Old Macdonald had a farm, ee ay ee ay oh");
                Console.WriteLine();
            }

            forTheYardSale.Add(new Apple());
            Console.WriteLine("Sellable things: ");
            foreach (ISellable thingToSell in forTheYardSale)
            {
                Console.Write(thingToSell.Name + ", ");
            }

            Console.ReadLine();
        }
Esempio n. 13
0
        private static void ChangeSkin(Goose __instance)
        {
            m_skin = __instance.GetComponentsInChildren <SkinnedMeshRenderer> () [0];
            Shader   shader = Shader.Find("VertexLit");
            Material mat    = new Material(shader);

            mat.SetColor("_Color", m_currentColor);
            mat.SetFloat("_EmissionColor", m_currentColor.r * 10f);
            //mat.SetTexture("_MainTex", null);
            m_skin.material = new Material(mat);
            StartRoutine(__instance);
        }
        public void CanCoexist_WhenCharacterAreFoxAndGoose_ReturnsReason()
        {
            // Arrange
            var goose = new Goose();
            var fox   = new Fox();

            // Act
            var result = fox.CanCoexist(goose);

            // Assert
            Assert.Equal("Fox will eat the goose", result);
        }
        public void CanCoexist_WhenCharactersAreFarmerAndGoose_ReturnsEmpty()
        {
            // Arrange
            var goose  = new Goose();
            var farmer = new Farmer();

            // Act
            var result = farmer.CanCoexist(goose);

            // Assert
            Assert.Null(result);
        }
Esempio n. 16
0
        public void Compound_Decorator_Behavior()
        {
            DuckSimulator duckSim      = new DuckSimulator();
            IQuackable    duck1        = new QuackCounter(new RubberDuck());
            Goose         goose        = new Goose();
            IQuackable    gooseAdapter = new QuackCounter(new GooseAdapter(goose));

            duckSim.Simulate(duck1);
            duckSim.Simulate(gooseAdapter);

            Assert.AreEqual(2, QuackCounter.GetQuackCount());
        }
Esempio n. 17
0
        public static void Main(string[] args)
        {
            Console.WriteLine("***************************  Toy  ***************************************");

            var babyCube = new BabyCube(10, "VTech");

            babyCube.Describe();
            babyCube.SetLevel(1);

            Console.WriteLine("***************************  Birds  ***************************************");

            //Birds (the parent constructor was executed first before the child constructor)
            var goose = new Goose(true, 2, "seeds", "gray");

            Console.WriteLine("***************************  Pets  ***************************************");

            //Pets(child can have its own methods Bark or Climb)
            var puppy = new Puppy(false, 4, "bones", "yellow");

            puppy.Bark();

            Console.WriteLine("---------------------------------");

            var kitty = new Kitty(false, 4, "fish", "yellow");

            kitty.Climb();

            Console.WriteLine("***************************  Crawls  ***************************************");

            //Crawls(child can use its implemented interface methods and call the parent public methods)
            var turtle = new Turtle(false, 4, "insects", "brown");

            turtle.Crawl();
            turtle.Eat();
            //turtle.Confidential();
            turtle.MakePublic();

            Console.WriteLine("---------------------------------");

            var crocodile = new Crocodile(false, 4, "fish", "gray");

            crocodile.Sleep();
            crocodile.Crawl();

            Console.WriteLine("---------------------------------");

            var tortoise = new Tortoise(true, 4, "grass", "gray");

            tortoise.Sleep();
            tortoise.Crawl();
            tortoise.Walk();
        }
Esempio n. 18
0
    protected virtual Vector3 _predictTargetPosition(Vector3 from, Goose goose)
    {
        Vector3 target   = goose.transform.position;
        float   distance = Vector3.Distance(from, target);
        float   u1       = Math.Abs(Stats.Projectile.Velocity);
        float   u2       = Math.Abs(goose.Speed);
        float   angle    = Mathf.Deg2Rad * (Vector3.Angle(from - target, goose.Movement));
        float   time     = Mathf.Abs((Mathf.Sqrt(2) * Mathf.Sqrt(2 * distance * distance * u1 * u1 + distance * distance * u2 * u2 * Mathf.Cos(2 * angle) - distance * distance * u2 * u2) - 2 * distance * u2 * Mathf.Cos(angle)) / (2 * (u1 * u1 - u2 * u2)));

        Vector3 prediction = goose.Movement * time + new Vector3(-0.15f, 0.15f, 0);

        return(target + prediction);
    }
Esempio n. 19
0
        private static IEnumerator <WaitForSeconds> ChangeWantedColor(Goose goose)
        {
            while (true)
            {
                if (goose.gooseHonker.justQuacked)
                {
                    m_currentColor = m_skin.material.color;
                    m_fProgress    = 0.01f;
                    m_wantedColor  = UnityEngine.Random.ColorHSV(0f, 1f, 0f, 1f, 0f, 1f);
                }

                yield return(null);
            }
        }
Esempio n. 20
0
        public void NotCompatibleCharacters_ReturnsListOfStrings()
        {
            // Arrange
            var character = new Goose();

            // Act
            var result = character.NotCompatibleCharacters;

            // Assert
            Assert.IsType <Dictionary <string, string> >(result);
            Assert.Equal(2, result.Count);
            Assert.Equal("Fox will eat the goose", result["Fox"]);
            Assert.Equal("Goose will eat the bean", result["Bean"]);
        }
Esempio n. 21
0
        [HttpPut("{id}/geese")] // puttig a goose onto a rabbit
        public IActionResult AddGooseToRabbit(int id, Goose goose)
        {
            var rabbit = _storage.GetById(id);

            // check to see if a rabbit is not null so it wont throw an excecption error

            if (rabbit == null)
            {
                return(NotFound());
            }

            rabbit.OwnedGeese.Add(goose);
            return(Ok());
        }
Esempio n. 22
0
        public void Moveplayer_WhenLandingOnGooseAndNextSquareIsAlsoAGoose_PlayerIsMovedToCorrectPosition()
        {
            // Arrange
            ISquare square     = new Goose(-1);
            int     diceAmount = 4;

            player = players[0];
            player.AmountOfDice = diceAmount;
            player.Position     = 46;

            // Act
            gameboard.MovePlayer(player, diceAmount, square);

            // Assert
            Assert.AreEqual(54, player.Position);
        }
        public static void Init(string[] args)
        {
            PetWalker pw = new PetWalker();

            Dog lassie = new Dog {
                Name = "Lassie", FurColor = "Golden", Attitude = "Heroic"
            };

            pw.Walk(lassie);

            Goose carl = new Goose {
                Name = "Carl", Attitude = "Asshole", FeatherColor = "Snow White"
            };

            pw.Walk(carl);
        }
Esempio n. 24
0
        static void Main(string[] args)
        {
            Parent      man         = new Parent("Мужик", "Мужской", 52);
            Parent      woman       = new Parent("Баба", "Женский", 44);
            Child       daughter    = new Child("Доченька", "Женский", 12);
            Child       son         = new Child("Сынок", "Мужской", 8);
            Goose       goose       = new Goose("Гуси-лебеди", "Птица", "Коричневые", 1, 1, 2);
            Oven        oven        = new Oven("Печка", "Еда");
            AppleTree   apple_tree  = new AppleTree("Яблоня", "Фрукты", 21);
            MilkRiver   milk_river  = new MilkRiver("Молочная река", 100, 21);
            GrandParent granny_yaga = new GrandParent("Баба-Яга", "Женский", 119);
            Mouse       mouse       = new Mouse("Мышка", "Грызун", "Серый", 1, 1, 4);

            Swan_geese_story(man, woman, daughter, son, goose, oven, apple_tree, milk_river, granny_yaga, mouse);
            //правильная концвока при 2, 2, 2, 2, 1, 1, 1, 1 включая рандомы

            Console.ReadKey();
        }
Esempio n. 25
0
        static void Main(string[] args)
        {
            Parent              man         = new Parent("Мужик", "Мужской", 52);
            Parent              woman       = new Parent("Баба", "Женский", 44);
            Child               daughter    = new Child("Доченька", "Женский", 12, 4);
            Child               son         = new Child("Сынок", "Мужской", 8, 1);
            Goose               goose       = new Goose("Гуси-лебеди", "Птица", "Коричневые", 1, 1, 2);
            Oven                oven        = new Oven("Печка", "Еда");
            AppleTree           apple_tree  = new AppleTree("Яблоня", "Фрукты", 21);
            MilkRiver           milk_river  = new MilkRiver("Молочная река", 100, 21);
            GrandParent <Human> granny_yaga = new GrandParent <Human>("Баба-Яга", "Женский", 119);
            Mouse               mouse       = new Mouse("Мышка", "Грызун", "Серый", 1, 1, 4);

            //правильная концвока при 2, 2, 2, 2, 1, 1, 1, 1 включая рандомы
            //Класс Zmey(в нем находится так же dictionary) и GrandParent обобщенные

            StoryTeller storyTeller = new StoryTeller();

            storyTeller.TellStrory(man, woman, daughter, son, goose, oven, apple_tree, milk_river, granny_yaga, mouse);

            Console.ReadKey();
        }
Esempio n. 26
0
    protected virtual IEnumerator _attack()
    {
        while (IsAvailable)
        {
            Goose aim = GooseFabric.Instance.FindGoose(transform.position, Stats.Range);
            // null или далеко
            if (aim == null || _spawnPoints == null)
            {
                yield return(new WaitForSeconds(0.1f));

                continue;
            }

            _animator.SetTrigger("Shoot");
            var shotNumber = _spawnPoints.Count();
            foreach (var spawnPoint in _spawnPoints)
            {
                yield return(new WaitForSeconds(0.05f));

                aim = GooseFabric.Instance.FindGoose(transform.position, Stats.Range);
                if (aim == null)
                {
                    break;
                }

                // добавляю скрипт на префаб
                var        projectile = GameObject.Instantiate(_projectilePrefab, spawnPoint.position, Quaternion.identity, _battlefield);
                Projectile proj       = projectile.GetComponent <Projectile>();

                _audioSource.Play();
                proj.Loauch(spawnPoint.position, _predictTargetPosition(spawnPoint.position, aim), Stats.Projectile);
                yield return(new WaitForSeconds(Stats.AttackDelay / shotNumber));
            }
            // может быть не нужен
            yield return(new WaitForEndOfFrame());
        }
    }
Esempio n. 27
0
        static void Main(string[] args)
        {
            Console.WriteLine("Welcome to the Zoo!");

            Cow       cow       = new Cow();
            BlackBear blackbear = new BlackBear();
            PolarBear polarBear = new PolarBear();
            Ostrich   ostrich   = new Ostrich();
            Goose     goose     = new Goose();
            Tortise   tortise   = new Tortise();
            Crocodile crocodile = new Crocodile();

            Console.WriteLine($"Cow: {cow.PlowField()}");
            Console.WriteLine($"Black Bear: {blackbear.ClimbTree()}");
            Console.WriteLine($"Polar Bear: {polarBear.Sleep()}");
            Console.WriteLine($"Polar Bear: {polarBear.Prey}");
            Console.WriteLine($"Polar Bear: {polarBear.HuntingGround()}");
            Console.WriteLine($"Ostrich: {ostrich.Sprint()}");
            Console.WriteLine($"Ostrich: {ostrich.Race()}");
            Console.WriteLine($"Ostrich: When I race, do I wear blinders? {ostrich.WearBlinders}");
            Console.WriteLine($"Goose: {goose.Sound()}");
            Console.WriteLine($"Tortise: {tortise.HideInShell()}");
            Console.WriteLine($"Crocodile: {crocodile.BirdTeethClean()}");
        }
Esempio n. 28
0
 public GooseAdapter(Goose goose)
 {
     m_observable = new Observable(this);
     m_goose      = goose;
 }
Esempio n. 29
0
 public GooseAdapter(Goose goose)
 {
     Goose = goose;
 }
Esempio n. 30
0
 public GooseAdapter(Goose goose)
 {
     this.goose = goose;
     observable = new Observable(this);
 }