Example #1
1
 public override void Spots(Fruit fruit) { Spotted(this, new ItemEventArgs(Items.Fruit.Track(fruit))); }
    public void SetFruit(Fruit _myFruit)
    {
        myFruit = _myFruit;

        debugFruitType = myFruit.getType().ToString();
        debugXPValue = myFruit.getXP().ToString();
    }
 public void AddFruit( int fruitIndex, Material fruitMaterial )
 {
     Fruit f = new Fruit ();
     f.fruitIndex = fruitIndex;
     f.fruitMaterial = fruitMaterial;
     fruitGroup.Add (f);
 }
        public async Task Creates_single_resource_document_for_registered_non_collection_types()
        {
            // Arrange
            var objectContent = new Fruit { Id = "984", Name = "Kiwi" };

            var mockDocument = new Mock<ISingleResourceDocument>(MockBehavior.Strict);

            var singleResourceDocumentBuilder = new Mock<ISingleResourceDocumentBuilder>(MockBehavior.Strict);
            singleResourceDocumentBuilder.Setup(b => b.BuildDocument(objectContent, It.IsAny<string>(), null, null)).Returns(mockDocument.Object);

            var mockQueryableDocumentBuilder = new Mock<IQueryableResourceCollectionDocumentBuilder>(MockBehavior.Strict);
            var mockResourceCollectionDocumentBuilder = new Mock<IResourceCollectionDocumentBuilder>(MockBehavior.Strict);

            var cancellationTokenSource = new CancellationTokenSource();

            var request = new HttpRequestMessage(HttpMethod.Get, "https://www.example.com/fruits");
            var mockBaseUrlService = new Mock<IBaseUrlService>(MockBehavior.Strict);
            mockBaseUrlService.Setup(s => s.GetBaseUrl(request)).Returns("https://www.example.com");

            // Act
            var fallbackDocumentBuilder = new FallbackDocumentBuilder(singleResourceDocumentBuilder.Object,
                mockQueryableDocumentBuilder.Object, mockResourceCollectionDocumentBuilder.Object, mockBaseUrlService.Object);
            var resultDocument = await fallbackDocumentBuilder.BuildDocument(objectContent, request, cancellationTokenSource.Token);

            // Assert
            resultDocument.Should().BeSameAs(mockDocument.Object);
        }
Example #5
0
    void DrawInventory()
    {
        Dictionary<Fruit, int> fruitDictionary = petInventory.GetFruits();
        Fruit[] fruits = new Fruit[fruitDictionary.Count];
        fruitDictionary.Keys.CopyTo(fruits, 0);

        for (int i = 0; i < fruits.Length; i++)
        {
                Rect fruitPos = new Rect(
            GUITools.NormalizeToScreen(x_dimension, .01f),
            GUITools.NormalizeToScreen(y_dimension, i*.1f+.01f),
            GUITools.NormalizeToScreen(x_dimension,.2f),
            GUITools.NormalizeToScreen(y_dimension,.09f)
            );

            if (GUI.Button(fruitPos, fruits[i].GetName() + " x " + fruitDictionary[fruits[i]].ToString()))
            {
                Fruit myFruit = fruits[i];

                if (petBelly.EatFruit(myFruit))
                {
                    message = "Ate the fruit, now " + petBelly.GetBellyFullness() + " out of " + petBelly.GetBellyCapacity() + " full";
                    petInventory.TakeFruit(fruits[i]);
                }
                else
                {
                    message = "Pet is too full";
                }
            }
        }
    }
Example #6
0
	static int TestEnumInit (Fruit f)
	{
		Fruit [] testedFruits = { f };

		if (f != Fruit.Apple)
			return 1;
		return 0;
	}
        public void Returns_the_object_passed_in()
        {
            var fruit = new Fruit();
            fruit.CastAs<Fruit>().ShouldBeSameAs(fruit);

            var apple = new Apple();
            apple.CastAs<Fruit>().ShouldBeSameAs(apple);
        }
Example #8
0
 public void AddFruit(Fruit fruit)
 {
     if (myFruits.ContainsKey(fruit))
     {
         myFruits[fruit]++;
     }
     else
     {
         myFruits.Add(fruit, 1);
     }
 }
