public void FindUserWithSwitchParttenMatchingStatement_WhenClauses_Should_Return_Person()
        {
            PatternMatchingExample example = new PatternMatchingExample();
            Alumnus alumnus = new Alumnus(("Steven", "Jobs", 32), 1974, UniversityDegree.BSc);

            var expected = $"{alumnus.AlumnusDetails().fullName} is a senior Alumnus";

            var result = example.FindUserWithSwitchParttenMatchingStatement(alumnus);

            Assert.AreEqual(expected, result);
        }
        public void FindUserWithSwitchParttenMatchingStatement_Should_Return_Person()
        {
            PatternMatchingExample example = new PatternMatchingExample();
            Student student = new Student(("daniel", "huang", 32), 423103, UniversityCourses.Maths);

            var expected = $"{student.StudentDetails().fullName} is enrolled for {student.StudentDetails().studentCourse} with student number {student.StudentDetails().studentNum}";

            var result = example.FindUserWithSwitchParttenMatchingStatement(student);

            Assert.AreEqual(expected, result);
        }
        public void FindUserWithSwitchAndCheckForNull_Switch_Should_Return()
        {
            PatternMatchingExample example = new PatternMatchingExample();
            var someperson = new object();

            someperson = null;
            var expected = $"{nameof(someperson)} cannot be null";

            var result = example.FindUserWithSwitchAndCheckForNull(someperson);

            Assert.AreEqual(expected, result);
        }
        public void GetVehicle_WithSwitchStatementTest()
        {
            List <Vehicle> vehicles = new List <Vehicle>()
            {
                new Car()
                {
                    Description = "My first car", HorsePower = 200, Name = "Ford Fiesta", PowerType = PowerTypeEnum.Hybrid
                },
                new Bicycle()
                {
                    Description = "My first bicycle", Name = "Atala", Weight = 27
                },
                new Camper()
                {
                    Description = "My first camper", Name = "Sbirulino", NumberOfBeds = 3, NumberOfWindows = 6
                },
                new Car()
                {
                    Description = "My second car", HorsePower = 400, Name = "Fiat Bravo", PowerType = PowerTypeEnum.Diesel
                },
                new Bicycle()
                {
                    Description = "My second bicycle", Name = "Atala", Weight = 15
                },
                new Camper()
                {
                    Description = "My second camper", Name = "Sbirulino", NumberOfBeds = 1, NumberOfWindows = 6
                }
            };
            var expectedResult = new List <Vehicle>()
            {
                new Car()
                {
                    Description = "My first car", HorsePower = 200, Name = "Ford Fiesta", PowerType = PowerTypeEnum.Hybrid
                },
                new Bicycle()
                {
                    Description = "My second bicycle", Name = "Atala", Weight = 15
                },
                new Camper()
                {
                    Description = "My second camper", Name = "Sbirulino", NumberOfBeds = 1, NumberOfWindows = 6
                }
            };

            var result = PatternMatchingExample.GetVehicle_WithSwitchStatement(vehicles);

            Assert.AreEqual(expectedResult.Count, result.Count);
        }
        public void GetCarPowerType_WithIsExpressionTest()
        {
            List <Vehicle> vehicles = new List <Vehicle>()
            {
                new Car()
                {
                    Description = "My first car", HorsePower = 200, Name = "Ford Fiesta", PowerType = PowerTypeEnum.Hybrid
                },
                new Bicycle()
                {
                    Description = "My first bicycle", Name = "Atala", Weight = 27
                },
                new Camper()
                {
                    Description = "My first camper", Name = "Sbirulino", NumberOfBeds = 3, NumberOfWindows = 6
                }
            };

            var result = PatternMatchingExample.GetCarPowerType_WithIsExpression(vehicles);

            Assert.AreEqual(PowerTypeEnum.Hybrid, result);
        }