示例#1
0
        public void DeterminesAveragesGrade()
        {
            var g1 = new StudentGrade
            {
                FirstName   = "Imma",
                LastName    = "Avoro",
                LetterGrade = "A",
                NumberGrade = 100
            };

            var g2 = new StudentGrade
            {
                FirstName   = "Erin",
                LastName    = "Bendor",
                LetterGrade = "B",
                NumberGrade = 86
            };

            var g3 = new StudentGrade
            {
                FirstName   = "Jim",
                LastName    = "Carlos",
                LetterGrade = "C",
                NumberGrade = 72
            };

            var grades = new ClassGrades(new[] { g1, g2, g3 });

            grades.AverageGrade.Should().Be(86);
        }
示例#2
0
 /// <summary>
 /// Gets all *.csv files located in the <paramref name="csvFileRootFolder"/> root, and returns
 /// an <see cref="IEnumerable{T}"/> of each parsed <see cref="ClassGrades"/> object.
 /// </summary>
 /// <param name="csvFileRootFolder">
 /// The <see cref="DirectoryInfo"/> representing the directory location of the csv files to parse.
 /// </param>
 /// <returns>
 /// Returns an <see cref="IEnumerable{T}"/> of each parsed <see cref="ClassGrades"/> object.
 /// </returns>
 public static IEnumerable <ClassGrades> GetAllStudentGradesForAllFiles(
     DirectoryInfo csvFileRootFolder)
 {
     foreach (var csvGradeFile in csvFileRootFolder.GetFiles("*.csv"))
     {
         yield return(ClassGrades.ParseFromCsvFile(csvGradeFile));
     }
 }
示例#3
0
        private static void ThirdWeekExamples()
        {
            Console.WriteLine("Instance of AccessModifiers() called myAccMod1");
            AccessModifiers myAccMod1 = new AccessModifiers();

            Console.WriteLine("Instance of AccessModifiers() called myAccMod2");
            AccessModifiers myAccMod2 = new AccessModifiers("This one Has a String");

            Console.WriteLine("Indexer Example");
            myAccMod1.IndexerExample();
            Console.WriteLine("ClassFinalizerSample Class Definitions");
            ClassFinalizerSample myCFS  = new ClassFinalizerSample();
            ClassFinalizerSample myCFS2 = new ClassFinalizerSample("Johnny Quest", 4538702);
            ClassFinalizerSample myCFS3 = new ClassFinalizerSample("Johnny Quest");

            Console.WriteLine("Class Grades Assignment");
            ClassGrades myClassGrades = new ClassGrades("Joe ", "Smith", 'E');

            (string firstName, string lastName, char Grades) = myClassGrades;
            Console.WriteLine($"Person Details: First Name: {firstName}, Last Name: {lastName}, Grade: {Grades}");
            Console.WriteLine("Example of using NameOf");
            Console.WriteLine(myClassGrades.MyGradeType());
            DevelopmentClass myDevelopment = new DevelopmentClass();
            int x, y;

            x = myDevelopment.ClassTotal;
            y = myDevelopment.RoomTotal;
            Console.WriteLine($"Class Total: {x}, RoomTotal: {y}");
            Hatchback myHatchback1 = new Hatchback();

            myHatchback1.Color();
            myHatchback1.Size();
            myHatchback1.Speed();
            myHatchback1.Weight();

            Console.WriteLine(StaticExample.AddTwoNumbers(1, 2));
            Console.WriteLine(Math.Abs(-10));

            String Name = "Bob";

            if (IsPalinDrome.IsPalindrome(Name))
            {
                Console.WriteLine($"{Name} is a palindrome");
            }
            else
            {
                Console.WriteLine($"{Name} is not a palindrome");
            }

            if (IsPalinDrome.IsPalindrome(Name = "Sarah"))
            {
                Console.WriteLine($"{Name} is a palindrome");
            }
            else
            {
                Console.WriteLine($"{Name} is not a palindrome");
            }
        }
示例#4
0
        public void CountByGradeLetter()
        {
            var g1 = new StudentGrade
            {
                FirstName   = "Imma",
                LastName    = "Avoro",
                LetterGrade = "A",
                NumberGrade = 100
            };

            var g2 = new StudentGrade
            {
                FirstName   = "Erin",
                LastName    = "Bendor",
                LetterGrade = "B",
                NumberGrade = 86
            };

            var g3 = new StudentGrade
            {
                FirstName   = "Kelly",
                LastName    = "Jones",
                LetterGrade = "C",
                NumberGrade = 76
            };

            var g4 = new StudentGrade
            {
                FirstName   = "Joe",
                LastName    = "Smith",
                LetterGrade = "B",
                NumberGrade = 84
            };

            var grades = new ClassGrades(new[] { g1, g2, g3, g4 });

            grades.CountsByGradeLetter.Should().BeEquivalentTo(new [] { ("A", 1), ("B", 2), ("C", 1) });