Example #9
0
    //If there is room, eat the given fruit
    //Returns whether the fruit was eaten
    public bool EatFruit(Fruit f)
    {
        if ((GetBellyFullness() + f.getBellyVal()) > bellyCapacity)
        {
            return false;
        }

        fruitList.Add(f.GetClone());

        return true;
    }
Example #10
0
    //Remove the specified fruit, called once the fruit is used up.
    //Returns whether there's any more fruit to use
    public bool RemoveFruit(Fruit f)
    {
        fruitList.Remove(f);

        if (fruitList.Count == 0)
        {
            return false;
        }

        return true;
    }
Example #11
0
    public bool CheckIfSame(Fruit f)
    {
        string myProps = name + myType.ToString() + xp + energy + bellyValue;
        string otherProps = f.name + f.getType().ToString() + f.getXP() + f.getEnergy() + f.getBellyVal();

        if (myProps == otherProps)
        {
            return true;
        }
        return false;
    }
        public void Can_Match_IEquatable_Objects()
        {
            var apple1 = new Fruit("apple");
            var apple2 = new Fruit("apple");
            bool actionInvoked = false;

            apple1.Match()
                .With(apple2, a => actionInvoked = true);

            Assert.True(actionInvoked);
        }
Example #13
0
    public void TakeFruit(Fruit fruit)
    {
        if (myFruits.ContainsKey(fruit))
        {
            myFruits[fruit]--;

            if (myFruits[fruit] == 0)
            {
                myFruits.Remove(fruit);
            }
        }
    }
Example #14
0
    public void AddFruit(Fruit fruit)
    {
        Transform t = fruit.transform;
        t.parent = transform;
        t.localRotation = Quaternion.identity;
        t.localPosition = new Vector3(0, fruits.Count * stackSize, 0);

        fruit.Caught();

        fruits.Enqueue(fruit);
        catcher.transform.localPosition = new Vector3(0, fruits.Count * stackSize, 0);
        AudioSource.PlayClipAtPoint(catchSound, Camera.main.transform.position);
    }
Example #15
0
 public void Eat(Fruit fruit)
 {
     switch (fruit)
     {
         case Fruit.APPLE:
             Console.WriteLine("Bahh");
             return;
         case Fruit.BANANA:
             Console.WriteLine("Yum Yum");
             return;
         default:
             throw new NotImplementedException($"Fruit not supported: {fruit}");
     }
 }
 public void Throws_exception_if_type_does_not_match()
 {
     var fruit = new Fruit();
     var exceptionHit = false;
     try
     {
         fruit.CastTo<Vegetable>();
     }
     catch
     {
         exceptionHit = true;
     }
     exceptionHit.ShouldBeTrue();
 }
        public SwitchDefaultClauseEmpty(Fruit fruit)
        {
            switch (fruit)
            {
                case Fruit.Apple:
                    Console.WriteLine("apple");
                    break;
                //Noncompliant@+1
                default:
                    break;
            }

            switch (fruit)
            {
                case Fruit.Apple:
                    Console.WriteLine("apple");
                    break;
                //Noncompliant@+1
                case Fruit.Orange:
                default:
                    break;
            }
            switch (fruit)
            {
                case Fruit.Apple:
                    Console.WriteLine("apple");
                    break;
                case Fruit.Orange: // Noncompliant
                default:
                    /*commented*/
                    break;
            }

            switch (fruit)
            {
                case Fruit.Apple:
                    Console.WriteLine("apple");
                    break;
                default:
                    Console.WriteLine("other");
                    break;
            }
        }
Example #18
0
        static void Main(string[] args)
        {
            var produce = new List<object>();

            var f1 = new Fruit("Apple", 8.5, 3);
            produce.Add(f1);

            var f2 = new Produce("Banana", 4.5, 7);
            produce.Add(f2);

            produce.Add(new Vegetable("Carrot", 4.1, 16));
            //((Vegetable)produce[2]).Name = "Carrot";
            //((Vegetable)produce[2]).Weight = 4.1;
            //((Vegetable)produce[2]).Quantity = 16;

            Console.WriteLine("There are " + produce.Count + " items");

            foreach (var item in produce)
            {
                Console.WriteLine(item);
            }

        }
		public void SetUp()
		{
			_ctx = new LightSpeedContext<ModelUnitOfWork>("Testing");

			using (var uow = _ctx.CreateUnitOfWork()) {
				
				//clean-up
				uow.Remove(uow.FruitMetas);
				uow.Remove(uow.Fruits);


				//creating test data
				var fruitWithNoMeta = new Fruit { Description = "Apple" };
				uow.Add(fruitWithNoMeta);

				var fruitWithMeta = new Fruit { Description = "Banana" };

				fruitWithMeta.FruitMeta = new FruitMeta { Bitten = true };

				uow.Add(fruitWithMeta);

				uow.SaveChanges();
			}
		}
 public void CollectItem(Fruit fruit)
 {
     myPet.CollectItem(fruit);
 }
 public void Bar(Fruit fruit, Fruit fruit1 = null)
 {
     System.Console.WriteLine("In Tiger.Bar");
 }
        /// <summary>
        /// Reads the next block out of stream.
        /// </summary>
        /// <param name="block">the found block</param>
        /// <returns>type of found block</returns>
        public BlockType Read(out ISerializable block)
        {
            BlockType blockType = (BlockType)stream.ReadByte();

            block = null;

            switch (blockType)
            {
            case BlockType.Ant:
                block = new Ant(this);
                break;

            case BlockType.Anthill:
                block = new Anthill(this);
                break;

            case BlockType.AnthillLost:
                throw new InvalidOperationException(string.Format(Resource.AntvideoSerializerInvalidBlockType, blockType));

            case BlockType.AnthillUpdate:
                throw new InvalidOperationException(string.Format(Resource.AntvideoSerializerInvalidBlockType, blockType));

            case BlockType.AntLost:
                block = new Lost(this);
                break;

            case BlockType.AntUpdate:
                block = new AntUpdate(this);
                break;

            case BlockType.Bug:
                block = new Bug(this);
                break;

            case BlockType.BugLost:
                block = new Lost(this);
                break;

            case BlockType.BugUpdate:
                block = new BugUpdate(this);
                break;

            case BlockType.Team:
                block = new Team(this);
                break;

            case BlockType.TeamLost:
                throw new InvalidOperationException(string.Format(Resource.AntvideoSerializerInvalidBlockType, blockType));

            case BlockType.TeamUpdate:
                throw new InvalidOperationException(string.Format(Resource.AntvideoSerializerInvalidBlockType, blockType));

            case BlockType.Colony:
                block = new Colony(this);
                break;

            case BlockType.ColonyLost:
                throw new InvalidOperationException(string.Format(Resource.AntvideoSerializerInvalidBlockType, blockType));

            case BlockType.ColonyUpdate:
                block = new ColonyUpdate(this);
                break;

            case BlockType.Frame:
                block = new Frame(this);
                break;

            case BlockType.StreamEnd:
                break;

            case BlockType.FrameLost:
                throw new InvalidOperationException(string.Format(Resource.AntvideoSerializerInvalidBlockType, blockType));

            case BlockType.FrameUpdate:
                block = new FrameUpdate(this);
                break;

            case BlockType.Fruit:
                block = new Fruit(this);
                break;

            case BlockType.FruitLost:
                block = new Lost(this);
                break;

            case BlockType.FruitUpdate:
                block = new FruitUpdate(this);
                break;

            case BlockType.Marker:
                block = new Marker(this);
                break;

            case BlockType.MarkerLost:
                block = new Lost(this);
                break;

            case BlockType.MarkerUpdate:
                block = new MarkerUpdate(this);
                break;

            case BlockType.Caste:
                block = new Caste(this);
                break;

            case BlockType.CasteLost:
                throw new InvalidOperationException(string.Format(Resource.AntvideoSerializerInvalidBlockType, blockType));

            case BlockType.CasteUpdate:
                throw new InvalidOperationException(string.Format(Resource.AntvideoSerializerInvalidBlockType, blockType));

            case BlockType.Sugar:
                block = new Sugar(this);
                break;

            case BlockType.SugarLost:
                block = new Lost(this);
                break;

            case BlockType.SugarUpdate:
                block = new SugarUpdate(this);
                break;

            case BlockType.FrameStart:
                break;

            case BlockType.FrameEnd:
                break;

            default:
                throw new InvalidOperationException(string.Format(Resource.AntvideoSerializerInvalidBlockType, blockType));
            }

            return(blockType);
        }
Example #23
0
        public void Foo()
        {
            string c = null;

            if (c is null)
            {
                doTheThing(c);
            }
            if (c is null) // Noncompliant {{This condition was just checked on line 8.}}
            {
                doTheThing(c);
            }
            if (c is not null) // Compliant
            {
                doTheThing(c);
            }

            if (c is "banana") // Compliant, c might be updated in the previous if
            {
                c += "a";
            }
            if (c is "banana") // Compliant, c might be updated in the previous if
            {
                c = "";
            }
            if (c is "banana") // Compliant, c might be updated in the previous if
            {
                c = "";
            }

            int i = 0;

            if (i is > 0 and < 100)
            {
                doTheThing(i);
            }
            if (i is > 0 and < 100) // Noncompliant {{This condition was just checked on line 35.}}
            {
                doTheThing(i);
            }

            Fruit f    = null;
            bool  cond = false;

            if (f is Apple)
            {
                f = cond ? new Apple() : new Orange();
            }
            if (f is Apple) // Compliant as f may change
            {
                f = cond ? new Apple() : new Orange();
            }

            if (f is not null)
            {
            }
            if (f != null)
            {
            }                  // FN, same as above

            if (f is null)
            {
            }
            if (f == null)
            {
            }                  // FN, same as above
        }
Example #24
0
    //给左右两半添加力
    void AddForce(Fruit f, float force)
    {
        Rigidbody2D rigi = f.gameObject.GetComponent <Rigidbody2D>();

        rigi.AddForce(new Vector2(force * 2, force * 2));
    }
 public ActionResult ChartAnimation()
 {
     return(View(Fruit.GetFruitsSales()));
 }
Example #26
0
 public Banana(string color, string shape, int quantity)
 {
     banana = new Fruit(color, shape, quantity);
 }
Example #27
0
        public ActionResult Add()
        {
            var model = new Fruit();

            return(View(model));
        }
Example #28
0
 public Tree(int age, Fruit fruit)
 {
     _age   = age;
     _fruit = fruit;
 }
Example #29
0
        public SwitchDefaultClauseEmpty(Fruit fruit)
        {
            switch (fruit)
            {
            case Fruit.Apple:
                Console.WriteLine("apple");
                break;

            //Noncompliant@+1
            default: break;
//              ^^^^^^^^^^^^^^^
            }

            switch (fruit)
            {
            case Fruit.Apple:
                Console.WriteLine("apple");
                break;

            //Noncompliant@+1
            case Fruit.Orange:
            default:
                break;
            }

            switch (fruit)
            {
            case Fruit.Apple:
                Console.WriteLine("apple");
                break;

            default:
                // Single line comment before
                break;
            }

            switch (fruit)
            {
            case Fruit.Apple:
                Console.WriteLine("apple");
                break;

            default:
                break;     // Single line comment after
            }

            switch (fruit)
            {
            case Fruit.Apple:
                Console.WriteLine("apple");
                break;

            default:
                /* Multi lines comment before */
                break;
            }

            switch (fruit)
            {
            case Fruit.Apple:
                Console.WriteLine("apple");
                break;

            default:
                break;     /* Multi lines comment after */
            }

            switch (fruit)
            {
            case Fruit.Apple:
                Console.WriteLine("apple");
                break;

            case Fruit.Orange:
            default:
                /*commented*/
                break;
            }

            switch (fruit)
            {
            case Fruit.Apple:
                Console.WriteLine("apple");
                break;

            default:     // Single line comment after
                break;
            }

            switch (fruit)
            {
            case Fruit.Apple:
                Console.WriteLine("apple");
                break;

            default:
            {
                // comment
            }
            break;
            }

            switch (fruit)
            {
            case Fruit.Apple:
                Console.WriteLine("apple");
                break;

            default:
                Console.WriteLine("other");
                break;
            }
        }
 public FruitBasket(Fruit fruit)
 {
     CurrentFruit = fruit;
 }
Example #31
0
 public override void TargetReached(Fruit fruit) { Reached(this, new ItemEventArgs(Items.Fruit.Track(fruit))); }
 public void Bar(Fruit fruit)
 {
     System.Console.WriteLine("In Animal.Bar");
 }
Example #33
0
 /// <summary>
 /// This method is called as soon as an ant sees an apple within its 360°
 /// visual range. The parameter is the piece of fruit that the ant has spotted.
 /// Read more: "http://wiki.antme.net/en/API1:Spots(Fruit)"
 /// </summary>
 /// <param name="fruit">spotted fruit</param>
 public override void Spots(Fruit fruit)
 {
 }
Example #34
0
 /// <summary>
 /// Called once if the ant has reached the targeted fruit.
 /// </summary>
 /// <param name="fruit">Fruit</param>
 public override void TargetReached(Fruit fruit)
 {
 }
        private void OnButtonAddBananaClicked(object sender, RoutedEventArgs e)
        {
            Fruit banana = new Fruit("Banana");

            RizalIlham.addFruit(banana);
        }
Example #36
0
 public IActionResult Create(Fruit fruit)
 {
     return(View("Index", _service.Add(fruit)));
 }
        private void OnButtonAddAppleClicked(object sender, RoutedEventArgs e)
        {
            Fruit apple = new Fruit("Apple");

            RizalIlham.addFruit(apple);
        }
Example #38
0
 void Start()
 {
     _playerControlManager = GetComponent <PlayerControlManager>();
     _fruit = fruit.GetComponent <Fruit>();
     CreateLevel();
 }
 //添加果树
 public void Attach(Fruit fruit)
 {
     fruits.Add(fruit);
 }
Example #40
0
 public void Visit(Fruit fruit)
 {
     // Calculate fruit's price
     Total += fruit.PricePerKg * fruit.Weight;
 }
Example #41
0
 public string EnumArray(Fruit[] fruit)
 {
     if (fruit.Length == 0) return "Empty";
     return string.Join(",", fruit);
 }
 public void Returns_null_if_the_object_is_of_a_different_type()
 {
     var fruit = new Fruit();
     fruit.CastAs<Vegetable>().ShouldBeNull();
 }
 public void Foo(Fruit apple)
 {
     System.Console.WriteLine("In Tiger.Foo");
 }
Example #44
0
 public string EnumDefaultValue(Fruit fruit = Fruit.Apple)
 {
     return fruit.ToString();
 }
Example #45
0
 public void Remove(Fruit entity)
 {
     _dbContext.Fruits.Attach(entity);
     _dbContext.Fruits.Remove(entity);
     _dbContext.SaveChanges();
 }
        public void OnActionExecutedAsync_delegates_to_fallback_document_builder_for_unknown_types()
        {
            // Arrange
            var resource = new Fruit();
            var actionExecutedContext = GetActionExecutedContext(resource);
            var cancellationTokenSource = new CancellationTokenSource();

            var mockResult = new Mock<IJsonApiDocument>(MockBehavior.Strict);
            var mockFallbackDocumentBuilder = new Mock<IFallbackDocumentBuilder>(MockBehavior.Strict);
            mockFallbackDocumentBuilder.Setup(b => b.BuildDocument(resource, It.IsAny<HttpRequestMessage>(), cancellationTokenSource.Token))
                .Returns(Task.FromResult(mockResult.Object));

            var mockErrorDocumentBuilder = new Mock<IErrorDocumentBuilder>(MockBehavior.Strict);

            // Act
            var attribute = new FallbackDocumentBuilderAttribute(mockFallbackDocumentBuilder.Object, mockErrorDocumentBuilder.Object);
            var task = attribute.OnActionExecutedAsync(actionExecutedContext, cancellationTokenSource.Token);
            task.Wait();

            // Assert
            ((ObjectContent)actionExecutedContext.Response.Content).Value.Should().BeSameAs(mockResult.Object);
            actionExecutedContext.Response.StatusCode.Should().Be(HttpStatusCode.OK);
        }
Example #47
0
 private void InitPlayers()
 {
     this.enemeis = new HashSet <Enemy>(this.gameMap.InitEnemies());
     this.pacman  = this.gameMap.InitPacMan();
     this.fruit   = null;
 }
Example #48
0
 public TestDrawableFruit(Fruit h)
     : base(h)
 {
 }
        private void OnButtonAddAnggurClicked(object sender, RoutedEventArgs e)
        {
            Fruit anggur = new Fruit("Anggur");

            RizalIlham.addFruit(anggur);
        }
Example #50
0
 /// <summary>
 /// If the ant’s destination is a piece of fruit, this method is called as soon
 /// as the ant reaches its destination. It means that the ant is now near enough
 /// to its destination/target to interact with it.
 /// Read more: "http://wiki.antme.net/en/API1:DestinationReached(Fruit)"
 /// </summary>
 /// <param name="fruit">reached fruit</param>
 public override void DestinationReached(Fruit fruit)
 {
 }
        private void OnButtonAddOrangeClicked(object sender, RoutedEventArgs e)
        {
            Fruit orange = new Fruit("Orange");

            RizalIlham.addFruit(orange);
        }
        public void WithType_Shouldnt_Invoke_Action_If_Pattern_Doesnt_Match()
        {
            bool patternMatched = false;
            Fruit fruit = new Fruit("fruit");
            fruit.Match()
                .WithType<Apple>(f => patternMatched = true);

            Assert.False(patternMatched);
        }
Example #53
0
 private void Start()
 {
     _fruit = FruitSpawn();
 }
Example #54
0
 public void Add(Fruit entity)
 {
     _dbContext.Fruits.Add(entity);
     _dbContext.SaveChanges();
 }
Example #55
0
 public void Upate(Fruit entity)
 {
     _dbContext.Entry(entity).State = EntityState.Modified;
     _dbContext.SaveChanges();
 }
 //移除果树
 public void Detach(Fruit fruit)
 {
     fruits.Remove(fruit);
 }
        public void Run()
        {
            List <IAnimal> animals = new List <IAnimal>();
            string         input;

            while ((input = Console.ReadLine()) != "End")
            {
                string[] animalTokens = input.Split();
                string   animalType   = animalTokens[0];
                string   name         = animalTokens[1];
                double   weight       = double.Parse(animalTokens[2]);
                IAnimal  currAnimal   = null;
                switch (animalType)
                {
                case nameof(Owl):
                    double wingSize = double.Parse(animalTokens[3]);
                    currAnimal = new Owl(name, weight, wingSize);
                    break;

                case nameof(Hen):
                    wingSize   = double.Parse(animalTokens[3]);
                    currAnimal = new Hen(name, weight, wingSize);
                    break;

                case nameof(Mouse):
                    string livingRegion = animalTokens[3];
                    currAnimal = new Mouse(name, weight, livingRegion);
                    break;

                case nameof(Dog):
                    livingRegion = animalTokens[3];
                    currAnimal   = new Dog(name, weight, livingRegion);
                    break;

                case nameof(Cat):
                    livingRegion = animalTokens[3];
                    string breed = animalTokens[4];
                    currAnimal = new Cat(name, weight, livingRegion, breed);
                    break;

                case nameof(Tiger):
                    livingRegion = animalTokens[3];
                    breed        = animalTokens[4];
                    currAnimal   = new Tiger(name, weight, livingRegion, breed);
                    break;

                default:
                    break;
                }

                string[] foodTokens = Console.ReadLine().Split();
                string   foodType   = foodTokens[0];
                int      quantity   = int.Parse(foodTokens[1]);
                IFood    food       = null;
                switch (foodType)
                {
                case nameof(Meat):
                    food = new Meat(quantity);
                    break;

                case nameof(Vegetable):
                    food = new Vegetable(quantity);

                    break;

                case nameof(Seeds):
                    food = new Seeds(quantity);

                    break;

                case nameof(Fruit):
                    food = new Fruit(quantity);

                    break;

                default:
                    break;
                }

                Console.WriteLine(currAnimal.AskForFood());
                bool hasEaten = currAnimal.EatFood(food);
                if (!hasEaten)
                {
                    Console.WriteLine($"{animalType} does not eat {foodType}!");
                }
                animals.Add(currAnimal);
            }

            foreach (IAnimal animal in animals)
            {
                Console.WriteLine(animal.ToString());
            }
        }
Example #58
0
 static void FillWithOranges(Fruit[] fruits)
 {
 }
        public Fruit PostFruit(Fruit fruit)
        {
            _logger.LogInformation("POST Request: {@Fruit}", fruit);

            return(_fruitService.PostFruit(fruit.name));
        }
        public SwitchDefaultClauseEmpty(Fruit fruit)
        {
            switch (fruit)
            {
                case Fruit.Apple:
                    Console.WriteLine("apple");
                    break;
            }

            switch (fruit)
            {
                case Fruit.Apple:
                    Console.WriteLine("apple");
                    break;
            }
            switch (fruit)
            {
                case Fruit.Apple:
                    Console.WriteLine("apple");
                    break;
            }

            switch (fruit)
            {
                case Fruit.Apple:
                    Console.WriteLine("apple");
                    break;
                default:
                    Console.WriteLine("other");
                    break;
            }
        }